Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instagram: An unexpected error occurred: KeyError - 'data' (GRAPHQL) #7202

Open
glottisfaun0000 opened this issue Mar 18, 2025 · 2 comments
Open

Comments

@glottisfaun0000
Copy link

glottisfaun0000 commented Mar 18, 2025

Not sure if I should put this in this previous issue: #5920

Output for instagram.com account:

gallery-dl --verbose instagram.com/natgeo                                                                                                                                                          [10:20:39]
gallery-dl: Version 1.29.0-dev:2025.02.28 - Executable (dev/macos)
gallery-dl: Python 3.13.2 - macOS-15.3.2-arm64-arm-64bit-Mach-O
gallery-dl: requests 2.32.3 - urllib3 2.3.0
gallery-dl: Configuration Files ['${HOME}/.config/gallery-dl/config.json']
gallery-dl: Starting DownloadJob for 'instagram.com/natgeo'
instagram: Using InstagramUserExtractor for 'instagram.com/natgeo'
instagram: Using InstagramStoriesExtractor for 'https://www.instagram.com/stories/natgeo/'
urllib3.connectionpool: Starting new HTTPS connection (1): www.instagram.com:443
urllib3.connectionpool: https://www.instagram.com:443 "GET /api/v1/users/web_profile_info/?username=natgeo HTTP/1.1" 200 101024
instagram: Unsupported with GraphQL API
instagram: Using InstagramHighlightsExtractor for 'https://www.instagram.com/natgeo/highlights/'
instagram: Unsupported with GraphQL API
instagram: Using InstagramPostsExtractor for 'https://www.instagram.com/natgeo/posts/'
urllib3.connectionpool: https://www.instagram.com:443 "GET /graphql/query/?query_hash=69cba40317214236af40e7efa697781d&variables=%7B%22id%22%3A%22787132%22%2C%22first%22%3A24%2C%22after%22%3Anull%7D HTTP/1.1" 200 185
instagram: An unexpected error occurred: KeyError - 'data'. Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues .
instagram:
Traceback (most recent call last):
  File "gallery_dl/job.py", line 152, in run
  File "gallery_dl/extractor/instagram.py", line 70, in items
  File "gallery_dl/extractor/instagram.py", line 1014, in _pagination
  File "gallery_dl/extractor/instagram.py", line 1006, in _call
KeyError: 'data'

and for individual post:

gallery-dl --verbose https://www.instagram.com/p/DHRJABLydU9/                                                                                                                                      [10:23:05]
gallery-dl: Version 1.29.0-dev:2025.02.28 - Executable (dev/macos)
gallery-dl: Python 3.13.2 - macOS-15.3.2-arm64-arm-64bit-Mach-O
gallery-dl: requests 2.32.3 - urllib3 2.3.0
gallery-dl: Configuration Files ['${HOME}/.config/gallery-dl/config.json']
gallery-dl: Starting DownloadJob for 'https://www.instagram.com/p/DHRJABLydU9/'
instagram: Using InstagramPostExtractor for 'https://www.instagram.com/p/DHRJABLydU9/'
urllib3.connectionpool: Starting new HTTPS connection (1): www.instagram.com:443
urllib3.connectionpool: https://www.instagram.com:443 "GET /graphql/query/?query_hash=9f8827793ef34641b2fb195d4d41151c&variables=%7B%22shortcode%22%3A%22DHRJABLydU9%22%2C%22child_comment_count%22%3A3%2C%22fetch_comment_count%22%3A40%2C%22parent_comment_count%22%3A24%2C%22has_threaded_comments%22%3Atrue%7D HTTP/1.1" 401 119
instagram: HttpError: '401 Unauthorized' for 'https://www.instagram.com/graphql/query/?query_hash=9f8827793ef34641b2fb195d4d41151c&variables=%7B%22shortcode%22%3A%22DHRJABLydU9%22%2C%22child_comment_count%22%3A3%2C%22fetch_comment_count%22%3A40%2C%22parent_comment_count%22%3A24%2C%22has_threaded_comments%22%3Atrue%7D'
instagram:
Traceback (most recent call last):
  File "gallery_dl/job.py", line 152, in run
  File "gallery_dl/extractor/instagram.py", line 66, in items
  File "gallery_dl/extractor/instagram.py", line 692, in posts
  File "gallery_dl/extractor/instagram.py", line 964, in media
  File "gallery_dl/extractor/instagram.py", line 1006, in _call
  File "gallery_dl/extractor/instagram.py", line 121, in request
  File "gallery_dl/extractor/common.py", line 256, in request
gallery_dl.exception.HttpError: '401 Unauthorized' for 'https://www.instagram.com/graphql/query/?query_hash=9f8827793ef34641b2fb195d4d41151c&variables=%7B%22shortcode%22%3A%22DHRJABLydU9%22%2C%22child_comment_count%22%3A3%2C%22fetch_comment_count%22%3A40%2C%22parent_comment_count%22%3A24%2C%22has_threaded_comments%22%3Atrue%7D'

Is graphql working for anyone at this point?

edit: version was outdated but same output after updating

@gituzzer
Copy link

gituzzer commented Mar 20, 2025

I confirm the problem, I was using gallery-dl 1.29.1 , got the problem, updated to 1.29.2 , same thing.
In my case I download a few public profiles with no login. Last time I checked about 1 week ago it was ok.

CMD: gallery-dl --verbose -A 1 -c ./gallery-dl.conf https://www.instagram.com/PROFILE
where PROFILE = insta profile name obv.

OUTPUT:
[gallery-dl][debug] Starting DownloadJob for 'https://www.instagram.com/PROFILE '
[instagram][debug] Using InstagramUserExtractor for 'https://www.instagram.com/PROFILE '
[instagram][debug] Using InstagramPostsExtractor for 'https://www.instagram.com/PROFILE /posts/'
[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=PROFILE HTTP/1.1" 200 15
[instagram][error] An unexpected error occurred: KeyError - 'data'. Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues .
[instagram][debug]
Traceback (most recent call last):
File "/home/USER/.local/lib/python3.8/site-packages/gallery_dl/cache.py", line 32, in call
value = self.cache[key]
KeyError: 'PROFILE '

@mikf
Copy link
Owner

mikf commented Mar 23, 2025

The legacy GraphQL API endpoints seem to be entirely broken now.

When requesting 24 posts at once, I now get a "Try Again Later" error

{
  "message": "feedback_required",
  "spam": true,
  "feedback_title": "Try Again Later",
  "feedback_message": "We limit how often you can do certain things on Instagram to protect our community. Tell us if you think we made a mistake.",
  "feedback_url": "",
  "feedback_action": "report_problem",
  "feedback_appeal_label": "Let us know",
  "restriction_enrollment_data": "",
  "status": "fail"
}

With only 12, it reports "Incorrect Query":

{
  "errors": [
    {
      "message": "execution error",
      "code": 1675002,
      "summary": "Incorrect Query",
      "description": "The query provided was invalid.",
      "extensions": {},
      "severity": "CRITICAL"
    }
  ],
  "status": "ok"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants