ITPub博客

首页 > 应用开发 > > scrapy crawlspider 中的deny设置无效?

scrapy crawlspider 中的deny设置无效?

作者:samrain 时间:2019-08-28 13:04:33 0 删除 编辑
Rule(LinkExtractor(allow=rule.get("allow", None), restrict_xpaths=rule.get("restrict_xpaths", ""),deny=('guba','f10','data','fund.*?\.eastmoney\.com/\d+\.html','quote','.*so\.eastmoney.*','life','/gonggao/')),callback=rule.get("callback", ""),follow=rule.get('follow',True))

Rule设置如上,deny拒绝guba、data等链接,但是实际运行中,还是有这些链接(包含了guba的链接):

2019-06-27 10:33:24 [scrapy.core.engine] DEBUG: Crawled (200) <GET http://guba.eastmoney.com/list,of166401.html> (referer: http://fund.eastmoney.com/LOF_jzzzl.html)
2019-06-27 10:33:24 [scrapy.core.engine] DEBUG: Crawled (200) <GET http://guba.eastmoney.com/list,of164206.html> (referer: http://fund.eastmoney.com/LOF_jzzzl.html)
2019-06-27 10:33:24 [scrapy.core.engine] DEBUG: Crawled (200) <GET http://guba.eastmoney.com/list,of161823.html> (referer: http://fund.eastmoney.com/LOF_jzzzl.html)

请问是哪里设置的不对么

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1386/viewspace-3130074/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-04-15

  • 博文量
    108
  • 访问量
    766