ricardojoserf / instagram-followers-bot

A bot for Instagram. You can follow users using a tag or in a specific location, unfollow those who dont follow-you-back, and follow-back those who follow you
486 stars 113 forks source link

Error - Super unfollow #12

Closed josepfm closed 4 years ago

josepfm commented 4 years ago

I've tried to run, but I got this error:

Traceback (most recent call last): File "main.py", line 157, in main() File "main.py", line 140, in main super_unfollow() File "main.py", line 94, in super_unfollow user_id = aux_funcs.get_id(i) File "/Users/josepfm/Desktop/instagram-followers-bot/aux_funcs.py", line 19, in get_id respJSON = response.json() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/requests/models.py", line 898, in json return complexjson.loads(self.text, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/Library/Frameworks/Python.framework/Versions/3.8/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)

ricardojoserf commented 4 years ago

Hi @jose46moreno !! I am using Python 3.8.2 in a Linux box and I am unable to replicate this error, probably this error arised because of a very continued use of the script or maybe there is a problem with the account. I would wait for some hours and try again, if the error persists please let me know :)

josepfm commented 4 years ago

It's weird because the mistake only happens to me with that command.

I have executed the follow command through a tag and it has been executed without problems.

Last week I executed the unfollow command and it didn't give any errors, so it's something new, but it keeps on playing.

Tell me how I can help you to make the possible solution easier, if any.

ricardojoserf commented 4 years ago

If you could add in line 89 these two new lines (before "for i in followings:"): print (followings) print (followers)

And right after "for i in followings:"this one new line: print (i)

And tell me what you see or send me a screenshot. I think maybe the "i" parameter is None for some reason, maybe because it does not retrieve the value of something. Or maybe it is an encoding problem

ricardojoserf commented 4 years ago

Could you solve it @jose46moreno ? :)

josepfm commented 4 years ago

Sorry for the delay in the message, I had some problems that prevented me from doing it.

I'm attaching in several screenshots the result of executing the instruction with the prints you indicated.

Captura de pantalla 2020-06-22 a las 14 05 50 Captura de pantalla 2020-06-22 a las 14 06 01 Captura de pantalla 2020-06-22 a las 14 06 18 Captura de pantalla 2020-06-22 a las 14 06 37
ricardojoserf commented 4 years ago

Ok xDD I think the error is in the line "respJSON = response.json()" in aux_funcs.py

Try and change the function get_id in aux_funcs.py to this one, which will help to show the real error:

def get_id(username): url = "https://www.instagram.com/web/search/topsearch/?context=blended&query="+username+"&rank_token=0.3953592318270893&count=1" response = requests.get(url) try: respJSON = response.json() user_id = str( respJSON['users'][0].get("user").get("pk") ) return user_id except: try: print(response.text) except: return "Unexpected error"

josepfm commented 4 years ago

Looks like that was, uh, super unfollow running smoothly.

Thank you very much!

ricardojoserf commented 4 years ago

You are welcome! :) I will close the issue now

josepfm commented 4 years ago

Sorry @ricardojoserf I think it still doesn't work.

Now the console doesn't return an error, but the unfollow doesn't run.

In the console it says that it is stopping following X user but when it is finished, I see that it is not like that.

I'm attaching a screenshot of what is now showing up in the terminal while it is running.

Captura de pantalla 2020-06-23 a las 13 52 50
ricardojoserf commented 4 years ago

Hi again @jose46moreno . I think you account may be too new and you can not do so many requests. Try to add a delay like this:

try: time.sleep(10) ##add this line respJSON = response.json()

Try with 10 seconds of delay, if it does not work try with 60 seconds, and if it does not work let me know here :)

josepfm commented 4 years ago

@ricardojoserf Sorry to keep bringing you bad news, but putting in both 10 and 60 seconds, the result is the same.

As soon as you run, it already shows the same thing I shared with you in the previous picture.

josepfm commented 4 years ago

@ricardojoserf could you see this?

ricardojoserf commented 4 years ago

Hi @jose46moreno . Sorry I am working a lot lately... Hopefully i will have time next weekend

josepfm commented 4 years ago

@ricardojoserf ok, don't worry!

Thanks!

ricardojoserf commented 4 years ago

Hi @josepfm, I am still unable to replicate the error, I am very sorry. If I find something related to this in the future or someone tells me this happens in more cases, I will reopen the issue. Sorry! :P

josepfm commented 4 years ago

Ok, thanks.