CodeZwei / shisho

Chrome Extension and Database for saving and recording metadata about hentai images.
MIT License
1 stars 0 forks source link

Image downloads fail on Pixiv #11

Open CodeZwei opened 1 year ago

CodeZwei commented 1 year ago

Pixiv is more restrictive on their access policies than the other providers.

Pixiv serves it's images from https://i.pximg.net/ and hosts it's post on https://www.pixiv.net/en/artworks

To fetch an image from their backend, the request needs to have a referer header set to www.pixiv.net/* or it will redirect to a .html file and fail with a 403 Forbidden Error.

However, directly fetching the image from the context of the content script on Pixiv still fails. This fetch does set the referer header, but also the origin. And that Origin fails CORS.

Other people have extensions which manage this, so there must be a way to do it.

For now, the Pixiv module extracts metadata, but does not save the image. I'll have to download it manually.

CodeZwei commented 1 year ago

Made some progress following the discussion here: https://stackoverflow.com/questions/20579112/send-referrer-header-with-chrome-downloads-api

However, this still ran into the CORS issue, which may not have been an issue in 2017.