启动爬虫的命令为: scrapy crawl spidername(爬虫名)

方案(一)name.py

#!/usr/bin/env python

# -*- coding:utf-8 -*-

from scrapy import cmdline

# 方式一:注意execute的参数类型为一个列表

cmdline.execute(‘scrapy crawl spidername‘.split())

# 方式二:注意execute的参数类型为一个列表

cmdline.execute([‘scrapy‘, ‘crawl‘, ‘spidername‘])

方案(二)name.py

import time
import os
while True:
  os.system("scrapy crawl sougou --nolog")
  time.sleep(30)# 30s设置定时的时间来执行

_________________________________________

通过python name.py来运行此文件即可

相关文章:

  • 2021-10-02
  • 2022-12-23
  • 2022-12-23
  • 2021-05-03
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-09
  • 2022-12-23
  • 2022-12-23
  • 2021-07-11
  • 2021-08-04
  • 2022-02-07
相关资源
相似解决方案