Instapy: [Question] Stop bot if action blocked

Created on 12 Jul 2019  路  5Comments  路  Source: timgrossmann/InstaPy

Hi,
if not available already, I would like to suggest implementing to stop the bot as soon as an action is blocked, like "like", "follow", etc.

I believe it would make sense to stop it and not to continue with actions, because they would be unsuccessful.

wontfix

Most helpful comment

A very dirty and quick solution until such feature is implemented:

go to instapy/ directory and open the file like_util.py

at beginning of the file (under import re) add
import sys

find and change this function:

def verify_liked_image(browser, logger):
    """Check for a ban on likes using the last liked image"""

    browser.refresh()
    unlike_xpath = read_xpath(like_image.__name__, "unlike")
    like_elem = browser.find_elements_by_xpath(unlike_xpath)

    if len(like_elem) == 1:
        return True
    else:
        logger.info('-------- WARNING! Image was NOT liked! You are have a BLOCK on likes!')
        sys.exit(0)          # <------------------- ADD THIS LINE
        return False

This is not a permanent solution, but it's better then keep trying to like while blocked.

All 5 comments

Yeah also . I think instapy should read the past logs and take action accordingly

yes its should be like that.

agreed

A very dirty and quick solution until such feature is implemented:

go to instapy/ directory and open the file like_util.py

at beginning of the file (under import re) add
import sys

find and change this function:

def verify_liked_image(browser, logger):
    """Check for a ban on likes using the last liked image"""

    browser.refresh()
    unlike_xpath = read_xpath(like_image.__name__, "unlike")
    like_elem = browser.find_elements_by_xpath(unlike_xpath)

    if len(like_elem) == 1:
        return True
    else:
        logger.info('-------- WARNING! Image was NOT liked! You are have a BLOCK on likes!')
        sys.exit(0)          # <------------------- ADD THIS LINE
        return False

This is not a permanent solution, but it's better then keep trying to like while blocked.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this problem still occurs, please open a new issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

n0sw34r picture n0sw34r  路  3Comments

drcyber975 picture drcyber975  路  3Comments

Naramsim picture Naramsim  路  3Comments

ghost picture ghost  路  3Comments

harrypython picture harrypython  路  3Comments