文件名称:scrapy 爬百度,bing大图
文件大小:34KB
文件格式:ZIP
更新时间:2021-02-14 10:57:57
爬虫 python scrapy
python 通过scrapy框架,根据关键字爬取百度和bing大图
注意:
1.修改commands/crawl.py run函数为:
def run(self, args, opts):
if len(args) < 1:
raise UsageError()
# elif len(args) > 1:
# raise UsageError("running 'scrapy crawl' with more than one spider is no longer supported")
# spname = args[0]
for spname in args:
self.crawler_process.crawl(spname, **opts.spargs)
self.crawler_process.start()
# self.crawler_process.crawl(spname, **opts.spargs)
# self.crawler_process.start()
2. 运行
【文件预览】:
imageCrawler
----scrapy.cfg(268B)
----.idea()
--------misc.xml(687B)
--------workspace.xml(45KB)
--------imageCrawler.iml(459B)
--------modules.xml(276B)
--------vcs.xml(164B)
----imageCrawler()
--------settings.py(12KB)
--------__init__.pyc(152B)
--------pipelines.py(623B)
--------middlewares.py(2KB)
--------scrapy.cfg(269B)
--------items.pyc(405B)
--------__init__.py(0B)
--------.idea()
--------pipelines.pyc(725B)
--------items.py(238B)
--------spiders()
--------middlewares.pyc(3KB)
--------settings.pyc(5KB)
----baiduurl.txt(8KB)
----bingurl.txt(4KB)