2016-03-20 65 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()