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.71k stars 1.47k forks source link

Ultimate Schedule Sits Idle After Login #451

Closed Drivium closed 6 years ago

Drivium commented 6 years ago

Please follow the guide below


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: Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Daddy>python -v

installing zipimport hook

import zipimport # builtin

installed zipimport hook

C:\PYTHON27\lib\site.pyc matches C:\PYTHON27\lib\site.py

import site # precompiled from C:\PYTHON27\lib\site.pyc

C:\PYTHON27\lib\os.pyc matches C:\PYTHON27\lib\os.py

import os # precompiled from C:\PYTHON27\lib\os.pyc import errno # builtin import nt # builtin

C:\PYTHON27\lib\ntpath.pyc matches C:\PYTHON27\lib\ntpath.py

import ntpath # precompiled from C:\PYTHON27\lib\ntpath.pyc

C:\PYTHON27\lib\stat.pyc matches C:\PYTHON27\lib\stat.py

import stat # precompiled from C:\PYTHON27\lib\stat.pyc

C:\PYTHON27\lib\genericpath.pyc matches C:\PYTHON27\lib\genericpath.py

import genericpath # precompiled from C:\PYTHON27\lib\genericpath.pyc

C:\PYTHON27\lib\warnings.pyc matches C:\PYTHON27\lib\warnings.py

import warnings # precompiled from C:\PYTHON27\lib\warnings.pyc

C:\PYTHON27\lib\linecache.pyc matches C:\PYTHON27\lib\linecache.py

import linecache # precompiled from C:\PYTHON27\lib\linecache.pyc

C:\PYTHON27\lib\types.pyc matches C:\PYTHON27\lib\types.py

import types # precompiled from C:\PYTHON27\lib\types.pyc

C:\PYTHON27\lib\UserDict.pyc matches C:\PYTHON27\lib\UserDict.py

import UserDict # precompiled from C:\PYTHON27\lib\UserDict.pyc

C:\PYTHON27\lib_abcoll.pyc matches C:\PYTHON27\lib_abcoll.py

import _abcoll # precompiled from C:\PYTHON27\lib_abcoll.pyc

C:\PYTHON27\lib\abc.pyc matches C:\PYTHON27\lib\abc.py

import abc # precompiled from C:\PYTHON27\lib\abc.pyc

C:\PYTHON27\lib_weakrefset.pyc matches C:\PYTHON27\lib_weakrefset.py

import _weakrefset # precompiled from C:\PYTHON27\lib_weakrefset.pyc import _weakref # builtin

C:\PYTHON27\lib\copy_reg.pyc matches C:\PYTHON27\lib\copy_reg.py

import copy_reg # precompiled from C:\PYTHON27\lib\copy_reg.pyc

C:\PYTHON27\lib\traceback.pyc matches C:\PYTHON27\lib\traceback.py

import traceback # precompiled from C:\PYTHON27\lib\traceback.pyc

C:\PYTHON27\lib\sysconfig.pyc matches C:\PYTHON27\lib\sysconfig.py

import sysconfig # precompiled from C:\PYTHON27\lib\sysconfig.pyc

C:\PYTHON27\lib\re.pyc matches C:\PYTHON27\lib\re.py

import re # precompiled from C:\PYTHON27\lib\re.pyc

C:\PYTHON27\lib\sre_compile.pyc matches C:\PYTHON27\lib\sre_compile.py

import sre_compile # precompiled from C:\PYTHON27\lib\sre_compile.pyc import _sre # builtin

C:\PYTHON27\lib\sre_parse.pyc matches C:\PYTHON27\lib\sre_parse.py

import sre_parse # precompiled from C:\PYTHON27\lib\sre_parse.pyc

C:\PYTHON27\lib\sre_constants.pyc matches C:\PYTHON27\lib\sre_constants.py

import sre_constants # precompiled from C:\PYTHON27\lib\sre_constants.pyc import _locale # builtin

C:\PYTHON27\lib\locale.pyc matches C:\PYTHON27\lib\locale.py

