MCPcopy
hub / github.com/InstaPy/InstaPy / get_followers

Function get_followers

instapy/relationship_tools.py:26–323  ·  view source on GitHub ↗

Get entire list of followers using graphql queries.

(
    browser,
    self_username,
    username,
    grab,
    relationship_data,
    live_match,
    store_locally,
    logger,
    logfolder,
    verified_only=False,
)

Source from the content-addressed store, hash-verified

24
25
26def get_followers(
27 browser,
28 self_username,
29 username,
30 grab,
31 relationship_data,
32 live_match,
33 store_locally,
34 logger,
35 logfolder,
36 verified_only=False,
37):
38 """Get entire list of followers using graphql queries."""
39
40 # Variables
41 user_data = {}
42 variables = {}
43 all_followers = []
44 sc_rolled = 0
45 grab_notifier = False
46 local_read_failure = False
47 passed_time = "time loop"
48
49 if username not in relationship_data:
50 relationship_data.update({username: {"all_following": [], "all_followers": []}})
51
52 grab_info = (
53 'at "full" range' if grab == "full" else "at the range of {}".format(grab)
54 )
55 tense = (
56 "live"
57 if (live_match is True or not relationship_data[username]["all_followers"])
58 else "fresh"
59 )
60
61 logger.info(
62 "Retrieving {} `Followers` data of {} {}".format(tense, username, grab_info)
63 )
64
65 user_link = "https://www.instagram.com/{}/".format(username)
66 web_address_navigator(browser, user_link)
67
68 # Get followers count
69 followers_count, _ = get_relationship_counts(browser, username, logger)
70
71 if grab != "full" and grab > followers_count:
72 logger.info(
73 "You have requested higher amount than existing followers count "
74 " ~gonna grab all available"
75 )
76 grab = followers_count
77
78 # Check if user's account is private and we don't follow
79 following_status, _ = get_following_status(
80 browser, "profile", self_username, username, None, logger, logfolder
81 )
82
83 is_private = is_private_profile(browser, logger, following_status == "Following")

Callers 6

unfollowFunction · 0.85
grab_followersMethod · 0.85
get_unfollowersFunction · 0.85
get_nonfollowersFunction · 0.85
get_fansFunction · 0.85
get_mutual_followingFunction · 0.85

Calls 10

web_address_navigatorFunction · 0.85
get_relationship_countsFunction · 0.85
get_following_statusFunction · 0.85
is_private_profileFunction · 0.85
interruption_handlerFunction · 0.85
progress_trackerFunction · 0.85
truncate_floatFunction · 0.85
sleepFunction · 0.85
store_followers_dataFunction · 0.85
execute_scriptMethod · 0.80

Tested by

no test coverage detected