users_left = pending_users_left[instagram.username] for i in range(len(users_left)): user = users_left.pop() link = instagram.create_link(user) need_follow = instagram.already_follow(link) try: if need_follow and config.LIKE_PHOTOS: photos = instagram.get_photos(link) like_comment_photos(instagram, utils, photos, user, config.COMMENT_PHOTOS) if photos and config.FOLLOW: instagram.follow(link) seconds = random.randint(45, 90) time.sleep(seconds) else: print(f"You already follow {user}") seconds = random.randint(5, 15) time.sleep(seconds) continue except KeyboardInterrupt: pending_users_left[instagram.username] = users_left save_users_left(instagram, utils, pending_users_left, config.USERS_LEFT_PATH) close(instagram)
twitter.like() except Exception as e: print(e) finally: # twitter.quit() random_sleep(300, 600) i += 1 else: instagram = Instagram() while True: keyword = KEYWORDS[random.randrange(len(KEYWORDS))] try: instagram.login() instagram.search(keyword) if args.follow: instagram.follow() if i % refresh_point == 0: instagram.refresh() else: if i % refresh_point == 0: instagram.like() instagram.follow() instagram.refresh() else: instagram.like() except Exception as e: print(e) finally: # instagram.quit() random_sleep(300, 600) i += 1