Instagram_Download_Button icon indicating copy to clipboard operation
Instagram_Download_Button copied to clipboard

Request blocked by CORS when trying to download anything

Open MaddoScientisto opened this issue 2 years ago • 2 comments

Version: 1.17.14 Tested browsers: Firefox developer edition 121.0.b4, firefox 115.5.0esr

When I try to download anything I get a CORS error mentioning headers, this doesn't happen on 1.17.10

Dowloading https://instagram.fflr3-1.fna.fbcdn.net/v/t51.2885-15/404312395_252102311209315_1603083148809262124_n.jpg?stp=dst-jpg_e35&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4xNDQweDE2NjUuc2RyIn0&_nc_ht=instagram.fflr3-1.fna.fbcdn.net&_nc_cat=107&_nc_ohc=4xpymMblX5kAX_qJYOI&edm=ALQROFkBAAAA&ccb=7-5&ig_cache_key=MzI0NTQzNzUxMDE5OTcyOTMwNg%3D%3D.2-ccb7-5&oh=00_AfCjQxXco2qckDPywh-qhEkUIDy_gGsFDdtXZzq114Ec1Q&oe=656BF10E&_nc_sid=fc8dfb [Instagram-Download-Button.user.js:704:17](moz-extension://62646158-6073-4760-9255-faf858be51c9/userscripts/Instagram-Download-Button.user.js?id=67ad556a-0dad-4a7e-966f-e3220395d047)
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://instagram.fflr3-1.fna.fbcdn.net/v/t51.2885-15/404312395_252102311209315_1603083148809262124_n.jpg?stp=dst-jpg_e35&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4xNDQweDE2NjUuc2RyIn0&_nc_ht=instagram.fflr3-1.fna.fbcdn.net&_nc_cat=107&_nc_ohc=4xpymMblX5kAX_qJYOI&edm=ALQROFkBAAAA&ccb=7-5&ig_cache_key=MzI0NTQzNzUxMDE5OTcyOTMwNg%3D%3D.2-ccb7-5&oh=00_AfCjQxXco2qckDPywh-qhEkUIDy_gGsFDdtXZzq114Ec1Q&oe=656BF10E&_nc_sid=fc8dfb. (Reason: header ‘user-agent’ is not allowed according to header ‘Access-Control-Allow-Headers’ from CORS preflight response).

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://instagram.fflr3-1.fna.fbcdn.net/v/t51.2885-15/404312395_252102311209315_1603083148809262124_n.jpg?stp=dst-jpg_e35&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4xNDQweDE2NjUuc2RyIn0&_nc_ht=instagram.fflr3-1.fna.fbcdn.net&_nc_cat=107&_nc_ohc=4xpymMblX5kAX_qJYOI&edm=ALQROFkBAAAA&ccb=7-5&ig_cache_key=MzI0NTQzNzUxMDE5OTcyOTMwNg%3D%3D.2-ccb7-5&oh=00_AfCjQxXco2qckDPywh-qhEkUIDy_gGsFDdtXZzq114Ec1Q&oe=656BF10E&_nc_sid=fc8dfb. (Reason: CORS request did not succeed). Status code: (null).

TypeError: NetworkError when attempting to fetch resource. [Instagram-Download-Button.user.js:726:33](moz-extension://62646158-6073-4760-9255-faf858be51c9/userscripts/Instagram-Download-Button.user.js?id=67ad556a-0dad-4a7e-966f-e3220395d047)
    downloadResource moz-extension://62646158-6073-4760-9255-faf858be51c9/userscripts/Instagram-Download-Button.user.js?id=67ad556a-0dad-4a7e-966f-e3220395d047:726

​

MaddoScientisto avatar Nov 29 '23 18:11 MaddoScientisto

When I saw the script wasn't working anymore and I saw this error on my console, telling about user-agent I changed this line

headers: new Headers({
                'User-Agent': window.navigator.userAgent,
                Origin: location.origin,
            }),

for this one headers: new Headers(),

I download only stories using this script, and now it's working for me, but I'm not sure if is enough to fully working. Trying to download from instagram.com it fails, but directly from the instagram profile, or stories it's working.

pootz10 avatar Dec 05 '23 20:12 pootz10

Ref #64 - this fix would also be fine.

Patty-OFurniture avatar Mar 04 '24 18:03 Patty-OFurniture