Skip to content

Can't seem to fetch followers and followees #2473

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

Open
santiberis opened this issue Jan 6, 2025 · 15 comments
Open

Can't seem to fetch followers and followees #2473

santiberis opened this issue Jan 6, 2025 · 15 comments
Labels
question Question stale Issue is inactive for a long time

Comments

@santiberis
Copy link

santiberis commented Jan 6, 2025

hi all, hope you are doing well. I am trying to fetch followers and followings but i directly get an error, i had installed latest instaloader with pip3 install instaloader, browsed through the issues posted here and saw version 4.13.2 does fix the problem, but it apparently does not. i haven't gotten any popups within this instagram account related to account issues. Please help, how to fix?

import instaloader

L = instaloader.Instaloader()

Log in to Instagram

username = "x"
password = "x"
L.login(username, password)

profile = instaloader.Profile.from_username(L.context, username)

followers = set([follower.username for follower in profile.get_followers()])
following = set([followee.username for followee in profile.get_followees()])

with open("followers.txt", "w") as f:
f.write("\n".join(followers))

Error:
python followers.py
JSON Query to graphql/query: 401 Unauthorized - "fail" status, message "Please wait a few minutes before you try again." when accessing https://www.instagram.com/graphql/query?query_hash=37479f2b8209594dde7facb0d904896a&variables=%7B%22id%22%3A%2239804319258%22%2C%22first%22%3A12%7D [retrying; skip with ^C]
JSON Query to graphql/query: 401 Unauthorized - "fail" status, message "Please wait a few minutes before you try again." when accessing https://www.instagram.com/graphql/query?query_hash=37479f2b8209594dde7facb0d904896a&variables=%7B%22id%22%3A%2239804319258%22%2C%22first%22%3A12%7D [retrying; skip with ^C]
Traceback (most recent call last):
File "/Users/santiagoberistain/.pyenv/versions/3.11.7/lib/python3.11/site-packages/instaloader/instaloadercontext.py", line 456, in get_json
raise ConnectionException(self._response_error(resp))
instaloader.exceptions.ConnectionException: 401 Unauthorized - "fail" status, message "Please wait a few minutes before you try again." when accessing https://www.instagram.com/graphql/query?query_hash=37479f2b8209594dde7facb0d904896a&variables=%7B%22id%22%3A%2239804319258%22%2C%22first%22%3A12%7D

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/santiagoberistain/.pyenv/versions/3.11.7/lib/python3.11/site-packages/instaloader/instaloadercontext.py", line 456, in get_json
raise ConnectionException(self._response_error(resp))
instaloader.exceptions.ConnectionException: 401 Unauthorized - "fail" status, message "Please wait a few minutes before you try again." when accessing https://www.instagram.com/graphql/query?query_hash=37479f2b8209594dde7facb0d904896a&variables=%7B%22id%22%3A%2239804319258%22%2C%22first%22%3A12%7D

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/santiagoberistain/.pyenv/versions/3.11.7/lib/python3.11/site-packages/instaloader/instaloadercontext.py", line 456, in get_json
raise ConnectionException(self._response_error(resp))
instaloader.exceptions.ConnectionException: 401 Unauthorized - "fail" status, message "Please wait a few minutes before you try again." when accessing https://www.instagram.com/graphql/query?query_hash=37479f2b8209594dde7facb0d904896a&variables=%7B%22id%22%3A%2239804319258%22%2C%22first%22%3A12%7D

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/santiagoberistain/followers.py", line 15, in
followers = set([follower.username for follower in profile.get_followers()])
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/santiagoberistain/.pyenv/versions/3.11.7/lib/python3.11/site-packages/instaloader/structures.py", line 1301, in get_followers
return NodeIterator(
^^^^^^^^^^^^^
File "/Users/santiagoberistain/.pyenv/versions/3.11.7/lib/python3.11/site-packages/instaloader/nodeiterator.py", line 100, in init
self._data = self._query()
^^^^^^^^^^^^^
File "/Users/santiagoberistain/.pyenv/versions/3.11.7/lib/python3.11/site-packages/instaloader/nodeiterator.py", line 109, in _query
return self._query_query_hash(self._query_hash, after)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/santiagoberistain/.pyenv/versions/3.11.7/lib/python3.11/site-packages/instaloader/nodeiterator.py", line 131, in _query_query_hash
self._context.graphql_query(
File "/Users/santiagoberistain/.pyenv/versions/3.11.7/lib/python3.11/site-packages/instaloader/instaloadercontext.py", line 511, in graphql_query
resp_json = self.get_json('graphql/query',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/santiagoberistain/.pyenv/versions/3.11.7/lib/python3.11/site-packages/instaloader/instaloadercontext.py", line 480, in get_json
return self.get_json(path=path, params=params, host=host, session=sess, _attempt=_attempt + 1,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/santiagoberistain/.pyenv/versions/3.11.7/lib/python3.11/site-packages/instaloader/instaloadercontext.py", line 480, in get_json
return self.get_json(path=path, params=params, host=host, session=sess, _attempt=_attempt + 1,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/santiagoberistain/.pyenv/versions/3.11.7/lib/python3.11/site-packages/instaloader/instaloadercontext.py", line 468, in get_json
raise ConnectionException(error_string) from err
instaloader.exceptions.ConnectionException: JSON Query to graphql/query: 401 Unauthorized - "fail" status, message "Please wait a few minutes before you try again." when accessing https://www.instagram.com/graphql/query?query_hash=37479f2b8209594dde7facb0d904896a&variables=%7B%22id%22%3A%2239804319258%22%2C%22first%22%3A12%7D
with open("following.txt", "w") as f:
f.write("\n".join(following))

print("Saved lists: 'followers.txt' and 'following.txt'")

@santiberis santiberis added the question Question label Jan 6, 2025
@mechalr8
Copy link

mechalr8 commented Jan 9, 2025

Facing the same issue

@HexagonWin
Copy link

Same issue, seems like instaloader is blocked.

1 similar comment
@42maojin
Copy link

Same issue, seems like instaloader is blocked.

@MosEisley34
Copy link

Yup, it is happening on all my accounts now.

Copy link

github-actions bot commented Feb 3, 2025

There has been no activity on this question for an extended period of time. This issue will be closed after further 14 days of inactivity.

@github-actions github-actions bot added the stale Issue is inactive for a long time label Feb 3, 2025
@Dystorian
Copy link

Same problem fix it duh

@github-actions github-actions bot removed the stale Issue is inactive for a long time label Feb 4, 2025
@NeemThatSearched
Copy link

Same from the begining

@AicheD
Copy link

AicheD commented Feb 13, 2025

same problem....

Copy link

github-actions bot commented Mar 7, 2025

There has been no activity on this question for an extended period of time. This issue will be closed after further 14 days of inactivity.

@github-actions github-actions bot added the stale Issue is inactive for a long time label Mar 7, 2025
@Dystorian
Copy link

Still a problem, you can't close it until it is solved 😭

@github-actions github-actions bot removed the stale Issue is inactive for a long time label Mar 8, 2025
Copy link

There has been no activity on this question for an extended period of time. This issue will be closed after further 14 days of inactivity.

@github-actions github-actions bot added the stale Issue is inactive for a long time label Mar 29, 2025
@Dystorian
Copy link

Solve the issue

@github-actions github-actions bot removed the stale Issue is inactive for a long time label Mar 30, 2025
Copy link

There has been no activity on this question for an extended period of time. This issue will be closed after further 14 days of inactivity.

@github-actions github-actions bot added the stale Issue is inactive for a long time label Apr 21, 2025
@Dystorian
Copy link

Solve the issue

@github-actions github-actions bot removed the stale Issue is inactive for a long time label Apr 22, 2025
Copy link

There has been no activity on this question for an extended period of time. This issue will be closed after further 14 days of inactivity.

@github-actions github-actions bot added the stale Issue is inactive for a long time label May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question stale Issue is inactive for a long time
Projects
None yet
Development

No branches or pull requests

8 participants