subzeroid / instagrapi

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

[BUG] Client.user_info results in `Status 404: Endpoint /v1/users/{user}/info/ does not exists` #859

Closed kaijif closed 2 years ago

kaijif commented 2 years ago

Describe the bug A clear and concise description of what the bug is. The /v1/users/{user}/info/ endpoint appears to be broken. To Reproduce Provide a piece of code to reproduce the problem. cl.user_info('someuser') Traceback Show your full traceback so that it is clear where exactly the error occurred.

Status 404: Endpoint /v1/users/{user}/info/ does not exists
Traceback (most recent call last):
  File "lib/python3.9/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/home/kaiji/anaconda3/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/home/kaiji/anaconda3/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/kaiji/anaconda3/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "lib/python3.9/site-packages/instagrapi/mixins/public.py", line 132, in _send_public_request
    self.last_public_json = response.json()
  File "lib/python3.9/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "lib/python3.9/site-packages/instagrapi/mixins/user.py", line 274, in user_info
    user = self.user_info_gql(user_id)  # retry
  File "lib/python3.9/site-packages/instagrapi/mixins/user.py", line 220, in user_info_gql
    self.username_from_user_id_gql(user_id)
  File "lib/python3.9/site-packages/instagrapi/mixins/user.py", line 100, in username_from_user_id_gql
    return self.user_short_gql(user_id).username
  File "lib/python3.9/site-packages/instagrapi/mixins/user.py", line 73, in user_short_gql
    data = self.public_graphql_request(
  File "lib/python3.9/site-packages/instagrapi/mixins/public.py", line 210, in public_graphql_request
    body_json = self.public_request(
  File "lib/python3.9/site-packages/instagrapi/mixins/public.py", line 76, in public_request
    raise e  # Stop retries
  File "lib/python3.9/site-packages/instagrapi/mixins/public.py", line 74, in public_request
    return self._send_public_request(url, **kwargs)
  File "lib/python3.9/site-packages/instagrapi/mixins/public.py", line 138, in _send_public_request
    raise ClientLoginRequired(e, response=response)
instagrapi.exceptions.ClientLoginRequired: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "lib/python3.9/site-packages/instagrapi/mixins/private.py", line 298, in _send_private_request
    response.raise_for_status()
  File "lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://i.instagram.com/api/v1/users/{user}/info/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "lib/python3.9/site-packages/instagrapi/mixins/user.py", line 241, in user_info_v1
    result = self.private_request(f"users/{user_id}/info/")
  File "lib/python3.9/site-packages/instagrapi/mixins/private.py", line 447, in private_request
    raise e
  File "lib/python3.9/site-packages/instagrapi/mixins/private.py", line 434, in private_request
    self._send_private_request(endpoint, **kwargs)
  File "lib/python3.9/site-packages/instagrapi/mixins/private.py", line 370, in _send_private_request
    raise ClientNotFoundError(e, response=e.response, **last_json)
instagrapi.exceptions.ClientNotFoundError: 404 Client Error: Not Found for url: https://i.instagram.com/api/v1/users/{user}/info/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "num_posts.py", line 14, in <module>
    posts += data_bot._cl.user_info(user).media_count
  File "lib/python3.9/site-packages/instagrapi/mixins/user.py", line 278, in user_info
    user = self.user_info_v1(user_id)
  File "lib/python3.9/site-packages/instagrapi/mixins/user.py", line 243, in user_info_v1
    raise UserNotFound(e, user_id=user_id, **self.last_json)
instagrapi.exceptions.UserNotFound: 404 Client Error: Not Found for url: https://i.instagram.com/api/v1/users/{user}/info/

Desktop (please complete the following information):

adw0rd commented 2 years ago

https://adw0rd.github.io/instagrapi/usage-guide/user.html read first