2016-03-20 64 views
0

我有一个个人项目,导致我使用Selenium来获取私人[邮件,密码]情侣的公开URL地址。我怎样才能让Scrapy在python项目中爬行?

我想保存在这个网址的信息,我遵循Scrapy教程来了解我如何使用这个工具来做到这一点。但是有没有办法在MyScrapClass.crawl()之类的Python项目中启动爬行,而不是使用linux命令scrapy crawl MyScrapProject

回答

0

使用CrawlerProcess或CrawlerRunner类从Python脚本中运行scrapy ..

http://doc.scrapy.org/en/latest/topics/practices.html

例如从scrapy website采取:

import scrapy 
from scrapy.crawler import CrawlerProcess 

class MySpider(scrapy.Spider): 
    # Your spider definition 
    ... 

process = CrawlerProcess() 
process.crawl(MySpider) 
# the script will block here until the crawling is finished 
process.start()