scrapinghub / splash

Lightweight, scriptable browser as a service with an HTTP API
BSD 3-Clause "New" or "Revised" License
4.09k stars 513 forks source link

Downloading Files Excel or pdf from website results in Webkit error # 102 #893

Open abhishekdike opened 5 years ago

abhishekdike commented 5 years ago

I'm trying to download a file from a website, specifically an excel file by clicking a download/exportexcel button on the website, but it results in Webkit error # 102 .

I'm using simple LUA construct splash:evaljs('document.querySelector("[Some Selector]").click()')

Screenshot is attached DownloadPage-error

amitshekhawat1019 commented 4 years ago

Is there any update on this issue? I am also facing the same issue while downloading excel file by clicking on button.

abhishekdike commented 4 years ago

There is a workaround I just found out, it may not work in all cases, one can return response as a base64 encoded file, and then later decode into some other client like python and write bytes to a file, I was able to download a pdf with this, splas:http_get or post does not change the current page of splash browser, it simply returns the response

treat = require("treat") base64 = require("base64") . . local response = splash:http_get("url link to file") assert(splash:wait(30)) return treat.as_binary(base64.encode(response.body))