Python 刮痕飞溅导致504
我正试图从一家特殊酒店的网页上搜刮未来28天的价格。我怀疑我被封锁了,但我不太确定 我得到了一些结果,但不是全部。我甚至尝试过使用各种用户代理,下载延迟30秒,启用httpcahce等等 这是我的lua脚本Python 刮痕飞溅导致504,python,web-scraping,lua,scrapy,scrapy-splash,Python,Web Scraping,Lua,Scrapy,Scrapy Splash,我正试图从一家特殊酒店的网页上搜刮未来28天的价格。我怀疑我被封锁了,但我不太确定 我得到了一些结果,但不是全部。我甚至尝试过使用各种用户代理,下载延迟30秒,启用httpcahce等等 这是我的lua脚本 function main(splash, args) splash.private_mode_enabled = false splash.js_enabled = true splash.images_enabled = false
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。但是如果您想看到更多,完整的代码是:-)
当然希望你比我聪明(不过我想我已经知道答案了)。有时网络会阻止用户
ip
,尝试使用不同的代理服务器,因为它可以通过我的系统访问。嗯。我意识到这个项目可能不需要启动-只要延迟时间足够长。所以我把splash全部关掉了,然后所有的页面都被完美地刮掉了。我觉得有点奇怪。那么,我的Splash安装/脚本有什么问题?