Splash 不会呈现页面的所有内容

Mat*_*mik 1 splash-screen scrapy-splash splash-js-render

我正在使用Splash v2.3.2 并且我正在尝试呈现一个页面,但它并没有呈现所有内容。它不会渲染图像或动态加载的内容。

我正在使用我的http://localhost:8050/脚本:

function main(splash)
  local url = splash.args.url
  assert(splash:go(url))
  assert(splash:wait(10))
  return {
    html = splash:html(),
    png = splash:png(),
    har = splash:har(),
  }
end
Run Code Online (Sandbox Code Playgroud)

这是浏览器渲染: 浏览器渲染

这是 Splash 渲染的屏幕截图: 飞溅渲染

我试图改变等待时间,也试图允许插件。这些都行不通。我假设动态加载的内容受到限制,但我不确定。任何帮助表示赞赏。

Mik*_*bov 5

问题在于 localStorage - 站点使用它,但默认情况下 Splash 使用私有模式,这会禁用 localStorage。要修复它,请禁用私有模式(请参阅此处)。这个脚本对我有用(Splash 3.0):

function main(splash)
  splash.private_mode_enabled = false
  local url = splash.args.url
  assert(splash:go(url))
  assert(splash:wait(10))
  return {
    html = splash:html(),
    png = splash:png(),
    har = splash:har(),
  }
end
Run Code Online (Sandbox Code Playgroud)

另见:http : //splash.readthedocs.io/en/stable/faq.html#website-is-not-rendered-correctly