Instapy: Couldn't unfollow - user is inaccessible ** With Solution **

Created on 25 May 2020  路  7Comments  路  Source: timgrossmann/InstaPy

Users are getting this user inaccessible error including myself. I did the debugging and found that it's happening when the comment do is on :

Expected Behavior

After commenting, navigate the IG to post's screen

Current Behavior

IG comments on the post and stays at the same comment screen. Post it does the comment, code starts to valide the current Follow status of the user. Becuase it's not at the 'Post' or 'Profile', the status comes as UNAVAILABLE hence the error generates.

`elif following_status in ["Unblock", "UNAVAILABLE"]:
if following_status == "Unblock":
failure_msg = "user is in block"

        elif following_status == "UNAVAILABLE":
            failure_msg = "user is inaccessible"

        logger.warning(
            "--> Couldn't follow '{}'!\t~{}".format(user_name, failure_msg)`

Possible Solution (optional)

Under def get_following_status

`if person == username:
return "OWNER", None

if track == "profile":
    ig_homepage = "https://www.instagram.com/"
    web_address_navigator(browser, ig_homepage + person)`

--ADD NAVIGATION TO THE POST WHICH IS STORED IN var Link -----
follow_button_XP = read_xpath(get_following_status.__name__, "follow_button_XP")

InstaPy configuration

Tested and occurred on -
session.like_by_tags
session.set_do_comment(True, percentage=70)
session.set_comments(['com1'])

wontfix

Most helpful comment

Correct file name - comment_util.py
Function - comment image
After line number 103

sleep(2) Browser.back() Sleep(1) Browser.refresh()

All 7 comments

@timgrossmann I'm currently using browser.back() function post comment and it's working for now

def comment_image
at line 104 - Added browser.back()

Hi @mhdakhtar8,
In which file did you add the browser.back() function?

That would be the Instapy.py under scripts folder.

@mhdakhtar8
Python 3.8.2\Lib\site-packages\instapy\instapy.py:

L103         selenium_local_session: bool = True,
L104          browser_profile_path: str = None,
L105          page_delay: int = 25,
L106          show_logs: bool = True,

It is not possible to add that function here at line 104, do you mean another file?

Correct file name - comment_util.py
Function - comment image
After line number 103

sleep(2) Browser.back() Sleep(1) Browser.refresh()

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

If I understood it correctly, I should go to file comment_util.py and after line 103 add:

# wait, to avoid crash
sleep(2) 
browser.back() 
sleep(1) 
browser.refresh()

So at the end I end up having something like:

def comment_image(browser, username, comments, blacklist, logger, logfolder):
    ...

    # wait, to avoid crash
    sleep(2)
    # post comment / <enter>
    (
        ActionChains(browser)
        .move_to_element(comment_input[0])
        .send_keys(Keys.ENTER)
        .perform()
    )

    #聽addition
    sleep(2) 
    browser.back() 
    sleep(1) 
    browser.refresh()

    update_activity(
        browser,
        action="comments",
        state=None,
        logfolder=logfolder,
        logger=logger,
    )
...

This worked for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

n0sw34r picture n0sw34r  路  3Comments

ediooo picture ediooo  路  3Comments

v77v picture v77v  路  3Comments

ingorichter picture ingorichter  路  3Comments