parser.add_argument('-users', type=str, nargs='?', help='a path to already notified users') parser.add_argument('-message', type=str, nargs='?', help='message text') args = parser.parse_args() bot = Bot() bot.login(username=args.u, password=args.p, proxy=args.proxy) # Use custom message from args if exist if args.message: MESSAGE = args.message # Check on existed file with notified users if not bot.check_if_file_exists(NOTIFIED_USERS_PATH): followers = bot.get_user_followers(bot.user_id) followers = map(str, followers) followers_string = '\n'.join(followers) with open(NOTIFIED_USERS_PATH, 'w') as users_file: users_file.write(followers_string) print('All followers saved in file {users_path}.\n' 'In a next time, for all new followers script will send messages.'. format(users_path=NOTIFIED_USERS_PATH)) exit(0) notified_users = bot.read_list_from_file(NOTIFIED_USERS_PATH) print('Read saved list of notified users. Count: {count}'.format( count=len(notified_users))) all_followers = bot.get_user_followers(bot.user_id) print('Amount of all followers is {count}'.format(count=len(all_followers)))
""" instabot example Reverts to checkpoint of your account - unfollows to old following """ import sys import os sys.path.append(os.path.join(sys.path[0], '../../')) from instabot import Bot if len(sys.argv) != 2: print("USAGE: Pass a path to the checkpoint.") print("Example: %s my_checkpoint" % sys.argv[0]) exit() bot = Bot() if not bot.check_if_file_exists(sys.argv[1]): exit() bot.login() bot.revert_to_checkpoint(sys.argv[1])