对于同一类,Scrapy shell 响应返回的项目比 Chrome 中的 Selector Gadget 扩展少

问题描述

我正在使用 scrapy 从门户网站下方抓取工作申请。但是我在该类的scrapy shell 中只得到了 10 个项目,它在开发人员工具和选择器小工具中显示了 15 个项目。我对这种差异感到困惑。

测试页面https://www.waahjobs.com/s/software-developer-jobs-in-mumbai/

使用 Selector Gadget Extension 选择的类:.r-95jzfe .css-1dbjc4n .r-1pn2ns4

项目数:15(也手动计数。)

Scrapy shell 输入:

scrapy shell "https://www.waahjobs.com/s/software-developer-jobs-in-mumbai/"

obj = response.css(".r-95jzfe .css-1dbjc4n .r-1pn2ns4") 打印(len(obj))

Scrapy shell 输出:10

预期输出:15

更新: 通过直接点击后端绕过了抓取数据的需要。将 curl 请求转换为 Scrapy 代码的有用链接 - https://michael-shub.github.io/curl2scrapy/

但即使使用了scrapy-splash,在某些网站上仍然存在问题。

我做了什么:

  1. 与飞溅集成的scrapy
  2. 开始使用 docker 在本地主机上启动
  3. 然后在 scrapy 终端上执行命令 fetch('http://localhost:8050/render.html?url=https://www.hirist.com/login')。

结果:视图(响应)在 chrome 上给出 404

预期:https://quotes.toscrape.com/ 有效但 https://www.hirist.com 无效。

As you can see in this image that splash is not able to load the page. HTML is also not readable. HTML Contains correct data though

请帮忙。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)