Giter Site home page Giter Site logo

kalliope-web-scraper's Introduction

kalliope-web-scraper

A simple neuron for Kalliope to read part of web pages

Synopsis

Make kalliope read information from any web page

Installation

kalliope install --git-url https://github.com/bacardi55/kalliope-web-scraper.git

Options

parameter required default choices comment
url yes The url of the site to parse
main_selector yes The main selector that shoud return a list of htmlelement (each one being a news)
title_selector yes The selector for the the title in each element of the main_selector
description_selector yes The selector for the the description/summary/teaser/โ€ฆ in each element of the main_selector
file_template yes Template file to use

Return Values

Name Description Type sample
returncode The http response code. If everything is ok, should be 200 string
items List of item. Each news contains the title and content (new['title'] new['content'] list

Synapses example

This synapse will find read all "main" news on news.google.com

---
  - name: "Google-news-en"
    signals:
      - order: "what are the latest news"
    neurons:
      - say:
          message: "Searching latest news Sir"
      - web_scraper:
          url: "https://news.google.com"
          main_selector: "div.top-stories-section div.section-content div.story"
          title_selector: "h2.esc-lead-article-title > a > span"
          description_selector: "div.esc-lead-snippet-wrapper"
          file_template: "templates/en_web_scraper.j2"

Template example

{% if returncode != 200 %}
    Error while retrieving web page.
{% else %}
    {% for g in news: %}
        Title: {{ g['title'] }}
        Summary: {{ g['content'] }}
    {% endfor %}
{% endif %}

kalliope-web-scraper's People

Contributors

bacardi55 avatar lamonf avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.