如何使用Scrapy实现只抓取域名?
我对任何domain.tld的深度搜索不感兴趣。我的想法是从每个域的索引页面只使用1跳的深度-所以直接从主页链接将足够作为链接缓冲区。
我需要尽可能快的爬虫作为唯一的。
我想将域领域限制为.cz
谢谢。
发布于 2019-03-14 21:10:13
您可以在SETTINGS上使用DEPTH_LIMIT参数将爬网限制为您想要的深度。
https://docs.scrapy.org/en/latest/topics/settings.html?highlight=depth_limit
如果您只想转到一个跳跃深度,您应该设置DEPTH_LIMIT=2并使用selector或link_extractor选择链接。
例如:response.xpath('//a/@href').re(r'.*.example.com.*')
https://docs.scrapy.org/en/latest/topics/selectors.html https://docs.scrapy.org/en/latest/topics/spiders.html?highlight=link_extractor
https://stackoverflow.com/questions/55161589
复制相似问题