import locale # precompiled from C:\PYTHON27\lib\locale.pyc import encodings # directory C:\PYTHON27\lib\encodings

C:\PYTHON27\lib\encodings__init.pyc matches C:\PYTHON27\lib\encodings\ini

t.py import encodings # precompiled from C:\PYTHON27\lib\encodings\init__.pyc

C:\PYTHON27\lib\codecs.pyc matches C:\PYTHON27\lib\codecs.py

import codecs # precompiled from C:\PYTHON27\lib\codecs.pyc import _codecs # builtin

C:\PYTHON27\lib\encodings\aliases.pyc matches C:\PYTHON27\lib\encodings\aliase

s.py import encodings.aliases # precompiled from C:\PYTHON27\lib\encodings\aliases.py c import operator # builtin

C:\PYTHON27\lib\functools.pyc matches C:\PYTHON27\lib\functools.py

import functools # precompiled from C:\PYTHON27\lib\functools.pyc import _functools # builtin

C:\PYTHON27\lib\encodings\cp1252.pyc matches C:\PYTHON27\lib\encodings\cp1252.

py import encodings.cp1252 # precompiled from C:\PYTHON27\lib\encodings\cp1252.pyc

zipimport: found 64 names in C:\PYTHON27\lib\site-packages\instabot-0.3.5.2-py

