如何解决如何使用一些 lua 代码扩展 scrapy-splash 'render.html' 端点?
所以,我想在 endpoint='execute'
中使用 scrapy-splash,但在我的 Lua 额外代码中模仿 endpoint='render.html'
。但是我找不到应该如何完成的示例,以便将随请求发送的 Lua 代码与用于拦截带有所有参数的 HTML 的 Lua(我期望)相同。
有什么想法吗?
解决方法
据我所知,这不受支持,但我发现了这一点 https://github.com/scrapinghub/splash/blob/master/splash/tests/lua_modules/emulation.lua 脚本,模拟运行 render.html(和其他端点)的实际 Python 代码。
这(应该)允许(尽可能多地)模仿运行 render.html 的 python 代码,并且应该很容易用 lua/js 代码进行扩展。
注意:你要在 emulation.lua 的底部添加以下几行:
function main(splash)
return {
html = emulation.render_html(splash)
}
end
重要提示:您必须将 --disable-lua-sandbox 添加到启动 (docker) 命令行
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。