Scrapy Splash结果为504

我正在尝试爬取特定酒店页面上未来28天内的费率。我怀疑自己被封锁了,但我不太确定。

我获得了一些结果,但不是全部。我甚至尝试了各种用户代理、30秒的下载延迟、启用了httpcahce等。

这是我的lua脚本

    function main(splash, args)
      splash.private_mode_enabled = false
      splash.js_enabled = true
      splash.images_enabled = false
      assert(splash:go(args.url))
      function wait_for(splash, condition)
        while not condition() do
            splash:wait(20.0)
      end
      end

      wait_for(splash, function()
        return splash:evaljs("document.querySelector('ul.availability-table-revamp') != null")
      end)

      assert(splash:wait(30.0))
      splash:set_viewport_full()
      return {
        html = splash:html(),
      }
    end

我爬取的页面在[这里][1]。

我怎么知道它确实是封锁了我?酒店页面上没有政策,但是引擎主页面上当然有...

当然,我还有更多的代码要展示,但我猜唯一可以解决这个问题的就是lua。但是如果你想看更多的话,完整的代码在这里 :-)

真希望你比我聪明(我猜我已经知道答案了)。

点赞
用户10832127
用户10832127

有时候网站会阻止用户的 IP,建议尝试使用不同的 代理服务器,因为它能够在我的系统中访问。

2019-01-04 16:47:01