Instapy: Suddenly Only Getting Private Accounts

Created on 20 Jul 2019  路  51Comments  路  Source: timgrossmann/InstaPy


Expected Behavior

To follow and interact

Current Behavior

All of someone's followers that instapy gets are private accounts. This started to happen just recently when the bot was working correctly. I think instagram changed something.

Possible Solution (optional)

Don't know anyone?

InstaPy configuration

Most helpful comment

All 51 comments

I experienced the same thing!

I have the same. I tried to erase cookies.pkl but it didn't help.
From session.interact_user_followers(['x'], amount=600, randomize=False) I can see the following sentence in the log: Grabbed 165 usernames from 'x's Followers to do interaction. all of them private accounts.

For me the same, tried a lot of times, changed list, only private accounts, for example it has grabbed just 259 account out of 1000.

same for me

same for me.

same

this issue also happens on instapy==0.5.4

same

same for me. Is there a way to mark somehow these private accounts or accounts that did not pass the filter and do not process them in next time ? Because I see that InstaPy is trying again and again same list of users. And most of them are private accounts or accounts with less than 10 posts. And in total it not followed any account at all. And it grabs not correct quantity of users from given account. usually less than it suppose to grabs

Anyone with a solution for this issue? Many Thanks!

Same :(
I tried deleting cookies, but no luck

Same issue. Deleted cookies, but didn't make a difference.

No its not the same problem like #4595. delete Cookies doesnt work and the problem is not the same. Theres no block, its just choose only private accounts for interacting.

Yea, I think so too. I had the block problem solved by deleting my cookies and trying it out after taking a break but this one seems to be like a completely different problem.

I have tried to use the bare-bones quickstart.py and the problem still persists, which would imply that it is NOT a problem with our config, but indeed that Instagram might have changed something. I wonder how the interaction users are "grabbed", the problem is clearly in that part of code.

inside quickstart.py in _session.follow_user_followers_ I have inserted an account with 600 followers, and in
_amount=600, randomize=False, interact=False_ I have inserted 600
but nothing it grabs only 122 private accounts

on line 2846 in instapy.py we grab the users to interact with and for some reason the method get_given_user_followers that actually grabs the users is defined in unfollow_util.py on line 1003. That is strange. A method that grabs the users to interact with is defined in the unfollow_util.py file that is responsible for unfollows.

So it looks like the problem has to be in get_users_through_dialog / dialog_username_extractor also in unfollow_util.py. Something else that is quite strange:

while (total_list < amount) and not abort:
        before_scroll = total_list
        for i in range(4):

Why is 4 hard-coded here.. There is so much hard-coding in there!

So it looks like the problem has to be in get_users_through_dialog / dialog_username_extractor also in unfollow_util.py. Something else that is quite strange:

while (total_list < amount) and not abort:
        before_scroll = total_list
        for i in range(4):

Why is 4 hard-coded here.. There is so much hard-coding in there!

did you find a solution?i had been having this same problem for days. it only picks private accounts

I could not get it to run from source on Mac, will try on Ubuntu later

I could not get it to run from source on Mac, will try on Ubuntu later

ok let me know, im so afraid that our days using instapy are over. im so desperate trying to find a solution. thank you for your time

don't think they are. as long as you can grab users from the browser / mobile app, I see no reason why you cannot from the code. It appears that Instagram changed something and we just need to refactor the code a bit. Not too familiar with this code, but shouldn't be a problem to find where it goes wrong.

don't think they are. as long as you can grab users from the browser / mobile app, I see no reason why you cannot from the code. It appears that Instagram changed something and we just need to refactor the code a bit. Not too familiar with this code, but shouldn't be a problem to find where it goes wrong.

you are right. i just hope this get fix quick. i dont want to have to use another bot. some people are saying that those that use api may work

From a brief look at it, does not appear it would help. Think it is mainly used to post photos from the computer instead of the mobile app.

now I think it is in get_buttons_from_dialog

now I think it is in get_buttons_from_dialog

let me guess the mouse have to be move or buttons click?

oh boi. I am bamboozled. It all looks right to me.

oh boi. I am bamboozled. It all looks right to me.

but still dont work right?

What I found out so far, might help someone else in debugging:

  1. get_buttons_from_dialog gets the right number of usernames, and the selector "text()='Follow'" is correct.I have not been able to verify whether the users are all private on this step (the follow button does not have an id and is one of three divs in the wrapper div that has a user id).

  2. I would break this (unfollow_util.py, dialog_username_extractor) up

                person_list.append(
                    person.find_element_by_xpath(
                        read_xpath(dialog_username_extractor.__name__, "person"))
                            .find_elements_by_tag_name("a")[1].text)

like so

                xpath = read_xpath(dialog_username_extractor.__name__, "person")
                element_by_xpath = person.find_element_by_xpath(xpath)
                elements_by_tag_name = element_by_xpath.find_elements_by_tag_name("a")[1].text
                person_list.append(elements_by_tag_name)

for easier debugging. If buttons here are same objects as in 1. then I think the number of levels here: "person":"../../../*" might be wrong. Since we want two levels up, not three?

changing to "person": "../../*" has no effect at all

Fixed it. Seems like Insta changed elements around. I will open a PR

Fixed it. Seems like Insta changed elements around. I will open a PR

oh man, you are a fcking god. thank you

Thank you, my dude! You are a god too!

Sorry, have I to replace

person_list.append(person.find_element_by_xpath(read_xpath(dialog_username_extractor.__name__,"person"))
                                    .find_elements_by_tag_name("a")[1].text)
             except IndexError:
               pass  # Element list is too short to have a [1] element

     return person_list

with your code?

 person_list.append(elements_by_tag_name)
             except IndexError:
                 logger.critical(f"PATH_NOT_FOUND_FOR_PERSON:{person}\nPERSON_TEXT:{person.text}\nXPATH:{xpath}")
                 logger.warn(f"PATH_NOT_FOUND_FOR_PERSON:{person}\nPERSON_TEXT:{person.text}\nXPATH:{xpath}")
                 pass  # Element list is too short to have a [1] element
             except Exception as e:
                 logger.critical(e)
                 logger.warn(e)

     return person_list

this (in instapy/unfollow_users.py. Once again, a weird place to have this in):

person_list.append(person.find_element_by_xpath(read_xpath(dialog_username_extractor.__name__,"person"))
.find_elements_by_tag_name("a")[1].text)

with:

xpath = read_xpath(dialog_username_extractor.__name__, "person")
element_by_xpath = person.find_element_by_xpath(xpath)
elements_by_tag_name = element_by_xpath.find_elements_by_tag_name("a")[0].text

person_list.append(elements_by_tag_name)

AND (in instapy/xpath_compile.py)

this:

"person":"../../../*"

to:

person":"../../*"

However, a note of caution, some users are not pulled and we pull ''. So still something ain't right (that Insta mark-up is weird. Might add another if condition, that if the user is '' then get the name at index [1]). But this at least pulls non-private users.

this:

person_list.append(person.find_element_by_xpath(read_xpath(dialog_username_extractor.__name__,"person"))
.find_elements_by_tag_name("a")[1].text)

with:

xpath = read_xpath(dialog_username_extractor.__name__, "person")
element_by_xpath = person.find_element_by_xpath(xpath)
elements_by_tag_name = element_by_xpath.find_elements_by_tag_name("a")[0].text

person_list.append(elements_by_tag_name)

AND (in instapy/xpath_compile.py)

this:

"person":"../../../*"

to:

person":"../../*"

However, a note of caution, some users are not pulled and we pull ''. So still something ain't right (that Insta mark-up is weird. Might add another if condition, that if the user is '' then get the name at index [1]). But this at least pulls non-private users.

the crazy part about all this is that i dont even do the follow or unfollow. im pulling these followers just to do likes/comments. so i dont know why i was just getting private people. anyways im just waiting to see if your fix worked. im running it now. i will let you know how it goes

this is just the unfortunate structure of the InstaPy project. It is a great lib, I love it. But it could definitely use some help with structuring it better.

Thank you @nazariyv and @fatahfattah , now with your fixes it works!

line 926

xpath = read_xpath(dialog_username_extractor.__name__, "person")
                element_by_xpath = person.find_element_by_xpath(xpath)
                elements_by_tag_name = element_by_xpath.find_elements_by_tag_name("a")[0].text

                if elements_by_tag_name == '':
                    elements_by_tag_name = element_by_xpath.find_elements_by_tag_name("a")[1].text

                person_list.append(elements_by_tag_name)
            except IndexError:
                logger.warn(f"PATH_NOT_FOUND_FOR_PERSON:{person}\nPERSON_TEXT:{person.text}\nXPATH:{xpath}")
                pass  # Element list is too short to have a [1] element
            except Exception as e:
                logger.warn(e)

_Followed 9 new users ~sleeping about 11.13 minutes_ :)

Thanks!! Works fine now!

the definition of your method probably expects a logger? if so, remove it.

should be fixed by the release of 1.5.6.

thank you @nazariyv all works!
but was banned from following again after 5 follows. but this is another issue ;)

I am currently working on this issue :) you use headless mode ?

@breuerfelix hey - are you currently working on the issue, where people get blocked from likefollowing? Even while using minuscule speeds (1 like per hour) AND they are not being blocked on any other medium (insta app, mobile browser, or even another browser on the same computer) at the same time? If yes - how can I help? :D

Same issue here, and no, not using headless mode

can you chat me in discord ? I got something ready which needs to be tested ! but I cant because I don't have a blocked account :D

sure, what is your discord? I am happy to use mine as guinea pig :P

should be fixed by the release of 1.5.6.

that's a long time to wait lol

@Tachenz you will find me under felixbreuer#9641 :))

haha damn ... I always do this version mistake :D

@breuerfelix sent you a request!

I am currently working on this issue :) you use headless mode ?

yes, headless. on unix server

Was this page helpful?
0 / 5 - 0 ratings