一个调度蜘蛛的守护进程
scrapy-do的Python项目详细描述
scrapy do是一个守护进程,它提供了一种运行Scrapyspider的方便方法。它既可以立即做一次;也可以 可以按指定的时间间隔定期运行它们。它的灵感来自 scrapyd但是从头开始写的。它 带有rest api、命令行客户机和交互式web界面。
- Homepage: https://jany.st/scrapy-do.html
- Documentation: https://scrapy-do.readthedocs.io/en/latest/
快速启动
使用pip:
安装scrapy-do。$ pip install scrapy-do
在前台启动守护程序:
$ scrapy-do -n scrapy-do
打开另一个终端窗口,下载Scrapy'sQuotesBot示例,然后 将代码推送到服务器:
$ git clone https://github.com/scrapy/quotesbot.git $cd quotesbot $ scrapy-do-cl push-project +----------------+ | quotesbot | |----------------| | toscrape-css | | toscrape-xpath | +----------------+
安排一些工作:
$ scrapy-do-cl schedule-job --project quotesbot \ --spider toscrape-css --when 'every 5 to 15 minutes'+--------------------------------------+ | identifier | |--------------------------------------| | 0a3db618-d8e1-48dc-a557-4e8d705d599c | +--------------------------------------+ $ scrapy-do-cl schedule-job --project quotesbot --spider toscrape-css +--------------------------------------+ | identifier | |--------------------------------------| | b3a61347-92ef-4095-bb68-0702270a52b8 | +--------------------------------------+
看看发生了什么:
默认情况下,web界面位于http://localhost:7654处。
从源构建
以下两个步骤都要求安装nodejs。
检查工作是否正常:
$ pip install -rrequirements-dev.txt $ tox
制造轮子:
$ python setup.py bdist_wheel