使用 scrapy 抓取 http://www.cnbeta.com/topics/9.htm ,先抓取文章标题, yield Item 存储,再根据 link 抓内容, yield content, 然后 time.sleep(1200)。但是 yield content 处理时间比较长, time.sleep 会是全局停止,导致好长时间抓取不到 content ,请教大家怎么做?
1
pango Oct 26, 2015
为什么要 sleep ? scrapy 不是可以自己控制并发数吗?
|
3
sometimesna1ve Oct 26, 2015
@appleaa 为什么不定时 20 分钟后重新跑一次抓取程序?
|
5
ahxxm Oct 27, 2015
"*/20 * * * * timeout=600 scrapy crawl cnbeta"加进 crontab 就行了, 20 分钟来一发, 10 分钟没跑完自动干掉进程
|
6
lev Oct 28, 2015
可以设置全局参数 DOWNLOAD_DELAY http://doc.scrapy.org/en/latest/topics/settings.html
|
7
kmz Jul 6, 2018
|