Coder Social home page Coder Social logo

silene's Introduction

Silene

Silene is an open source web crawler framework built upon Pyppeteer.

Requirements

You must have at least Python 3.7 installed.

Installation

To install the latest release run pip install silene.

Quickstart guide

Each crawler must subclass the Crawler class and implement the abstract configure method. The CrawlerConfiguration specifies the initial requests to make and other properties of the crawler. Once a request is processed, the appropriate callback will be invoked. By default, in case of a successful request the on_response_success callback will be executed. This is where you can interact with the page content. You can also specify custom callbacks for your requests.

Below you can find a very simple implementation.

Example code snippet

from silene.crawl_request import CrawlRequest
from silene.crawl_response import CrawlResponse
from silene.crawler import Crawler
from silene.crawler_configuration import CrawlerConfiguration


class MyCrawler(Crawler):
    def configure(self) -> CrawlerConfiguration:
        return CrawlerConfiguration([CrawlRequest('https://example.com')])

    def on_response_success(self, response: CrawlResponse) -> None:
        # Do something with the response...
        pass

Development instructions

Prerequisite

This project requires Pipenv to be installed.

Create environment

Run pipenv install --dev to create a new virtual environment and install the necessary packages.

Run tests

Run pytest in the project root folder.

Run tests with coverage

Run pytest --cov=silene in the project root folder.

License

The source code of Silene is made available under the Apache License, Version 2.0.

silene's People

Contributors

peterbencze 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.