MCPcopy
hub / github.com/InstaPy/InstaPy / follow_likers

Method follow_likers

instapy/instapy.py:1021–1144  ·  view source on GitHub ↗

Follows users' likers

(
        self,
        usernames: list,
        photos_grab_amount: int = 3,
        follow_likers_per_photo: int = 3,
        randomize: bool = True,
        sleep_delay: int = 600,
        interact: bool = False,
    )

Source from the content-addressed store, hash-verified

1019 return self
1020
1021 def follow_likers(
1022 self,
1023 usernames: list,
1024 photos_grab_amount: int = 3,
1025 follow_likers_per_photo: int = 3,
1026 randomize: bool = True,
1027 sleep_delay: int = 600,
1028 interact: bool = False,
1029 ):
1030 """Follows users' likers"""
1031 if self.aborting:
1032 return self
1033
1034 message = "Starting to follow likers.."
1035 highlight_print(self.username, message, "feature", "info", self.logger)
1036
1037 if not isinstance(usernames, list):
1038 usernames = [usernames]
1039
1040 if photos_grab_amount > 12:
1041 self.logger.info(
1042 "Sorry, you can only grab likers from first 12 photos for "
1043 "given username now.\n"
1044 )
1045 photos_grab_amount = 12
1046
1047 followed_all = 0
1048 followed_new = 0
1049
1050 # hold the current global values for differentiating at the end
1051 already_followed_init = self.already_followed
1052 not_valid_users_init = self.not_valid_users
1053 liked_init = self.liked_img
1054 already_liked_init = self.already_liked
1055 commented_init = self.commented
1056 inap_img_init = self.inap_img
1057
1058 relax_point = random.randint(7, 14) # you can use some plain value
1059 # `10` instead of this quitely randomized score
1060 self.quotient_breach = False
1061
1062 for username in usernames:
1063 if self.quotient_breach:
1064 break
1065
1066 photo_urls = get_photo_urls_from_profile(
1067 self.browser, username, photos_grab_amount, randomize, self.logger
1068 )
1069 sleep(1)
1070 if not isinstance(photo_urls, list):
1071 photo_urls = [photo_urls]
1072
1073 for photo_url in photo_urls:
1074 if self.quotient_breach:
1075 break
1076
1077 likers = users_liked(
1078 self.browser, photo_url, follow_likers_per_photo, self.logger

Callers

nothing calls this directly

Calls 7

feature_in_featureMethod · 0.95
follow_by_listMethod · 0.95
highlight_printFunction · 0.85
sleepFunction · 0.85
users_likedFunction · 0.85
truncate_floatFunction · 0.85

Tested by

no test coverage detected