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] AttributeError - 'InstagramGraphqlAPI' object has no attribute 'item' #5920

Closed
glottisfaun0000 opened this issue Aug 1, 2024 · 8 comments
Labels

Comments

@glottisfaun0000
Copy link

Installation

pip install gallery-dl in venv on macOS, python via homebrew. Same behavior with a brew install gallery-dl installation

Logs

instagram: An unexpected error occurred: AttributeError - 'InstagramGraphqlAPI' object has no attribute 'item'. 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 "/Users/{USER}/.venv/lib/python3.11/site-packages/gallery_dl/job.py", line 150, in run
    for msg in extractor:
  File "/Users/{USER}/.venv/lib/python3.11/site-packages/gallery_dl/extractor/instagram.py", line 65, in items
    for post in self.posts():
  File "/Users/{USER}/.venv/lib/python3.11/site-packages/gallery_dl/extractor/instagram.py", line 978, in _pagination
    s = "" if self.item.endswith("s") else "s"
              ^^^^^^^^^
AttributeError: 'InstagramGraphqlAPI' object has no attribute 'item'

Guessing this is another underlying python issue, but happens in a virtual environment

@mikf mikf added the site:bug label Aug 1, 2024
@mikf
Copy link
Owner

mikf commented Aug 1, 2024

This is an error while reporting an error

elif not data["edges"]:
s = "" if self.item.endswith("s") else "s"
raise exception.StopExtraction(
"%s'%s posts are private", self.item, s)

and it only occurs for "api": "graphql", which doesn't appear to work anymore. All users are considered "private" since the API doesn't return any results anymore.

@glottisfaun0000
Copy link
Author

So Instagram extractor 100% requires login now?

@mikf
Copy link
Owner

mikf commented Aug 1, 2024

It should be possible to query the rest API a couple of times without login / cookies. At least it is for me with a residential IP.

@Hrxn
Copy link
Contributor

Hrxn commented Aug 1, 2024

So Instagram extractor 100% requires login now?

Yes, basically.

@fireattack
Copy link
Contributor

fireattack commented Aug 2, 2024

Instagram Web still uses graphql, but at a glance they look drastically different than what gallery-dl is/was using? Like, I don't see any requests with query_hash param and they all seem to be POST now.

Theoretically we can rewrite the GraphQL API interface; whether it's worth it or not is an entirely different story, of course.

Should we leave this issue open for that, or just consider it not planned?

@fireattack
Copy link
Contributor

fireattack commented Aug 5, 2024

Sorry for necroing again.

This seems can be trivially fixed by changing first parameter to 12:

def user_feed(self, user_id):
query_hash = "69cba40317214236af40e7efa697781d"
variables = {"id": user_id, "first": 50}
return self._pagination(query_hash, variables)

mikf added a commit that referenced this issue Aug 7, 2024
by reducing the number of requested posts from 50 to 24
#5920 (comment)
@mikf
Copy link
Owner

mikf commented Aug 7, 2024

This seems can be trivially fixed by changing first parameter to 12:

Thanks for the hint. 24 seems to work as well, at least for now. (ff4e53a)

Should we leave this issue open for that, or just consider it not planned?

I think we should open a new issue for figuring out how exactly this new GraphQL interface works.

@xibr
Copy link

xibr commented Oct 8, 2024

Maybe use doc_id instead of query_hash see

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

No branches or pull requests

5 participants