MCPcopy
hub / github.com/InstaPy/InstaPy / get_given_user_following

Function get_given_user_following

instapy/unfollow_util.py:1028–1170  ·  view source on GitHub ↗

For the given username, follow who they follows. :param browser: webdriver instance :param login: :param user_name: given username of account to follow :param amount: the number of followers to follow :param dont_include: ignore these usernames :param randomize: randoml

(
    browser,
    login,
    user_name,
    amount,
    dont_include,
    randomize,
    blacklist,
    follow_times,
    simulation,
    jumps,
    logger,
    logfolder,
)

Source from the content-addressed store, hash-verified

1026
1027
1028def get_given_user_following(
1029 browser,
1030 login,
1031 user_name,
1032 amount,
1033 dont_include,
1034 randomize,
1035 blacklist,
1036 follow_times,
1037 simulation,
1038 jumps,
1039 logger,
1040 logfolder,
1041):
1042 """
1043 For the given username, follow who they follows.
1044
1045 :param browser: webdriver instance
1046 :param login:
1047 :param user_name: given username of account to follow
1048 :param amount: the number of followers to follow
1049 :param dont_include: ignore these usernames
1050 :param randomize: randomly select from users' followers
1051 :param blacklist:
1052 :param follow_times:
1053 :param logger: the logger instance
1054 :param logfolder: the logger folder
1055 :return: list of user's following
1056 """
1057 user_name = user_name.strip().lower()
1058
1059 user_link = "https://www.instagram.com/{}/".format(user_name)
1060 web_address_navigator(browser, user_link)
1061
1062 if not is_page_available(browser, logger):
1063 return [], []
1064
1065 # check how many people are following this user.
1066 # throw RuntimeWarning if we are 0 people following this user
1067 try:
1068 # allfollowing = format_number(
1069 # browser.find_element(By.XPATH, read_xpath(get_given_user_following.__name__,"all_following")).text)
1070 allfollowing = format_number(
1071 browser.find_element(
1072 By.XPATH, read_xpath(get_given_user_following.__name__, "all_following")
1073 ).text
1074 )
1075
1076 except NoSuchElementException:
1077 try:
1078 allfollowing = browser.execute_script(
1079 "return window.__additionalData[Object.keys(window.__additionalData)[0]].data."
1080 "graphql.user.edge_follow.count"
1081 )
1082
1083 except WebDriverException:
1084 try:
1085 browser.execute_script("location.reload()")

Callers 2

follow_user_followingMethod · 0.85

Calls 8

web_address_navigatorFunction · 0.85
is_page_availableFunction · 0.85
format_numberFunction · 0.85
read_xpathFunction · 0.85
update_activityFunction · 0.85
click_elementFunction · 0.85
execute_scriptMethod · 0.80

Tested by

no test coverage detected