MCPcopy
hub / github.com/InstaPy/InstaPy / get_given_user_followers

Function get_given_user_followers

instapy/unfollow_util.py:936–1025  ·  view source on GitHub ↗

For the given username, follow their followers. :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: randomly

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

Source from the content-addressed store, hash-verified

934
935
936def get_given_user_followers(
937 browser,
938 login,
939 user_name,
940 amount,
941 dont_include,
942 randomize,
943 blacklist,
944 follow_times,
945 simulation,
946 jumps,
947 logger,
948 logfolder,
949):
950 """
951 For the given username, follow their followers.
952
953 :param browser: webdriver instance
954 :param login:
955 :param user_name: given username of account to follow
956 :param amount: the number of followers to follow
957 :param dont_include: ignore these usernames
958 :param randomize: randomly select from users' followers
959 :param blacklist:
960 :param follow_times:
961 :param logger: the logger instance
962 :param logfolder: the logger folder
963 :return: list of user's followers also followed
964 """
965 user_name = user_name.strip().lower()
966
967 user_link = "https://www.instagram.com/{}/".format(user_name)
968 web_address_navigator(browser, user_link)
969
970 if not is_page_available(browser, logger):
971 return [], []
972
973 # check how many people are following this user.
974 allfollowers, _ = get_relationship_counts(browser, user_name, logger)
975
976 # skip early for no followers
977 if not allfollowers:
978 logger.info("'{}' has no followers".format(user_name))
979 return [], []
980
981 elif allfollowers < amount:
982 logger.warning(
983 "'{}' has less followers- {}, than the given amount of {}".format(
984 user_name, allfollowers, amount
985 )
986 )
987
988 # locate element to user's followers
989 try:
990 followers_link = browser.find_element(
991 By.XPATH, read_xpath(get_given_user_followers.__name__, "followers_link")
992 )
993 click_element(browser, followers_link)

Callers 2

follow_user_followersMethod · 0.85

Calls 7

web_address_navigatorFunction · 0.85
is_page_availableFunction · 0.85
get_relationship_countsFunction · 0.85
read_xpathFunction · 0.85
click_elementFunction · 0.85
update_activityFunction · 0.85

Tested by

no test coverage detected