ping / instagram_private_api

A Python library to access Instagram's private API.
MIT License
2.95k stars 612 forks source link

user_followers method is not working #319

Closed pratik-dani closed 3 years ago

pratik-dani commented 3 years ago

Please follow the guide below


Before submitting an issue, make sure you have:

Which client are you using?


Describe the Bug/Error:

I am not able to get the list of followers using user_followers error is rank_token required. Even after using generate_uuid method and passing that as a rank_token (as mentioned in the doc string) it is showing error.


Paste the output of python -V here: Python 3.7.0

Code:


from instagram_private_api import Client, ClientCompatPatch

user_name = #ommitted
password = #ommitted

api = Client(user_name, password)
uuid = api.generate_uuid(True)

data = api.user_followers("hermes", uuid)

Error/Debug Log:

Error parsing error response: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):

  File "<ipython-input-133-51aa45e10e36>", line 1, in <module>
    hermse = api.user_followers("devil_danii", api.generate_uuid())

  File "D:\Projects\instagram\instagram_private_api\endpoints\friendships.py", line 65, in user_followers
    res = self._call_api(endpoint, query=query_params)

  File "D:\Projects\instagram\instagram_private_api\client.py", line 527, in _call_api
    ErrorHandler.process(e, error_response)

  File "D:\Projects\instagram\instagram_private_api\errors.py", line 135, in process
    raise ClientError(error_msg, http_error.code, error_response)

ClientError: Not Found
burachonak commented 3 years ago

Hi. hermes is user_name, but you need use user_id.

anuuzsoni commented 3 years ago

Hi. hermes is user_name, but you need use user_id.

plz provide an example

bbrewington commented 3 years ago

@anuuzsoni you can get the user_id with the username_info method - here's how I would modify your example above:

user_id = api.username_info('hermes')['user']['pk']
data = api.user_followers(user_id, uuid)