mifi / SimpleInstaBot

Simple Instagram bot GUI
MIT License
607 stars 87 forks source link

Bot does not detect beeing blocked #28

Open nocomment-bln opened 3 years ago

nocomment-bln commented 3 years ago

Hi Mikael,

I just noticed that the bot does not detect if you are blocked by instagram.

The Bot continues unfollowing but without any effect.

image

nocomment-bln commented 3 years ago

I logged me out manually and started the bot again. now instagram is letting the bot unfollow profiles...

any idea how we can fix this ?

does anyboy else has the problem ?

mifi commented 3 years ago

Hi. are you running newest version?

nocomment-bln commented 3 years ago

Yes I do

mifi commented 3 years ago

that's odd.there is a check for this message in the code after unfollowing. are you not seeing any Action Blocked, waiting X hours... in the log? Does the bot continue to go on to other accounts and continue unfollowing other accounts like normal?

nocomment-bln commented 3 years ago

"are you not seeing any Action Blocked, waiting X hours... in the log?" No nothing.

Does the bot continue to go on to other accounts and continue unfollowing other accounts like normal? yes the bot continues running

nocomment-bln commented 3 years ago

Any Ideas ?

mifi commented 3 years ago

The problem is that I cannot reproduce it. If you can reproduce it, and then open the Instagram window in simpleinstabot (not the window showing the bot is running). Then developer tools (View menu), then go to Elements tab, then copy the whole HTML and share it with me, I can have a look.

Screenshot 2020-11-24 at 00 16 57
pgruener commented 3 years ago

Hello @mifi I got the same situation... perhaps ig rolled out a newer frontend ?

What I noticed in this repo is, that the login verification is done via an aria-label const isLoggedIn = async () => (await page.$x('//*[@aria-label="Home"]')).length === 1;

Which is definitely not known in my retrieved dom. Did this in the dev-tools:

$('[aria-label="Home"]')
null

I assume you are trying to check, if the instagram logo in the top-left is appearing.

However this is the snapshot from my logged-in dom with focus on the ig logo in the top-left. Just the img alt attribute might be useful for identification I guess:

image

mifi commented 3 years ago

Hi thanks for your research. Actually what the bot is trying to match is the "Home" button, see screenshot:

Screenshot 2021-11-09 at 13 10 23

How does your instqgram window look like? and how does the home button specifically look like in html? If possible you can share the whole html content as an attachment.

pgruener commented 3 years ago

Hi,

ok, I was showing the "other" home button in my previous dom. image

The one, you showed me is this one: image

image

Additionally I added the full dom in the gist https://gist.github.com/pgruener/c9dd85a4aac93684233afd99c7c7aea1 (reduced the data, as this is public here).

Tell me if you need more information.

mifi commented 3 years ago

Thanks I found this: <svg aria-label="Startseite" class="_8-yf5 " color="#262626" fill="#262626" height="22" role="img" viewBox="0 0 48 48" width="22"><path d="M45.5 48H30.1c-.8 0-1.5-.7-1.5-1.5V34.2c0-2.6-2.1-4.6-4.6-4.6s-4.6 2.1-4.6 4.6v12.3c0 .8-.7 1.5-1.5 1.5H2.5c-.8 0-1.5-.7-1.5-1.5V23c0-.4.2-.8.4-1.1L22.9.4c.6-.6 1.6-.6 2.1 0l21.5 21.5c.3.3.4.7.4 1.1v23.5c.1.8-.6 1.5-1.4 1.5z"></path></svg>

i think Startseite is Home in German.

did you try with the newest version? In the latest version the bot will re-set language to english also after logging in. Let me know if it’s still in german with the newest version.

pgruener commented 3 years ago

Hi, yes, you are right. I downloaded the new version, and noticed, that it changes the language, but instagram changed it back (around 2-3 times).

But with this information in mind (also that I knew, another "home" icon is looked for) I was able to change language in the footer manually. Now it starts working.

So the minor issue is, that the translation affects the identification of the login-state. (Perhaps this could help a bot-detector, to narrow down this as "scary" activity).

But with the manual language switch as a workaround, it starts running at least .. thanks for that :)

mifi commented 3 years ago

I downloaded the new version, and noticed, that it changes the language, but instagram changed it back (around 2-3 times).

What do you mean by instagram changing it back 2-3 times? I'd be really interested in finding a better way to change the language, because obviously the current technique of simply setting the ig_lang=en cookie doesn't seem to work in all cases. For me it works but apparently not for you. And if the bot has the wrong language, nothing really works...

I'm wondering why only some people have language set in the account. Is your account linked with facebook? Did you set language anywhere while setting up your account?

pgruener commented 3 years ago

What do you mean by instagram changing it back 2-3 times?

I noticed after the bot started the login page, that it switched the language to english. But nearly immediately afterwards it was set back to german. Im not 100% sure if I am remembering correctly, but the 2nd time was imho, after I approved the cookie banner. And finally after the login, i think to remember, it quickly switch to english again.. and afterwards to german.

It is possible to change the language in the settings (top right corner on your image -> profile) and then in the footer theres a simple select box, where the language can be changed, which is kept finally. image

And if the bot has the wrong language, nothing really works...

Ok, so are there more selectors, which rely on english behaviour (and not only the login state?) Perhaps we can try to sort this out by structure or other technical identification possibilities.

I'm wondering why only some people have language set in the account. Is your account linked with facebook? Did you set language anywhere while setting up your account?

Yes the account is linked to facebook, but unfortunately I dont remember, if I did some language settings during account creation.

mifi commented 3 years ago

It is possible to change the language in the settings (top right corner on your image -> profile)

where exactly in the settings? cause I don't have any language option inside the settings, only the one in the footer.

I guess I need to change the code so it actually uses that selector in the footer.

Ok, so are there more selectors, which rely on english behaviour (and not only the login state?) Perhaps we can try to sort this out by structure or other technical identification possibilities.

Yes most selectors rely on the aria (accessibility) labels or the visual labels, because those are the only things that seem to be stable. All classes, id's etc are all minified and could change all the time. At least a user or screen reader user expects a button to say the same thing every time, so instagram cannot keep changing those. Supporting many languages is going to be a maintenance nightmare, so i'd rather have it work perfectly on english, than work half way in multiple languages.

pgruener commented 3 years ago

where exactly in the settings? cause I don't have any language option inside the settings, only the one in the footer.

I meant in the footer, like my last screenshot should display this. But this footer is not present on every page, but on the settings page (probably on other pages, too).

Yes most selectors rely on the aria (accessibility) labels or the visual labels

Thats bad if there is no reliable other way. But youre 100% right to better support 1 good, than 100 bad. But a better, t8n-independent way would be still cooler ;-)

however

mifi commented 3 years ago

yea I think the only other way to support a i18n independent way is to look for and click buttons in the UI based on their visual location. but that is also prone to change every time layout changes.

I'm building a new version now that will select language from the language selector instead of creating a cookie, hopefully it will help!

pgruener commented 3 years ago

Yes a UI-location-based detection wont be as reliable as your current solution (i believe).

Probably it could be an option to read the aria-labels dynamically from an english configuration file to support translatable placeholders. With that, users could translate arias on their own, if they like, or keep the strong english fallback, which you're delivering by default.

Just as a "possibility" .. if that could influence the bot-detection .. if not, it might be useless anyways xD