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] Error getting user followers (user_followers_v1_chunk) #2107

Open
clackes opened this issue Jan 14, 2025 · 1 comment
Open

[BUG] Error getting user followers (user_followers_v1_chunk) #2107

clackes opened this issue Jan 14, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@clackes
Copy link

clackes commented Jan 14, 2025

after doing the login
def fetch_current_followers(self):
amount = self.client.user_info_by_username(self.username).follower_count
if amount > 999:
followers, max_id = self.client.user_followers_v1_chunk(user_id=str(self.client.user_id),max_amount= amount)
return [{"user_id": user.pk, "username": user.username, "user_ids": self.client.user_id} for user in followers]
else:
followers = self.client.user_followers_v1(user_id=str(self.client.user_id), amount=amount)
return [{"user_id": user.pk, "username": user.username, "user_ids": self.client.user_id} for user in followers]

It gives to me this error:

400 Client Error: Bad Request for url: https://i.instagram.com/api/v1/friendships/3431374560/followers/?max_id=&count=1015&rank_token=3431374560_4a347a22-222a-4544-b39d-6dbdffbf8afb&search_surface=follow_list_page&query=&enable_groups=true
Traceback (most recent call last):
File "E:\instagrampy-main\instagrampy-main\venv\Lib\site-packages\instagrapi\mixins\private.py", line 359, in _send_private_request
response.raise_for_status()
File "E:\instagrampy-main\instagrampy-main\venv\Lib\site-packages\requests\models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://i.instagram.com/api/v1/friendships/3431374560/followers/?max_id=&count=1015&rank_token=3431374560_4a347a22-222a-4544-b39d-6dbdffbf8afb&search_surface=follow_list_page&query=&enable_groups=true
Status 400: Empty response message. Maybe enabled Two-factor auth?
Traceback (most recent call last):
File "E:\instagrampy-main\instagrampy-main\venv\Lib\site-packages\instagrapi\mixins\private.py", line 359, in _send_private_request
response.raise_for_status()
File "E:\instagrampy-main\instagrampy-main\venv\Lib\site-packages\requests\models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://i.instagram.com/api/v1/friendships/3431374560/followers/?max_id=&count=1015&rank_token=3431374560_4a347a22-222a-4544-b39d-6dbdffbf8afb&search_surface=follow_list_page&query=&enable_groups=true

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "E:\instagrampy-main\instagrampy-main\main.py", line 80, in
tracker.update_users()
File "E:\instagrampy-main\instagrampy-main\main.py", line 61, in update_users
tracker.update_followers(self.db, user_id)
File "E:\instagrampy-main\instagrampy-main\main.py", line 39, in update_followers
current_followers = self.fetch_current_followers()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\instagrampy-main\instagrampy-main\main.py", line 32, in fetch_current_followers
followers, max_id = self.client.user_followers_v1_chunk(user_id=str(self.client.user_id),max_amount= amount)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\instagrampy-main\instagrampy-main\venv\Lib\site-packages\instagrapi\mixins\user.py", line 724, in user_followers_v1_chunk
result = self.private_request(
^^^^^^^^^^^^^^^^^^^^^
File "E:\instagrampy-main\instagrampy-main\venv\Lib\site-packages\instagrapi\mixins\private.py", line 541, in private_request
raise e
File "E:\instagrampy-main\instagrampy-main\venv\Lib\site-packages\instagrapi\mixins\private.py", line 526, in private_request
self._send_private_request(endpoint, **kwargs)
File "E:\instagrampy-main\instagrampy-main\venv\Lib\site-packages\instagrapi\mixins\private.py", line 455, in _send_private_request
raise ClientBadRequestError(e, response=e.response, **last_json)
instagrapi.exceptions.ClientBadRequestError: Unknown ({'message': '', 'response': <Response [400]>, 'status': 'fail'})

@clackes clackes added the bug Something isn't working label Jan 14, 2025
@JOHN-AMAO
Copy link

Did you find a workaround for this ?

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

2 participants