download-image icon indicating copy to clipboard operation
download-image copied to clipboard

Downloading Pixiv images doesn't work on Chromium

Open Erisa opened this issue 4 years ago • 3 comments

Downloading images from Pixiv doesn't work on Chromium-based browsers (Chrome, Edge, etc.) because of "No permission". Tested on Chrome Dev and Edge Dev image Likely has something to do with Pixiv requiring auth for image access, unclear if this can be worked around or not.

Pixiv works fine on Firefox.

Erisa avatar Mar 28 '20 18:03 Erisa

This now happens in Firefox as well :(

Erisa avatar Feb 12 '21 19:02 Erisa

You just need to add some headers to authenticate to pixiv. Here's the curl headers for that:

curl https://i.pximg.net/c/250x250_80_a2/img-master/img/2020/05/18/13/19/42/81659864_p0_square1200.jpg \
   	-H "Referer: https://www.pixiv.net/" \
       -H "Sec-Fetch-User: ?1" \

It's probably just checking to see if you're a bot, so don't abuse this.

Phles avatar Dec 09 '21 03:12 Phles

Thank you for the information!

The Referer header seemed to do the trick, it now works perfectly on Firefox.
Setting Sec-Fetch-User was apparently disallowed by the downloads extension API, but it seems it wasn't necessary (Maybe the browser is setting it already?)

On Chromium however, even setting Referer is too much for it, giving

Unchecked runtime.lastError: Unsafe request header name

Which as far as I can tell is because Chromium thinks I shouldn't be allowed to a modify that header here. Not sure what else to do there, unless Chromium changes its behaviour and allows it.

Erisa avatar Dec 09 '21 03:12 Erisa