Пример #1
0
 def job():
     ## Gets following count
     current_following_count = _get_following_count(device)
     ## added min_following and following_count to unfollow function
     unfollow(device, count - state.unfollowed_count, on_unfollow, storage,
              only_non_followers, session_state.my_username,
              current_following_count, min_following, unfollow_any)
     print("Unfollowed " + str(state.unfollowed_count) + ", finish.")
     state.is_job_completed = True
Пример #2
0
 def job():
     unfollow(device,
              new_count - state.unfollowed_count,
              on_unfollow,
              storage,
              unfollow_restriction,
              session_state.my_username)
     print("Unfollowed " + str(state.unfollowed_count) + ", finish.")
     state.is_job_completed = True
Пример #3
0
 def job():
     unfollow(device,
              count - state.unfollowed_count,
              on_unfollow,
              storage,
              only_non_followers,
              session_state.my_username)
     print("Unfollowed " + str(state.unfollowed_count) + ", finish.")
     state.is_job_completed = True
Пример #4
0
def _job_unfollow(device, count, storage, only_non_followers):
    class State:
        def __init__(self):
            pass

        unfollowed_count = 0

    state = State()
    session_state = sessions[-1]

    def on_unfollow():
        state.unfollowed_count += 1
        session_state.totalUnfollowed += 1

    completed = False
    while not completed and state.unfollowed_count < count:
        try:
            unfollow(device, count - state.unfollowed_count, on_unfollow,
                     storage, only_non_followers, session_state.my_username)
            print("Unfollowed " + str(state.unfollowed_count) + ", finish.")
            completed = True
        except KeyboardInterrupt:
            close_instagram(device_id)
            print_copyright(session_state.my_username)
            print_timeless(COLOR_WARNING + "-------- FINISH: " +
                           str(datetime.now().time()) + " --------" +
                           COLOR_ENDC)
            _print_report()
            sys.exit(0)
        except (uiautomator.JsonRPCError, IndexError, HTTPException, timeout):
            print(COLOR_FAIL + traceback.format_exc() + COLOR_ENDC)
            take_screenshot(device)
            print("Try unfollowing again, " +
                  str(count - state.unfollowed_count) + " users left")
            # Hack for the case when IGTV was accidentally opened
            close_instagram(device_id)
            random_sleep()
            open_instagram(device_id)
            get_my_username(device)
        except Exception as e:
            take_screenshot(device)
            close_instagram(device_id)
            _print_report()
            raise e