y252328 / Instagram_Download_Button

Add download button to download media in the post and the story in Instagram
MIT License
233 stars 32 forks source link

Downloading is not working on Firefox. #64

Open UnCrevard opened 7 months ago

UnCrevard commented 7 months ago

The fetch method to download file is not working for Firefox (cors problem most of the time).

A better way is to use the tampermonkey downloader. Simply add @grant GM_download to script headers then change the function downloadResource by GM_download(url,filename+".mp4")

GM_download is done with webext. So no cross-origin problem.

I have to fix the script at every update 😅

dinners5 commented 7 months ago

Thanks!

Add an if statment to sort between jpg and mp4..

if (url.contains("mp4")) { GM_download(url, filename+".mp4"); } else { GM_download(url, filename+".jpg"); }

DohnJoe2 commented 7 months ago

I managed to get it working in Firefox by commenting out the 732nd line in code. Before: 'User-Agent': window.navigator.userAgent After: // 'User-Agent': window.navigator.userAgent

pghadq716010i2ji8x3z9g9b4ot7

grant commented 7 months ago

Don't add me.

Patty-OFurniture commented 6 months ago

Confirmed. With CORS mode, at least Firefox seems to be like this. "User-agent header is only permitted for CORS when the server has opted in with "Access-Control-Allow-Headers: user-agent""

Haven't checked Chrome, but I would assume it's similar.