instagrapi icon indicating copy to clipboard operation
instagrapi copied to clipboard

[BUG] Status 201: JSONDecodeError in public_request (url=https://www.instagram.com/nike/?__a=1&__d=dis) >>>

Open tajbowness opened this issue 5 months ago • 17 comments

Curious if anyone else is receiving this message when making public requests, as it only begun occurring recently for me.

I've tested to make sure it wasn't an issue with my code by returning to an older version of my code and the issue persisted, so I'd like to know if this has started happening recently to anyone else.

Calling: result = cl.user_info_by_username("nike").dict() Returns:

Status 201: JSONDecodeError in public_request (url=https://www.instagram.com/nike/?__a=1&__d=dis) >>>
Status 201: JSONDecodeError in public_request (url=https://www.instagram.com/nike/?__a=1&__d=dis) >>>
Status 201: JSONDecodeError in public_request (url=https://www.instagram.com/nike/?__a=1&__d=dis) >>>

It does return the user info after calling so it really isn't any issue. I'd like to know if anyone could provide any insight? Thanks

tajbowness avatar Feb 13 '24 22:02 tajbowness

I also have this problem

Rus1IT avatar Feb 14 '24 06:02 Rus1IT

Yeah I get this as well.

oword avatar Feb 14 '24 08:02 oword

Same here. As I understand it something changed in the JSON returned by instagram pages, so the instagrapi function that uses them, has to be changed too. I think (and hope) this will be done shortly with next instagrapi update.

andreadibartolo avatar Feb 14 '24 11:02 andreadibartolo

That's weird that it doesn't send a 404 message back to the client. Because Instagram has patched this a few weeks ago but somehow this one got reverted but without data. That's interesting.

jfrenl avatar Feb 14 '24 17:02 jfrenl

Like to note for anyone with this issue, that as a result of this I swapped to making a private request instead for fetching user info:

user_info_dict = cl.user_info_by_username_v1(username).dict()

tajbowness avatar Feb 14 '24 21:02 tajbowness

Problem for me is that with the _v1 method, I get a 429 error every time. Not sure exactly, why (I think, I already tried waiting some time and this happens on the first request, already). But that's what happens for me. So at the moment, this is not usable for me.

claell avatar Mar 08 '24 10:03 claell

same

orazdow avatar Mar 08 '24 23:03 orazdow

same

florifull avatar Mar 31 '24 22:03 florifull

solved , check here https://github.com/subzeroid/instagrapi/pull/1868

SaeidB avatar Apr 09 '24 19:04 SaeidB

Problem for me is that with the _v1 method, I get a 429 error every time. Not sure exactly, why (I think, I already tried waiting some time and this happens on the first request, already). But that's what happens for me. So at the moment, this is not usable for me.

Weird, I haven't gotten that, is that still an issue? Do you think it could be related with login process ( setting headers / session info / etc)? Is that 429 prompted similar to the Status 201: JSONDecodeError just into the console without the instagrapi logger ? I'll try and look into it.

Also, subzeroid gave the same solution for this issue https://github.com/subzeroid/instagrapi/pull/1844#issuecomment-2018947707

tajbowness avatar Apr 10 '24 22:04 tajbowness

@tajbowness I get the error in the console, not sure, if it's also logged.

This might not be a problem of instagrapi. Not sure. Possibly, it is just that my account on Instagram is blocked, so only public requests work. But not sure, usually, also private requests should work, until it's throttled.

claell avatar Apr 11 '24 08:04 claell

@tajbowness I get the error in the console, not sure, if it's also logged.

This might not be a problem of instagrapi. Not sure. Possibly, it is just that my account on Instagram is blocked, so only public requests work. But not sure, usually, also private requests should work, until it's throttled.

@claell Have you tried this on another account to see if its not an issue with your account? If they happen on other accounts then perhaps its an issue with the login details? I've seen issues caused with using certain user agents. I've used just the default one and I believe it hasn't caused any issues. Same with the default device_settings.

"Instagram 318.0.0.30.110 Android (34/14.0.0; 480dpi; 1080x1920; OnePlus; 6T Dev; devitron; qcom; en_US; 314665256)"

Also have you tried doing it with a new sessionid

tajbowness avatar Apr 11 '24 22:04 tajbowness

I think it's not about your user, as I got that everytime when i do user_info on any user - get 3 information like:

Status 201: JSONDecodeError in public_request (url=https://www.instagram.com/an_na.xx/?__a=1&__d=dis) >>>
Status 201: JSONDecodeError in public_request (url=https://www.instagram.com/an_na.xx/?__a=1&__d=dis) >>>
Status 201: JSONDecodeError in public_request (url=https://www.instagram.com/an_na.xx/?__a=1&__d=dis) >>>

marek-knappe avatar Apr 30 '24 14:04 marek-knappe

It means you create something as response. So pretty much it's pretty useless. I suggest using graphql endpoints instead to retrieve data.

jfrenl avatar Apr 30 '24 14:04 jfrenl

I also have the same problem

ElissonRodrigues avatar Apr 30 '24 18:04 ElissonRodrigues

https://github.com/subzeroid/instagrapi/pull/1868

Fix for user info gql

SaeidB avatar Apr 30 '24 18:04 SaeidB

I didnt now ho to solve it what i need to add ?

dido2007 avatar May 09 '24 15:05 dido2007