爬虫

聚焦Python分布式爬虫必学框架 Scrapy 打造搜索引擎

2018-07-07  本文已影响22人  江湖十年

通过 CrawlSpider 创建爬虫

scrapy genspider --list
scrapy genspider -t crawl lagou www.lagou.com
image.png image.png

要解决上述问题,只需在项目文件 settings.py 中加入如下两行代码即可

# 将 settings.py 所在路径配置到 Python Path
BASE_DIR = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
sys.path.append(os.path.join(BASE_DIR, 'ArticleSpider'))
image.png
上一篇 下一篇

猜你喜欢

热点阅读