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

[BUG] Instagram may have changed their queryies format. Unable to perform public_graphql_request #2128

Open
andreadibartolo opened this issue Feb 19, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@andreadibartolo
Copy link

andreadibartolo commented Feb 19, 2025

Bug in public_graphql_request

I can't no more use methods like "username_from_user_id_gql" or "username_from_user_id". It seems to be a problem in the "public_graphql_request"

Traceback ("*" for privacy)

Traceback (most recent call last):
  File "D:\python\*******\prova_instagrapi.py", line 1104, in <module>
    usname = CL.username_from_user_id_gql("*****")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\andre\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\instagrapi\mixins\user.py", line 102, in username_from_user_id_gql
    return self.user_short_gql(user_id).username
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\andre\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\instagrapi\mixins\user.py", line 75, in user_short_gql
    data = self.public_graphql_request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\andre\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\instagrapi\mixins\public.py", line 278, in public_graphql_request
    return body_json["data"]
           ~~~~~~~~~^^^^^^^^
KeyError: 'data'

I edited public.py to write the received json from the function into a file and it looks like that:

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

Screenshots
json file:
Image

Desktop:

  • OS: Windows 11
  • Python version 3.11
  • instagrapi version 2.1.3
@andreadibartolo andreadibartolo added the bug Something isn't working label Feb 19, 2025
@dimavlade
Copy link

Same problem with body_json[“data”] when I authorize via sessionId. Temporarily switched to authorization via login:password

@kostyakoz
Copy link

Same error here. Is this lib is dead for now?

in public_graphql_request
    return body_json["data"]
           ~~~~~~~~~^^^^^^^^
KeyError: 'data'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants