Likes (default) 50 images per given locations
(
self,
locations: list = None,
amount: int = 50,
media: str = None,
skip_top_posts: bool = True,
)
| 1704 | return self |
| 1705 | |
| 1706 | def comment_by_locations( |
| 1707 | self, |
| 1708 | locations: list = None, |
| 1709 | amount: int = 50, |
| 1710 | media: str = None, |
| 1711 | skip_top_posts: bool = True, |
| 1712 | ): |
| 1713 | """Likes (default) 50 images per given locations""" |
| 1714 | if self.aborting: |
| 1715 | return self |
| 1716 | |
| 1717 | commented = 0 |
| 1718 | followed = 0 |
| 1719 | inap_img = 0 |
| 1720 | not_valid_users = 0 |
| 1721 | msg = None |
| 1722 | location = None |
| 1723 | |
| 1724 | locations = locations or [] |
| 1725 | self.quotient_breach = False |
| 1726 | |
| 1727 | for index, location in enumerate(locations): |
| 1728 | if self.quotient_breach: |
| 1729 | break |
| 1730 | |
| 1731 | self.logger.info("Location [{}/{}]".format(index + 1, len(locations))) |
| 1732 | self.logger.info("--> {}".format(location.encode("utf-8"))) |
| 1733 | |
| 1734 | try: |
| 1735 | links = get_links_for_location( |
| 1736 | self.browser, location, amount, self.logger, media, skip_top_posts |
| 1737 | ) |
| 1738 | except NoSuchElementException: |
| 1739 | self.logger.warning("Too few images, skipping this location") |
| 1740 | continue |
| 1741 | |
| 1742 | for i, link in enumerate(links): |
| 1743 | if ( |
| 1744 | self.jumps["consequent"]["comments"] |
| 1745 | >= self.jumps["limit"]["comments"] |
| 1746 | ): |
| 1747 | self.logger.warning( |
| 1748 | "--> Comment quotient reached its peak!\t~leaving " |
| 1749 | "Comment-By-Locations activity\n" |
| 1750 | ) |
| 1751 | self.quotient_breach = True |
| 1752 | # reset jump counter after a breach report |
| 1753 | self.jumps["consequent"]["comments"] = 0 |
| 1754 | break |
| 1755 | |
| 1756 | self.logger.info("Comment# [{}/{}]".format(i + 1, len(links))) |
| 1757 | self.logger.info(link) |
| 1758 | |
| 1759 | try: |
| 1760 | inappropriate, user_name, is_video, reason, scope = check_link( |
| 1761 | self.browser, |
| 1762 | link, |
| 1763 | self.dont_like, |
nothing calls this directly
no test coverage detected