python实现scrapy定时执行爬虫
在scrapy项目中写一个定时爬虫的程序main.py ,直接放在scrapy的存储代码的目录中就能设定时间定时多次执行。
import time
import os
 
while True:
    os.system("scrapy crawl News")
    time.sleep(86400)  #每隔一天运行一次 24*60*60=86400s
在scrapy项目中写一个定时爬虫的程序main.py ,直接放在scrapy的存储代码的目录中就能设定时间定时多次执行。
import time
import os
 
while True:
    os.system("scrapy crawl News")
    time.sleep(86400)  #每隔一天运行一次 24*60*60=86400s
