pyspider Python Web爬网系统

pyspider简介

pyspider,Python第三方库,是一个强大的Spider(Web爬网程序)分布式架构系统,具有强大的WebUI,具有脚本编辑器、任务监视器、结果查看器等,以SQLAlchemy作为数据库后端的PostgreSQL,以RabbitMQ、Redis和Kombu作为消息队列。

pyspider应用实例

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(),
        }

pyspider Github统计数据

Apache-2.0 license

Github 16.1k stars

pyspider安装命令

pip install pyspider

运行命令:pyspider后访问:http://localhost:5000/

pyspider Python版本要求

Python 2.{6,7}, 3.{3,4,5,6}

免责声明:内容编辑自网络,仅供参考,不保证正确性,不作任何决策依据!!以上数据皆截止于博文的写稿日期。


行业导航 / Python指南 :
























Copyright © 2022-2024 笨鸟工具 x1y1z1.com All Rights Reserved.