2.7.egg Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (In tel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

============================================================== Code:

Using ultimate schedule as is

-- coding: utf-8 --

import schedule import time import sys import os import random import glob # ->added to make pics upload -> see job8 import threading # ->added to make multithreadening possible -> see fn run_threaded

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

import config

bot = Bot(comments_file=config.COMMENTS_FILE, blacklist=config.BLACKLIST_FILE, whitelist=config.WHITELIST_FILE) bot.login() bot.logger.info("ULTIMATE script. 24hours save")

random_user_file = bot.read_list_from_file(config.USERS_FILE) random_hashtag_file = bot.read_list_from_file(config.HASHTAGS_FILE) photo_captions = bot.read_list_from_file(config.PHOTO_CAPTIONS_FILE)

to get pics and autopost it

posted_pic_list = [] try: with open(config.POSTED_PICS_FILE, 'r') as f: posted_pic_list = f.read().splitlines() except Exception: posted_pic_list = []

Get the filenames of the photos in the path ->

pics = [os.path.basename(x) for x in glob.glob(config.PICS_PATH + "/*.jpg")] pics = sorted(pics)

Return a random value from a list, used in various jobs below

def get_random(from_list): _random = random.choice(from_list) return _random

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

def job1(): bot.like_hashtag(get_random(random_hashtag_file), amount=int(700 / 24))

def job2(): bot.like_timeline(amount=int(300 / 24))

def job3(): bot.like_followers(get_random(random_user_file), nlikes=3)

def job4(): bot.follow_followers(get_random(random_user_file), nfollows=config.NUMBER_OF_FOLLOWERS_TO_FOLLOW)

def job5(): bot.comment_medias(bot.get_timeline_medias())

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

def job7(): bot.follow_users(bot.get_hashtag_users(get_random(random_hashtag_file)))

def job8(): # Comment posts with an hashtag in HASHTAGS_FILE hashtag = get_random(random_hashtag_file) bot.logger.info("Commenting on hashtag: " + hashtag) bot.comment_hashtag(hashtag)

def job9(): # Automatically post a pic in 'pics' folder try: for pic in pics: if pic in posted_pic_list: continue

        caption = get_random(photo_captions)
        full_caption = caption + "\n" + config.FOLLOW_MESSAGE
        bot.logger.info("Uploading pic with caption: " + caption)
        bot.uploadPhoto(config.PICS_PATH + pic, caption=full_caption)
        if bot.LastResponse.status_code != 200:
            bot.logger.error("Something went wrong, read the following ->\n")
            bot.logger.error(bot.LastResponse)
            break

        if pic not in posted_pic_list:
            # After posting a pic, comment it with all the hashtags specified
            # In config.PICS_HASHTAGS
            posted_pic_list.append(pic)
            with open('pics.txt', 'a') as f:
                f.write(pic + "\n")
            bot.logger.info("Succesfully uploaded: " + pic)
            bot.logger.info("Commenting uploaded photo with hashtags...")
            medias = bot.get_your_medias()
            last_photo = medias[0]  # Get the last photo posted
            bot.comment(last_photo, config.PICS_HASHTAGS)
            break
except Exception as e:
    bot.logger.error("Couldn't upload pic")
    bot.logger.error(str(e))

def job10(): # put non followers on blacklist try: bot.logger.info("Creating non-followers list") followings = bot.get_user_following(bot.user_id) # getting following followers = bot.get_user_followers(bot.user_id) # getting followers friends_file = bot.read_list_from_file("friends.txt") # same whitelist (just user ids) nonfollowerslist = list((set(followings) - set(followers)) - set(friends_file)) with open(config.BLACKLIST_FILE, 'a') as file: # writing to the blacklist for user_id in nonfollowerslist: file.write(str(user_id) + "\n") bot.logger.info("Removing duplicates...") lines = open(config.BLACKLIST_FILE, 'r').readlines() lines_set = set(lines) out = open(config.BLACKLIST_FILE, 'w') for line in lines_set: out.write(line) bot.logger.info("Done.") except Exception as e: bot.logger.error("Couldn't update blacklist") bot.logger.error(str(e))

function to make threads -> details here http://bit.ly/faq_schedule

def run_threaded(job_fn): job_thread = threading.Thread(target=job_fn) job_thread.start()

schedule.every(1).hour.do(run_threaded, stats) # get stats schedule.every(8).hours.do(run_threaded, job1) # like hashtag schedule.every(2).hours.do(run_threaded, job2) # like timeline schedule.every(1).days.at("16:00").do(run_threaded, job3) # like followers of users from file schedule.every(2).days.at("11:00").do(run_threaded, job4) # follow followers schedule.every(16).hours.do(run_threaded, job5) # comment medias schedule.every(1).days.at("08:00").do(run_threaded, job6) # unfollow non-followers schedule.every(12).hours.do(run_threaded, job7) # follow users from hashtag from file schedule.every(6).hours.do(run_threaded, job8) # comment hashtag schedule.every(1).days.at("21:28").do(run_threaded, job9) # upload pics schedule.every(4).days.at("07:50").do(run_threaded, job10) # non-followers blacklist

while True: schedule.run_pending() time.sleep(1)

==============================================================

# Example code that will produce the error reported
from instabot import Bot

bot = Bot()
bot.login(username="user", password="pass")
followers = bot.get_user_followers(bot.user_id)

Using ultimate schedule as is

============================================================== Error/Debug Log: 2018-02-17 20:35:10,947 Instabot Started 2018-02-17 20:35:27,956 Starting new HTTPS connection (1): i.instagram.com 2018-02-17 20:35:28,698 Resetting dropped connection: i.instagram.com 2018-02-17 20:35:29,841 Login success as ** 2018-02-17 20:35:29,842 Resetting dropped connection: i.instagram.com 2018-02-17 20:35:31,032 Resetting dropped connection: i.instagram.com 2018-02-17 20:35:32,167 ULTIMATE script. 24hours save 2018-02-17 20:36:11,743 Resetting dropped connection: i.instagram.com 2018-02-17 20:36:12,385 Bot stopped. Worked: 0:01:01.508000 2018-02-17 20:36:12,387 Total requests: 5

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero

==============================================================

Describe your issue

Explanation of your issue goes here. Please make sure the description is worded well enough to be understood with as much context and examples as possible.

Running the ultimate schedule ( \examples\ultimate_schedule\ultimate.py) appears to perform no actions other than logging in. However, running the non-schedule ultimate works fine (examples\ultimate\ultimate.py). I ran the schedule installer as per the recommendation on another thread, but it's still behaving this way. Any idea what I'm doing wrong?

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.