mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
11.4k stars 930 forks source link

Instagram 'stories' api change (i think) #4435

Closed BenderBRod closed 1 year ago

BenderBRod commented 1 year ago

I didnt use it for a couple days and today i always got error 500 for stories. Normal posts and reels still work.

PS E:\GitShit> gallery-dl.exe -o include=stories instagram.com/x
[instagram][error] HttpError: '500 Internal Server Error' for 'https://www.instagram.com/api/v1/feed/reels_media/'
PS E:\GitShit> gallery-dl.exe -o include=stories instagram.com/x --verbose
[gallery-dl][debug] Version 1.26.0-dev
[gallery-dl][debug] Python 3.10.11 - Windows-10-10.0.19045-SP0
[gallery-dl][debug] requests 2.28.2 - urllib3 1.26.15
[gallery-dl][debug] Configuration Files ['%APPDATA%\\gallery-dl\\config.json']
[gallery-dl][debug] Starting DownloadJob for 'instagram.com/x'
[instagram][debug] Using InstagramUserExtractor for 'instagram.com/x'
[instagram][debug] Using InstagramStoriesExtractor for 'https://www.instagram.com/stories/x/'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): www.instagram.com:443
[urllib3.connectionpool][debug] https://www.instagram.com:443 "GET /api/v1/users/web_profile_info/?username=x HTTP/1.1" 200 50488
[instagram][debug] Sleeping 9.13 seconds (request)
mikf commented 1 year ago

Still working for me. When browsing the site, it's still using /api/v1/feed/reels_media with reel_ids=USERID as parameter to retrieve stories according to my network monitor.

$ gallery-dl --sleep-request 0 -v  https://www.instagram.com/stories/norgejodel/
[gallery-dl][debug] Version 1.26.0-dev - Git HEAD: d34195b4
[gallery-dl][debug] Python 3.11.3 - Linux-6.4.3-arch1-2-x86_64-with-glibc2.37
[gallery-dl][debug] requests 2.31.0 - urllib3 2.0.3
[gallery-dl][debug] Configuration Files ['${HOME}/.gallery-dl.conf']
[gallery-dl][debug] Starting DownloadJob for 'https://www.instagram.com/stories/norgejodel/'
[instagram][debug] Using InstagramStoriesExtractor for 'https://www.instagram.com/stories/norgejodel/'
[instagram][debug] Loading cookies from '/home/mike/cookies-instagram-com.txt'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): www.instagram.com:443
[urllib3.connectionpool][debug] https://www.instagram.com:443 "GET /api/v1/users/web_profile_info/?username=norgejodel HTTP/1.1" 200 38254
[urllib3.connectionpool][debug] https://www.instagram.com:443 "GET /api/v1/feed/reels_media/?reel_ids=1414027512 HTTP/1.1" 200 12706
/tmp/_/instagram/norgejodel/3171994867172682147.mp4
/tmp/_/instagram/norgejodel/3172000827631028923.mp4
mikf commented 1 year ago

I think your cookies have become invalid and need to be renewed. I can reproduce this error by not providing any cookies and trying to download from a stories URL:

[instagram][debug] '500 Internal Server Error' for 'https://www.instagram.com/api/v1/feed/reels_media/' (1/5)

Normal posts and reels still work.

Those work without cookies for a while.

BenderBRod commented 1 year ago

Sorry for the very late response. Yes, i noticed my cookies were invalid after a very short time today. Did they change something in their bot detection? When i login to the website it also tells me they suspect my account is being used for botting.

The last time i used this was weeks ago so waiting wont deflag my account i think.