MCPcopy
hub / github.com/InstaPy/InstaPy / follow_commenters

Method follow_commenters

instapy/instapy.py:901–1019  ·  view source on GitHub ↗

Follows users' commenters

(
        self,
        usernames: list,
        amount: int = 10,
        daysold: int = 365,
        max_pic: int = 50,
        sleep_delay: int = 600,
        interact: bool = False,
    )

Source from the content-addressed store, hash-verified

899 )
900
901 def follow_commenters(
902 self,
903 usernames: list,
904 amount: int = 10,
905 daysold: int = 365,
906 max_pic: int = 50,
907 sleep_delay: int = 600,
908 interact: bool = False,
909 ):
910 """Follows users' commenters"""
911
912 if self.aborting:
913 return self
914
915 message = "Starting to follow commenters.."
916 highlight_print(self.username, message, "feature", "info", self.logger)
917
918 if not isinstance(usernames, list):
919 usernames = [usernames]
920
921 followed_all = 0
922 followed_new = 0
923
924 # hold the current global values for differentiating at the end
925 already_followed_init = self.already_followed
926 not_valid_users_init = self.not_valid_users
927 liked_init = self.liked_img
928 already_liked_init = self.already_liked
929 commented_init = self.commented
930 inap_img_init = self.inap_img
931
932 relax_point = random.randint(7, 14) # you can use some plain value
933 # `10` instead of this quietly randomized score
934 self.quotient_breach = False
935
936 for username in usernames:
937 if self.quotient_breach:
938 break
939
940 self.logger.info(
941 "Following commenters of '{}' from {} pictures in last {} "
942 "days...\nScrapping wall..".format(username, max_pic, daysold)
943 )
944 commenters = extract_information(
945 self.browser, username, daysold, max_pic, self.logger
946 )
947
948 if len(commenters) > 0:
949 self.logger.info("Going to follow top {} users.\n".format(amount))
950 sleep(1)
951 # This way of iterating will prevent sleep interference
952 # between functions
953 random.shuffle(commenters)
954 for commenter in commenters[:amount]:
955 if self.quotient_breach:
956 self.logger.warning(
957 "--> Follow quotient reached its peak!"
958 "\t~leaving Follow-Commenters activity\n"

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected