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

follow_users_from_file.py filter #961

Closed sxshateri closed 5 years ago

sxshateri commented 5 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:

Code:

# 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)

Error/Debug Log:

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

Describe your issue

does the follow_users_from_file.py checks the previously followed users (from followed.txt file) and filter them out then start following the rest of the users in the list automatically? if not then how can do that? i tried using it but seems it doesn't filter them out automatically and every time it gets to the already followed user will just show a notification that the user ID already exists in the followed.txt file after attempting to follow it.

thanks in advance

Oyetomi commented 5 years ago
from instabot import Bot

bot = Bot()
bot.login(username="user", password="pass")
followers = bot.get_user_followers(bot.user_id,filtration=False,)
sxshateri commented 5 years ago
from instabot import Bot

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

thanks for the reply but the code you provided will get a list of the followers. my point was if there is an internal functionality inside the Bot() that does it for me. will introducing the followed.txt as the backlist_file do the trick? something like this:

import argparse
import os
import sys

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

parser = argparse.ArgumentParser(add_help=True)
parser.add_argument('-u', type=str, help="username")
parser.add_argument('-p', type=str, help="password")
parser.add_argument('-proxy', type=str, help="proxy")
parser.add_argument('filepath', type=str, help='filepath')
args = parser.parse_args()

bot = Bot(filter_users=False, blacklist_file='followed.txt')
users_to_follow = bot.read_list_from_file(args.filepath)
if not users_to_follow:
    exit()
else:
    print("Found %d users in file." % len(users_to_follow))

bot.login(username=args.u, password=args.p,
          proxy=args.proxy)

bot.follow_users(users_to_follow)
sxshateri commented 5 years ago

i added the following code to the script: bot = Bot(filter_users=True, blacklist_file='followed.txt') and it indeed is skipping the user IDs from the "followed.txt" but also is skipping the private accounts and the business account which i need them also to be followed. tried to find how to not let it happen but didnt find anything in the documentation regarding this. any idea?

sxshateri commented 5 years ago

already figured out how to do it by adding the following in the script:

bot = Bot(filter_users=True, 
            followed_file='followed.txt', 
            min_media_count_to_follow=0, 
            filter_private_users=False, 
            max_following_to_follow=10000, 
            filter_users_without_profile_photo=False, 
            skipped_file='skipped.txt', 
            max_following_to_followers_ratio=20, 
            max_followers_to_follow=10000)

figured out the documentation is not complete or thorough thats why i could not find things like "filter_private_users" and "filter_users_without_profile_photo" . there are more functions and filters in this script that are not documented and guess that would confuse the not so professional users.