subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.38k stars 685 forks source link

[BUG] #983

Closed iXiaoxideYan closed 2 years ago

iXiaoxideYan commented 2 years ago

Describe the bug A clear and concise description of what the bug is. The interfaces for user_following and user_followers don't work anymore.

To Reproduce Provide a piece of code to reproduce the problem.

image

Traceback Show your full traceback so that it is clear where exactly the error occurred.

image

Expected behavior A clear and concise description of what you expected to happen. Expected to save all the pk values for the users.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

iXiaoxideYan commented 2 years ago

I have noticed that this bug appears after the I/O:

Status 429: Too many requests Ignore 429: Continue login

I don't know if this make any effect on that.

adw0rd commented 2 years ago

This Account is Private:

>>> cl.user_info(8492152853)
User(pk='8492152853', username='michel_chvlr', full_name='Michel Chevalier', is_private=True, ...

Works fine. Try this:

>>> cl.user_followers(29817608135, amount=10).keys()
dict_keys(['56680916876', '52517000315', '4922625042', '2356004145', '5900971838', '48859341867', '9986735673', '23146386', '1466128524', '1395918656'])

If you know a way to get a list of followers from a private account, then send me a PR

iXiaoxideYan commented 1 year ago

I want to add a new problem. Now, The function that get user follower works fine. But the function user_following didn't work as expected.

You can see the log, it always triggers the error login required.

Traceback (most recent call last): File "/Users/yanzhang/Projects/work/ins/ins/main.py", line 31, in user = User(login, username) File "/Users/yanzhang/Projects/work/ins/ins/models/user.py", line 17, in init self.user_profile = self.get_user_info(user_name, amount=50) if user_name is not None else UserProfile() File "/Users/yanzhang/Projects/work/ins/ins/models/user.py", line 72, in get_user_info user_pro.followings = self.get_following(user_pro.user_id, amount=amount) File "/Users/yanzhang/Projects/work/ins/ins/models/user.py", line 55, in get_following return list(self.cl.user_following(user_id).keys()) File "/Users/yanzhang/miniforge3/envs/myenv/lib/python3.8/site-packages/instagrapi/mixins/user.py", line 593, in user_following users = self.user_following_v1(user_id, amount) File "/Users/yanzhang/miniforge3/envs/myenv/lib/python3.8/site-packages/instagrapi/mixins/user.py", line 552, in user_following_v1 result = self.private_request(f"friendships/{user_id}/following/", params=params) File "/Users/yanzhang/miniforge3/envs/myenv/lib/python3.8/site-packages/instagrapi/mixins/private.py", line 447, in private_request raise e File "/Users/yanzhang/miniforge3/envs/myenv/lib/python3.8/site-packages/instagrapi/mixins/private.py", line 434, in private_request self._send_private_request(endpoint, kwargs) File "/Users/yanzhang/miniforge3/envs/myenv/lib/python3.8/site-packages/instagrapi/mixins/private.py", line 323, in _send_private_request raise LoginRequired(response=e.response, last_json) instagrapi.exceptions.LoginRequired: login_required

ivoidcat commented 1 year ago

I also encountered this problem

vasilywang commented 1 year ago

I encountered the same problem, I get login_required (403) error when I call user_following and user_followers

claell commented 1 year ago

For the additional problem, see #1050.