在Splash UI中使用Lua的自定义JS脚本

时间:2019-06-17 11:30:25

标签: web-scraping lua splash-screen scrapinghub splash-js-render

我试图在我的启动界面中执行以下Lua脚本

function main(splash, args)
  assert(splash:go(args.url))
  splash.set_viewport_full()
  assert(splash:wait(0.5))
  local title=splash:evaljs('document.title')

  return {
    html = splash:html(),
    png = splash.png(),
    har = splash:har(),
  }
end

URL:https://github.com/

我遇到以下错误

"EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive:

但是对于某些网址(例如scrapinghub.com),它工作正常。

任何人都可以告诉我如何解决它。

0 个答案:

没有答案