ohld / igbot

🐙 Free scripts, bots and Python API wrapper. Get free followers with our auto like, auto follow and other scripts!
https://hikerapi.com/p/N2P6iqiM
Apache License 2.0
4.69k stars 1.47k forks source link

suddendly stopped to work follow_user_followers.py #593

Closed kintaro1981 closed 6 years ago

kintaro1981 commented 6 years ago

Before submitting an issue, make sure you have:

Purpose of your issue?


The following sections requests more details for particular types of issues, you can remove any section (the contents between the triple ---) not applicable to your issue.


For a bug report, you must include the Python version used, code that will reproduce the error, and the error log/traceback.

Paste the output of python -V here:

Python 2.7.13

Code:

follow_user_followers.py username
unfollow_non_followers.py

Error/Debug Log:

follow_user_followers.py username

Traceback (most recent call last):                                                                                                                                          
  File "/Users/xxx/Google Drive/xxx/Social Media/InstaBot/scripts/follow_user_followers.py", line 27, in <module>
    bot.follow_followers(username)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot.py", line 471, in follow_followers
    return follow_followers(self, user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot_follow.py", line 76, in follow_followers
    followers = self.get_user_followers(user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot.py", line 356, in get_user_followers
    return get_user_followers(self, user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot_get.py", line 181, in get_user_followers
    followers = self.api.get_total_followers(user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 610, in get_total_followers
    user_id, amount, 'followers')
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 585, in get_total_followers_or_followings
    get(user_id, next_max_id)
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 427, in get_user_followers
    return self.send_request(url)
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 171, in send_request
    self.last_json = json.loads(response.text)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 380, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Unterminated string starting at: line 1 column 30220 (char 30219)
2018-07-16 12:01:06,880 - INFO - Bot stopped. Worked: 0:00:11.363886
2018-07-16 12:01:06,881 - INFO - Total requests: 34004

unfollow_non_followers.py

 ===> Start unfollowing non-followers <===

`bot.following` is empty, will download.

`bot.followers` is empty, will download.
Traceback (most recent call last):                                                                                                                                          
  File "/Users/xxx/Google Drive/xxx/Social Media/InstaBot/scripts/unfollow_non_followers.py", line 25, in <module>
    bot.unfollow_non_followers()
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot.py", line 485, in unfollow_non_followers
    return unfollow_non_followers(self, n_to_unfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot_unfollow.py", line 48, in unfollow_non_followers
    non_followers = set(self.following) - set(self.followers) - self.friends_file.set
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot.py", line 213, in followers
    self._followers = self.get_user_followers(self.user_id)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot.py", line 356, in get_user_followers
    return get_user_followers(self, user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot_get.py", line 181, in get_user_followers
    followers = self.api.get_total_followers(user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 610, in get_total_followers
    user_id, amount, 'followers')
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 585, in get_total_followers_or_followings
    get(user_id, next_max_id)
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 427, in get_user_followers
    return self.send_request(url)
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 171, in send_request
    self.last_json = json.loads(response.text)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 380, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Expecting object: line 1 column 55822 (char 55821)
2018-07-16 12:03:36,123 - INFO - Bot stopped. Worked: 0:02:40.607539
2018-07-16 12:03:36,124 - INFO - Total requests: 34010

Describe your issue

The account I want to follow followers have 10k and the script stop after it loads 30/40%. It's suddenly started to do it.

I tried to run unfollow_non_followers.py and i stop immediatly.

kintaro1981 commented 6 years ago

I tried this fix and the issue changed to this:

Traceback (most recent call last):                                                                                                                                          
  File "/Users/xxx/Google Drive/xxx/Social Media/InstaBot/scripts/follow_user_followers.py", line 27, in <module>
    bot.follow_followers(username)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot.py", line 471, in follow_followers
    return follow_followers(self, user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot_follow.py", line 76, in follow_followers
    followers = self.get_user_followers(user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot.py", line 356, in get_user_followers
    return get_user_followers(self, user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot_get.py", line 181, in get_user_followers
    followers = self.api.get_total_followers(user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 613, in get_total_followers
    user_id, amount, 'followers')
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 588, in get_total_followers_or_followings
    get(user_id, next_max_id)
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 430, in get_user_followers
    return self.send_request(url)
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 174, in send_request
    except json.decoder.JSONDecodeError:
AttributeError: 'module' object has no attribute 'JSONDecodeError'
2018-07-16 12:12:44,301 - INFO - Bot stopped. Worked: 0:11:48.785699
2018-07-16 12:12:44,302 - INFO - Total requests: 34031
kintaro1981 commented 6 years ago

I solved with this: https://github.com/instagrambot/instabot/commit/9f9c054db0bcf6931a9a9a98815a8919e19ba6b4

kintaro1981 commented 6 years ago

and now follow_user_followers.py started to give this error:

Traceback (most recent call last):                                                                                                                                          
  File "/Users/xxx/Google Drive/xxx/Social Media/InstaBot/scripts/follow_user_followers.py", line 27, in <module>
    bot.follow_followers(username)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot.py", line 471, in follow_followers
    return follow_followers(self, user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot_follow.py", line 76, in follow_followers
    followers = self.get_user_followers(user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot.py", line 356, in get_user_followers
    return get_user_followers(self, user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot_get.py", line 181, in get_user_followers
    followers = self.api.get_total_followers(user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 613, in get_total_followers
    user_id, amount, 'followers')
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 588, in get_total_followers_or_followings
    get(user_id, next_max_id)
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 430, in get_user_followers
    return self.send_request(url)
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 174, in send_request
    except json.decoder.JSONDecodeError:
AttributeError: 'module' object has no attribute 'JSONDecodeError'
2018-07-19 20:48:32,946 - INFO - Bot stopped. Worked: 0:00:05.283279
2018-07-19 20:48:32,947 - INFO - Total requests: 35200
basnijholt commented 6 years ago

Use master where this is fixed.

kintaro1981 commented 6 years ago

@basnijholt I uninstalled with sudo pip uninstall -y instabot and reinstalled with sudo pip install -U instabot and now I have the original problem.

basnijholt commented 6 years ago

That's because you are not installing master

Do pip install https://github.com/instagrambot/instabot/archive/master.zip

kintaro1981 commented 6 years ago

I'm on macOS 10.13.2

I have done:

sudo pip uninstall -y instabot

then:

sudo pip install https://github.com/instagrambot/instabot/archive/master.zip

if I launch "follow_user_followers.py usernametofollowfollowers" I get this:

Traceback (most recent call last):                                                                                                                                          
  File "/Users/xxx/Google Drive/xxx/Social Media/InstaBot/scripts/follow_user_followers.py", line 27, in <module>
    bot.follow_followers(username)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot.py", line 472, in follow_followers
    return follow_followers(self, user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot_follow.py", line 76, in follow_followers
    followers = self.get_user_followers(user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot.py", line 357, in get_user_followers
    return get_user_followers(self, user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot_get.py", line 183, in get_user_followers
    followers = self.api.get_total_followers(user_id, nfollows)
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 613, in get_total_followers
    user_id, amount, 'followers')
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 588, in get_total_followers_or_followings
    get(user_id, next_max_id)
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 430, in get_user_followers
    return self.send_request(url)
  File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 174, in send_request
    except json.decoder.JSONDecodeError:
AttributeError: 'module' object has no attribute 'JSONDecodeError'
2018-07-20 21:54:33,990 - INFO - Bot stopped. Worked: 3:49:08.314985
2018-07-20 21:54:33,991 - INFO - Total requests: 35289
kintaro1981 commented 6 years ago

This is my out up uninstalling and installing instabot:

$ sudo -H pip uninstall -y instabot
Password:
Uninstalling instabot-0.4.2:
  Successfully uninstalled instabot-0.4.2
$ sudo -H pip install https://github.com/instagrambot/instabot/archive/master.zip
Collecting https://github.com/instagrambot/instabot/archive/master.zip
  Downloading https://github.com/instagrambot/instabot/archive/master.zip (665kB)
    100% |████████████████████████████████| 665kB 8.2MB/s 
Requirement already satisfied: tqdm in /usr/local/lib/python2.7/site-packages (from instabot==0.4.2) (4.23.1)
Requirement already satisfied: requests-toolbelt in /usr/local/lib/python2.7/site-packages (from instabot==0.4.2) (0.8.0)
Requirement already satisfied: requests in /usr/local/lib/python2.7/site-packages (from instabot==0.4.2) (2.18.4)
Requirement already satisfied: schedule in /usr/local/lib/python2.7/site-packages (from instabot==0.4.2) (0.5.0)
Requirement already satisfied: future in /usr/local/lib/python2.7/site-packages (from instabot==0.4.2) (0.16.0)
Requirement already satisfied: six in /usr/local/lib/python2.7/site-packages (from instabot==0.4.2) (1.11.0)
Requirement already satisfied: huepy in /usr/local/lib/python2.7/site-packages (from instabot==0.4.2) (0.9.8.1)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/site-packages (from requests->instabot==0.4.2) (2017.11.5)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/site-packages (from requests->instabot==0.4.2) (3.0.4)
Requirement already satisfied: idna<2.7,>=2.5 in /usr/local/lib/python2.7/site-packages (from requests->instabot==0.4.2) (2.6)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/lib/python2.7/site-packages (from requests->instabot==0.4.2) (1.22)
Building wheels for collected packages: instabot
  Running setup.py bdist_wheel for instabot ... done
  Stored in directory: /private/tmp/pip-ephem-wheel-cache-TPHmDR/wheels/6f/c5/96/f7e21f84f43f3d213247adb395ffa7418b85f913a06bec5a98
Successfully built instabot
Installing collected packages: instabot
Successfully installed instabot-0.4.2

and this is my actual apy.py: https://pastebin.com/Zgs0artZ

kintaro1981 commented 6 years ago

anyone can help please?

I add that I'm on macOS 10.13.2

kintaro1981 commented 6 years ago

I tried again right now and it's working... I don't know what to say. I'm a little confused.

kintaro1981 commented 6 years ago

and now started again with the AttributeError: 'module' object has no attribute 'JSONDecodeError'

basnijholt commented 6 years ago

Oh I know why that happens now. json.decoder.JSONDecodeError doesn't exist in Python 2 but does exist in Python 3.

basnijholt commented 6 years ago

I think I fixed it with https://github.com/instagrambot/instabot/commit/542a35d5ef510183999e5aa825d2f1a0b113a0f1.

Could you install the latest version from master and try it out?

kintaro1981 commented 6 years ago

it's seems solved now.

kintaro1981 commented 6 years ago

do you recommend to update to Python 3 anyway?

combatlobsang commented 5 years ago

Where I can put the 'username' inside the code of follow_user_followers.py?