Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONDecodeError #49

Closed
parraml opened this issue Jan 2, 2021 · 19 comments
Closed

JSONDecodeError #49

parraml opened this issue Jan 2, 2021 · 19 comments

Comments

@parraml
Copy link

parraml commented Jan 2, 2021

Begin to unfollow users...
Traceback (most recent call last):
File "insta-unfollower.py", line 301, in
main()
File "insta-unfollower.py", line 290, in main
while unfollow(user) == False:
File "insta-unfollower.py", line 195, in unfollow
response = json.loads(response.text)
File "/usr/lib/python3.5/json/init.py", line 319, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

PLEASE HELP

@quadroli
Copy link

@parrabram i to was facing the exact same issue, but i found this repo worked for me

@parraml
Copy link
Author

parraml commented Jan 29, 2021

@parrabram i to enfrentaba exactamente el mismo problema, pero encontré que este repositorio funcionó para mí

thank you very much for the recommendation, I will check it out right now

@tuxity
Copy link
Owner

tuxity commented Feb 3, 2021

You can try again, I have some changes

@Zethrus
Copy link

Zethrus commented Feb 4, 2021

I'm getting this when using the script with both docker and non-docker Python 3.7.
Error below is from docker version:
Traceback (most recent call last): File "insta-unfollower.py", line 282, in <module> main() File "insta-unfollower.py", line 275, in main while unfollow(user) == False: File "insta-unfollower.py", line 190, in unfollow response = json.loads(response.text) File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/lib/python3.8/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)

@tuxity
Copy link
Owner

tuxity commented Feb 4, 2021

I can't reproduce.

Try to add print(response.text) at line 190 just before response = json.loads(response.text)

Be sure to empty cache folder, and update local git repository to latest version too

@Zethrus
Copy link

Zethrus commented Feb 4, 2021

print(response.text)

With that added before the response variables, here's the error: https://pastebin.com/LZBW14mG

@tuxity
Copy link
Owner

tuxity commented Feb 4, 2021

I think somehow you are not considered as logged in, did you remove files in cache directory ?

@Zethrus
Copy link

Zethrus commented Feb 4, 2021

I think somehow you are not considered as logged in, did you remove files in cache directory ?

Strange, all I did was clear the cache directory before running the script. If I wasn't considered logged in, then how would it unfollow some of the other accounts. For the first few it seems to work fine.

Would it have anything to do with the cache directory being located in the same directory as the cloned git repo? It's located under ~/insta-unfollower/cache

@gab1992
Copy link

gab1992 commented Feb 4, 2021

Python 3.8.6 same error

It also happens the same on the other repo https://github.com/ricardojoserf/instagram-followers-bot
with his program
Exact same error, happen after also 15 unfollowing

Must have to do with instagram blocking unfollowing after 15 unfollow

@tuxity
Copy link
Owner

tuxity commented Feb 4, 2021

Oh it's only doing after few unfollows ? I thought it was on the first.

Then yes, it must be some kind of limit. I will more tests this weekend.

@Zethrus
Copy link

Zethrus commented Feb 4, 2021

Oh it's only doing after few unfollows ? I thought it was on the first.

Then yes, it must be some kind of limit. I will more tests this weekend.

Is there any way I could edit the script to add a time to wait between each unfollow to possibly fix this?
I don't mind running the script in a screen session oon a server all day if thats the case.

@tuxity
Copy link
Owner

tuxity commented Feb 4, 2021

Your account is a new account ? When googling instangram unfollow limits I found this:

    15 unfollows day 1
    20 unfollows day 2
    25 unfollows day 3
    30 unfollows day 4
    35 unfollows day 5
    40 unfollows day 6
    45 unfollows day 7
… and so on until I reach 150 unfollows/day
    1 unfollows/hr day 1
    2 unfollows/hr day 2
    2-3 unfollows/hr day 3
    3 unfollows/hr day 4
    3-4 unfollows/hr day 5
    4 unfollows/hr day 6
    4-5 unfollows/hr day 7

… and so forth until I reach a maximum of 13 unfollows per hour

@Zethrus
Copy link

Zethrus commented Feb 4, 2021

Your account is a new account ? When googling instangram unfollow limits I found this:

Not new at all, 5+ years old. 2300+ following that I have to unfollow.

@gab1992
Copy link

gab1992 commented Feb 4, 2021

I ran it again, 17 unfollowed, and then the File "/usr/lib/python3.8/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) on last line.

Account not new either, I think I have it since 2 years ago.

Easy fix would be to kind of reload the program in case of failure, BUT when I reload it straight after I have the error straight away. So it would need a timer and a restart.
Edit : this time reloaded it straight away (after 10 unfollowed) and was able to unfollow 3. Still must be a limite but it's not precise...

@gab1992
Copy link

gab1992 commented Feb 4, 2021

Could the error come from account that are private and ask if you are sure you want to unfollow them ?

@netayamin
Copy link

netayamin commented Feb 19, 2021

the error comes up whenever a 429 response received and the message of this response is
"Please wait a few minutes before you try again."

I was able to partly solve this using the following code in the unfollow func:

 if response.status_code == 429 : 
        return False

and with this code added to the main func so it will now loop the function instead of throwing an error:

 if unfollow(user) == False : 
               print("trying to unfollow %s again in 1 min" %(user["username"]))
               sleep(60)
               unfollow(user)

and by increasing the wait time between each unfollow request I believe this error shouldn't appear at all

@R3test678
Copy link

R3test678 commented May 1, 2021

Not even getting to unfollow one user, getting error (python 3.8.5)

Traceback (most recent call last):
File "insta-unfollower.py", line 282, in
main()
File "insta-unfollower.py", line 275, in main
while unfollow(user) == False:
File "insta-unfollower.py", line 190, in unfollow
response = json.loads(response.text)
File "/usr/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

@tuxity tuxity mentioned this issue Aug 25, 2021
@tuxity
Copy link
Owner

tuxity commented Aug 25, 2021

Sorry for the mega late response, I will check this again. I will try to confirm @netayamin answer and implement the code if needed.

@tuxity tuxity closed this as completed in 74ca4af Aug 25, 2021
@tuxity
Copy link
Owner

tuxity commented Aug 25, 2021

I managed to get temp banned from Instagram by Following a lot of people in a short time.
I can confirm the fix @netayamin did is working well! Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants