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

Ultimate Schedule: INFO - Bot Stopped (Case 2) #577

Closed chadholman closed 6 years ago

chadholman commented 6 years ago

Please help with these random bot errors. Appears it was trying to run

schedule.every(1).days.at("6:40").do(follow_users_from_hastag_file)

2018-06-23 06:40:05,123 - INFO - Going to follow 77 users.:01<00:00,  1.25s/it]

Going to follow 77 users.

After filtering `followed.txt` and `skipped.txt`, 61 user_ids left to follow.

 ===> Going to follow `user_id`: 1199687440.            | 0/61 [00:00<?, ?it/s]
2018-06-23 06:40:09,720 - ERROR - Request returns 404 error!
2018-06-23 06:40:23,613 - ERROR - Request returns 404 error!
2018-06-23 06:42:10,979 - ERROR - Request returns 404 error!

`bot.following` is empty, will download.
                                                                              Traceback (most recent call last):
  File "kgultimate.py", line 54, in <module>                                   
    schedule.run_pending()
  File "/usr/local/lib/python3.6/site-packages/schedule/__init__.py", line 493, in run_pending
    default_scheduler.run_pending()
  File "/usr/local/lib/python3.6/site-packages/schedule/__init__.py", line 78, in run_pending
    self._run_job(job)
  File "/usr/local/lib/python3.6/site-packages/schedule/__init__.py", line 131, in _run_job
    ret = job.run()
  File "/usr/local/lib/python3.6/site-packages/schedule/__init__.py", line 411, in run
    ret = self.job_func()
  File "kgultimate.py", line 34, in follow_users_from_hastag_file
    bot.follow_users(bot.get_hashtag_users(random_hashtag_file.random()))
  File "/usr/local/lib/python3.6/site-packages/instabot/bot/bot.py", line 430, in follow_users
    return follow_users(self, user_ids)
  File "/usr/local/lib/python3.6/site-packages/instabot/bot/bot_follow.py", line 42, in follow_users
    if not self.follow(user_id):
  File "/usr/local/lib/python3.6/site-packages/instabot/bot/bot.py", line 427, in follow
    return follow(self, user_id)
  File "/usr/local/lib/python3.6/site-packages/instabot/bot/bot_follow.py", line 10, in follow
    if not self.check_user(user_id):
  File "/usr/local/lib/python3.6/site-packages/instabot/bot/bot.py", line 549, in check_user
    return check_user(self, user, filter_closed_acc, unfollowing)
  File "/usr/local/lib/python3.6/site-packages/instabot/bot/bot_filter.py", line 108, in check_user
    if user_id in self.following:
  File "/usr/local/lib/python3.6/site-packages/instabot/bot/bot.py", line 196, in following
    self._following = self.get_user_following(self.user_id)
  File "/usr/local/lib/python3.6/site-packages/instabot/bot/bot.py", line 336, in get_user_following
    return get_user_following(self, user_id, nfollows)
  File "/usr/local/lib/python3.6/site-packages/instabot/bot/bot_get.py", line 172, in get_user_following
    following = self.api.get_total_followings(user_id, nfollows)
  File "/usr/local/lib/python3.6/site-packages/instabot/api/api.py", line 600, in get_total_followings
    user_id, amount, 'followings')
  File "/usr/local/lib/python3.6/site-packages/instabot/api/api.py", line 571, in get_total_followers_or_followings
    get(user_id, next_max_id)
  File "/usr/local/lib/python3.6/site-packages/instabot/api/api.py", line 413, in get_user_followings
    return self.send_request(url)
  File "/usr/local/lib/python3.6/site-packages/instabot/api/api.py", line 171, in send_request
    self.last_json = json.loads(response.text)
  File "/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 355, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 74229 (char 74228)
2018-06-23 06:44:06,996 - INFO - Bot stopped. Worked: 6:43:37.442542
2018-06-23 06:44:06,996 - INFO - Total likes: 131
2018-06-23 06:44:06,996 - INFO - Total requests: 5436

-----

# -*- coding: utf-8 -*-

from glob import glob
import os
import sys
import threading
import time

sys.path.append(os.path.join(sys.path[0], '../../'))
import schedule
from instabot import Bot, utils

import config

bot = Bot(comments_file=config.COMMENTS_FILE,
          blacklist_file=config.BLACKLIST_FILE,
          whitelist_file=config.WHITELIST_FILE,
          friends_file=config.FRIENDS_FILE,
          filter_business_accounts=False)
bot.login()
bot.logger.info("ULTIMATE script. Safe to run 24/7!")

random_user_file = utils.file(config.USERS_FILE)
random_hashtag_file = utils.file(config.HASHTAGS_FILE)

def stats():
    bot.save_user_stats(bot.user_id)

def like_timeline():
    bot.like_timeline(amount=700 // 24)

def follow_users_from_hastag_file():
    bot.follow_users(bot.get_hashtag_users(random_hashtag_file.random()))

def unfollow_non_followers():
    bot.unfollow_non_followers(n_to_unfollows=config.NUMBER_OF_NON_FOLLOWERS_TO_UNFOLLOW)

schedule.every(9).minutes.do(stats)
schedule.every(5).minutes.do(like_timeline)
schedule.every(3).days.at("0:40").do(unfollow_non_followers)
schedule.every(1).days.at("6:40").do(follow_users_from_hastag_file)
schedule.every(3).days.at("12:40").do(unfollow_non_followers)
schedule.every(1).days.at("17:40").do(follow_users_from_hastag_file)

while True:
    schedule.run_pending()
    time.sleep(1)
basnijholt commented 6 years ago

Can you try #575?

basnijholt commented 6 years ago

Fixed by https://github.com/instagrambot/instabot/pull/575. Please make sure that you are really actually running the latest master before opening any new issues.