【问题标题】:scrapy splash take screen shot of entire pagescrapy splash 截取整个页面的屏幕截图
【发布时间】:2020-06-02 13:27:05
【问题描述】:

如何修改参数以捕获整个页面

def start_requests(self):
    url =#some url
    splash_args = {
        'html': 1,
        'png': 1,
        'width': 600,
    }
    yield SplashRequest(url=url, callback=self.parse,
                        endpoint="render.json",
                        args=splash_args)
    def parse(self, response):
        imgdata = base64.b64decode(response.data['png'])
        filename = 'image.png'
        with open(filename, 'wb') as f:
            f.write(imgdata)

我尝试在 splash_args 中添加“高度”,图像确实得到了宽度*高度,但额外的高度为空白,有什么办法解决这个问题吗?

【问题讨论】:

    标签: scrapy scrapy-splash splash-js-render


    【解决方案1】:

    您可以通过在 Lua 脚本中添加以下行来捕获整个页面

    splash:set_viewport_full()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多