MCPcopy Index your code
hub / github.com/InstaPy/InstaPy / follow_by_locations

Method follow_by_locations

instapy/instapy.py:4737–4846  ·  view source on GitHub ↗
(
        self,
        locations: list = [],
        amount: int = 50,
        media: str = None,
        skip_top_posts: bool = True,
    )

Source from the content-addressed store, hash-verified

4735 print("\n\n")
4736
4737 def follow_by_locations(
4738 self,
4739 locations: list = [],
4740 amount: int = 50,
4741 media: str = None,
4742 skip_top_posts: bool = True,
4743 ):
4744 if self.aborting:
4745 return self
4746
4747 inap_img = 0
4748 followed = 0
4749 not_valid_users = 0
4750
4751 locations = locations
4752 self.quotient_breach = False
4753
4754 for index, location in enumerate(locations):
4755 if self.quotient_breach:
4756 break
4757
4758 self.logger.info("Location [{}/{}]".format(index + 1, len(locations)))
4759 self.logger.info("--> {}".format(location.encode("utf-8")))
4760
4761 try:
4762 links = get_links_for_location(
4763 self.browser, location, amount, self.logger, media, skip_top_posts
4764 )
4765 except NoSuchElementException:
4766 self.logger.warning("Too few images, skipping this location")
4767 continue
4768
4769 for i, link in enumerate(links):
4770 if (
4771 self.jumps["consequent"]["follows"]
4772 >= self.jumps["limit"]["follows"]
4773 ):
4774 self.logger.warning(
4775 "--> Follow quotient reached its peak!"
4776 "\t~leaving Follow-By-Locations activity\n"
4777 )
4778 self.quotient_breach = True
4779 # reset jump counter after a breach report
4780 self.jumps["consequent"]["follows"] = 0
4781 break
4782
4783 self.logger.info("Follow# [{}/{}]".format(i + 1, len(links)))
4784 self.logger.info(link)
4785
4786 try:
4787 inappropriate, user_name, is_video, reason, scope = check_link(
4788 self.browser,
4789 link,
4790 self.dont_like,
4791 self.mandatory_words,
4792 self.mandatory_language,
4793 self.is_mandatory_character,
4794 self.mandatory_character,

Callers

nothing calls this directly

Calls 5

validate_user_callMethod · 0.95
get_links_for_locationFunction · 0.85
check_linkFunction · 0.85
web_address_navigatorFunction · 0.85
follow_userFunction · 0.85

Tested by

no test coverage detected