instagrapi
instagrapi copied to clipboard
[BUG] Status 200: JSONDecodeError in public_request
After updating to 1.16.19 I get another error when trying to retrieve the user_id
cl = Client()
cl.load_settings('/home/python/ig_dump.json')
accounts=["account_1", "account_2", "account_3", "account_4", "account_5", "account_6.dev"]
for user in accounts:
user_id = cl.user_id_from_username(user)
after calling cl.user_id_from_username(user) I get
Status 200: JSONDecodeError in public_request (url=https://www.instagram.com/kaufland/?__a=1) >>> for (;;);{"__ar":1,"error":1357004,"errorSummary":"Sorry, something went wrong","errorDescription":"Please try closing and re-opening your browser window.","payload":null,"hsrp":{"hblp":{"consistency":{"rev":1005632855}}},"lid":"7105342318905812221"}
same here
same here
You can try using cl.user_info_by_username_v1(username).pk
After changing the code and running it, I retrieve the following error:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/private.py", line 298, in _send_private_request
response.raise_for_status()
File "/usr/lib/python3/dist-packages/requests/models.py", line 943, 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/users/kaufland/usernameinfo/
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/python/ig2rss.py", line 85, in <module>
rss()
File "/home/python/ig2rss.py", line 57, in rss
user_id = cl.user_info_by_username_v1(user).pk
File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/user.py", line 166, in user_info_by_username_v1
raise e
File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/user.py", line 160, in user_info_by_username_v1
result = self.private_request(f"users/{username}/usernameinfo/")
File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/private.py", line 445, in private_request
raise e
File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/private.py", line 432, in private_request
self._send_private_request(endpoint, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/private.py", line 354, in _send_private_request
raise UnknownError(**last_json)
instagrapi.exceptions.UnknownError: checkpoint_required
Since Im looping through several accounts, it's noteworhty, that the first try/account runs without any errors!
After a freh new login and dump_settings, it seems to be working. I'll keep an eye on it the next hours.
anyone knows how to pull ig user_id from its username? any query hash? ?__a=1 stopped to work correctly with start of this mont..
Within the last 20 hours only 4 of the 20 runs finished succesfull! 16 runs were aborted while trying to retrieve the user_id, but each time the first query to retrieve the user-id was succesful!
Error message:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/private.py", l ine 298, in _send_private_request
response.raise_for_status()
File "/usr/lib/python3/dist-packages/requests/models.py", line 943, in raise_f or_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://i. instagram.com/api/v1/users/kaufland/usernameinfo/
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/python/ig2rss.py", line 90, in <module>
rss()
File "/home/python/ig2rss.py", line 57, in rss
user_id = cl.user_info_by_username_v1(user).pk
File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/user.py", line 166, in user_info_by_username_v1
raise e
File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/user.py", line 160, in user_info_by_username_v1
result = self.private_request(f"users/{username}/usernameinfo/")
File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/private.py", l ine 445, in private_request
raise e
File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/private.py", l ine 432, in private_request
self._send_private_request(endpoint, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/instagrapi/mixins/private.py", l ine 354, in _send_private_request
raise UnknownError(**last_json)
instagrapi.exceptions.UnknownError: checkpoint_required
Same here. I have instagram bot in telegram and i get this error since 4 day's ago
I have my own playwright bot for automating instagram, from start of this month i have problem with endpoint to transfer username in to userid, also few of scripts getting blocked. Instagram started to use Trusted script API and it mess up everything, Just giving a hint where to start search. :)
anyone knows how to pull ig user_id from its username? any query hash? ?__a=1 stopped to work correctly with start of this mont..
?__a=1
is indeed working, but in an incognito window
You can try using
cl.user_info_by_username_v1(username).pk
I need hd profile link but with this method there is only low quality pic and hd profile is None.
I have my own playwright bot for automating instagram, from start of this month i have problem with endpoint to transfer username in to userid, also few of scripts getting blocked. Instagram started to use Trusted script API and it mess up everything, Just giving a hint where to start search. :)
Tnks♥️
After updating to 1.16.19 I get another error when trying to retrieve the user_id
cl = Client() cl.load_settings('/home/python/ig_dump.json') accounts=["account_1", "account_2", "account_3", "account_4", "account_5", "account_6.dev"] for user in accounts: user_id = cl.user_id_from_username(user)
after calling cl.user_id_from_username(user) I get
Status 200: JSONDecodeError in public_request (url=https://www.instagram.com/kaufland/?__a=1) >>> for (;;);{"__ar":1,"error":1357004,"errorSummary":"Sorry, something went wrong","errorDescription":"Please try closing and re-opening your browser window.","payload":null,"hsrp":{"hblp":{"consistency":{"rev":1005632855}}},"lid":"7105342318905812221"}
finally found a way
just go to line 166 in public.py and edit public_a1_request=>
def public_a1_request(self, endpoint, data=None, params=None, headers=None):
url = self.PUBLIC_API_URL + endpoint.lstrip("/")
if params:
params.update({"__a": 1,'__d':'dis'})
else:
params = {"__a": 1,'__d':'dis'}
@adw0rd