pyspider README

The project's README from github.com/binux/pyspider. As one markdown file: README.md.

pyspider Build Status Coverage Status

A Powerful Spider(Web Crawler) System in Python.

Tutorial: http://docs.pyspider.org/en/latest/tutorial/
Documentation: http://docs.pyspider.org/
Release notes: https://github.com/binux/pyspider/releases

Sample Code

from pyspider.libs.base_handler import *


class Handler(BaseHandler):
    crawl_config = {
    }

    @every(minutes=24 * 60)
    def on_start(self):
        self.crawl('http://scrapy.org/', callback=self.index_page)

    @config(age=10 * 24 * 60 * 60)
    def index_page(self, response):
        for each in response.doc('a[href^="http"]').items():
            self.crawl(each.attr.href, callback=self.detail_page)

    def detail_page(self, response):
        return {
            "url": response.url,
            "title": response.doc('title').text(),
        }

Installation

WARNING: WebUI is open to the public by default, it can be used to execute any command which may harm your system. Please use it in an internal network or enable need-auth for webui.

Quickstart: http://docs.pyspider.org/en/latest/Quickstart/

Contribute

TODO

v0.4.0

License

Licensed under the Apache License, Version 2.0

pyspider (binux/pyspider)

Searching Database…

16.8K ·GitHub
archived
What is this?pyspider is a powerful web spider (crawler) system written in Python: you write crawling scripts in Python and manage your scraping projects through a built-in web interface.
Is it a library I import into my code, or something I run?Something you run — it is a full crawler system with its own WebUI, not a library. Your crawl logic lives in Python scripts that the system executes, schedules and monitors for you.
How do I get it running?Install it with 'pip install pyspider', run the 'pyspider' command, and open the WebUI in your browser. A Dockerfile is also available in the repo.
Do I need to set up databases or message queues before using it?Not for a quick start — but at scale it plugs into MySQL, MongoDB, Redis, SQLite, Elasticsearch or PostgreSQL (via SQLAlchemy) for storage, and RabbitMQ, Redis or Kombu as its message queue.
Any gotchas before I expose the dashboard?Yes — the WebUI is open to the public by default and can be used to execute arbitrary commands that may harm your system, so keep it on an internal network or enable need-auth for the WebUI.
What can I do from the WebUI?Write and edit crawler scripts, monitor running tasks, manage projects and view scraped results — the whole crawling workflow happens in the browser.
Can it crawl pages that rely on JavaScript?Yes — crawling JavaScript pages is listed among its core features, so it is not limited to static HTML.
How does it handle retries and repeat visits?Tasks support priorities, retries, periodic runs and re-crawling by page age, so you can keep results fresh without rewriting your scripts.
Does it scale beyond a single machine?Yes — it has a distributed architecture, so crawlers can run across multiple machines; pair it with a message queue and a scalable database backend for larger workloads.
Creator
binux
Size
4.1 MB
Stars
16.8K
Age
12y
Commits · 90 Days