Twitch-Drops-Bot icon indicating copy to clipboard operation
Twitch-Drops-Bot copied to clipboard

[Bug] [debug] BAD BOT! [error] Failed to claim drop reward

Open Kyuuso opened this issue 2 years ago • 50 comments

Describe the bug With the latest version of the branch dev, it still seems to give an error when claiming drops. Attached on logs whole log since started.

Logs log-1664265690313.txt

Kyuuso avatar Sep 27 '22 08:09 Kyuuso

It seems Twitch is starting to implement some anti-bot checks which prevents the bot from doing some actions like claiming drops. I'm not sure how to get around this yet.

TychoTheTaco avatar Sep 27 '22 22:09 TychoTheTaco

It seems Twitch is starting to implement some anti-bot checks which prevents the bot from doing some actions like claiming drops. I'm not sure how to get around this yet.

Yep they start uses https://www.kasada.io/ how i hear.

AndyShade avatar Sep 28 '22 05:09 AndyShade

from doing some actions like claiming drops

What is mean ? Watching channels ? Or set "climed"' drops in inventory ?

AndyShade avatar Sep 28 '22 05:09 AndyShade

Have you tried "claiming" through the inventory page? - Or does that enforce the same checks?

Valentin-Metz avatar Sep 28 '22 13:09 Valentin-Metz

Have you tried "claiming" through the inventory page? - Or does that enforce the same checks?

Locally claiming them seems to work fine, even if you "script" it with a tampermonkey script like https://greasyfork.org/es/scripts/420346-auto-claim-twitch-drop .

Kyuuso avatar Sep 28 '22 13:09 Kyuuso

I couldn't get the greasyfork script to work (I use greasemonkey, not tampermonkey, so that may be the issue), but there are also browser extensions that do the job.

EDIT: Disregard, multiple monitor woes.

WrayOfSunshine avatar Sep 28 '22 15:09 WrayOfSunshine

from doing some actions like claiming drops

What is mean ? Watching channels ? Or set "climed"' drops in inventory ?

From what I've seen, you can't login (unless you already have saved cookies), and you can't claim drops. Watching stream should still work.

It seems that they are somehow detecting that the bot is using Puppeteer and blocking those requests. Using a browser extension to auto claim drops might be the best alternative for now.

TychoTheTaco avatar Sep 28 '22 17:09 TychoTheTaco

Currently, the bot still:

Watches streams for you (making you eligible for a drop) Claims community points (I think)

The bot can currently not:

Claim drops for you - this is the 'claim' button on the inventory page. You can use any number of solutions in a browser to claim these semi-automatically, but every solution I've found does require you have the drops inventory page open.

WrayOfSunshine avatar Sep 28 '22 19:09 WrayOfSunshine

The greasyfork script runs well. No reason we can't simply put an entire non-headless firefox instance with inventory page open and script running into docker.

Valentin-Metz avatar Sep 29 '22 00:09 Valentin-Metz

The greasyfork script runs well. No reason we can't simply put an entire non-headless firefox instance with inventory page open and script running into docker.

Or use puppeteer's ability load extension and use simple ChannelPointCollector. It has both chrome and firefox version.

AndyShade avatar Sep 29 '22 05:09 AndyShade

I couldn't get the greasyfork script to work (I use greasemonkey, not tampermonkey, so that may be the issue), but there are also browser extensions that do the job.

EDIT: Disregard, multiple monitor woes. Swith to violentmonkey - greasemonkey no support some modern and othen use js fuctions

AndyShade avatar Sep 29 '22 08:09 AndyShade

Hopefully just cosmetic, but if you manually claim, the next loop also presumes progress to be towards already accomplished goals: image

Luckz avatar Sep 29 '22 21:09 Luckz

Maybe it is possible to include this chrome addon or talk with the dev about how he fixed his stuff?

dodgex avatar Oct 07 '22 06:10 dodgex

Maybe it is possible to include this chrome addon or talk with the dev about how he fixed his stuff?

Not working, you can see in the "Support" tab several people saying it is no longer claiming drops (since ~1 week ago).

FelipeCalliari avatar Oct 07 '22 14:10 FelipeCalliari

Maybe it is possible to include this chrome addon or talk with the dev about how he fixed his stuff?

Not working, you can see in the "Support" tab several people saying it is no longer claiming drops (since ~1 week ago).

The extension claimed correctly for me, today. While the bot didn't.

thierrybla avatar Oct 07 '22 14:10 thierrybla

Maybe it is possible to include this chrome addon or talk with the dev about how he fixed his stuff?

Not working, you can see in the "Support" tab several people saying it is no longer claiming drops (since ~1 week ago).

The extension claimed correctly for me, today. While the bot didn't.

Hum, nice. I use Tampermonkey to do this for me and it works too (I just made a small JS script).

But, the extension worked with Puppeteer? --browser-args=["--load-extension=..."] I will give it a try.

Hello. Some time ago, Twitch introduced a new anti-bot system that caused the extension to stop working. With update 1.5.2, I was able to fully restore the extension functionality and improve its stability.

FelipeCalliari avatar Oct 07 '22 14:10 FelipeCalliari

Does the bot claim the drops on the inventory page? For me the button to claim drops in the chat doesn't show up anymore.

yukaiin avatar Oct 07 '22 18:10 yukaiin

Does the bot claim the drops on the inventory page? For me the button to claim drops in the chat doesn't show up anymore.

@yukaiin I tried this extension with Puppeteer and it does not work!

However, I opened another instance of Chromium (without Puppeteer) with the extension and let a tab at https://www.twitch.tv/drops/inventory and, yes, it does claim the drop!

The only problem is Twitch might be detecting Puppeteer, so it is not as simple as simply putting this extension as a chrome addon. It's not the best solution, but I have now two instances of Chrome (one from Twitch-Drop-Bot being called by Puppeteer, and another with the extension), but, at least, it is working.

FelipeCalliari avatar Oct 07 '22 23:10 FelipeCalliari

I've been messing around with it a bit and it seems like their anti-bot detection is pretty complicated. I believe they are using some sort of browser fingerprinting to detect bots, maybe in addition to other factors.

If I launch a normal Chrome instance and attach to it with Puppeteer (as opposed to launching it via Puppeteer), I can successfully claim drops but it only works sometimes. Sometimes it passes the integrity check and sometimes it doesn't and I'm not sure why. The other thing to note is that it never works in headless mode so I guess they can detect that every time.

I've also tried running a non-headless Chrome instance in a docker container but I keep getting some rendering errors when trying to load the Twitch page. I tried Firefox as well, which does not have any rendering issue, but it doesn't seem to work properly with the existing code.

TychoTheTaco avatar Oct 08 '22 01:10 TychoTheTaco

I think migration to Firefox for drop claiming might be a necessary switch. What a hassle, though.

WrayOfSunshine avatar Oct 08 '22 01:10 WrayOfSunshine

We could run both in parallel.

Valentin-Metz avatar Oct 08 '22 02:10 Valentin-Metz

I think migration to Firefox for drop claiming might be a necessary switch. What a hassle, though.

Or it's then a question of time until they also block instrumented Firefox.

Luckz avatar Oct 08 '22 05:10 Luckz

TychoTheTaco any way manage FF an Chome not use puppetir ? Simple use commad line swithes for launche browsers in headles mode or hiding chrome/ff windows and set minima screen size . Manage browser via switches and devtool and set minimal resource consumptions and load extension or just use installd ?

AndyShade avatar Oct 08 '22 07:10 AndyShade

While suggesting things that are not Puppeteer, there is https://github.com/ultrafunkamsterdam/undetected-chromedriver

Luckz avatar Oct 08 '22 08:10 Luckz

Does the bot claim the drops on the inventory page? For me the button to claim drops in the chat doesn't show up anymore.

@yukaiin I tried this extension with Puppeteer and it does not work!

However, I opened another instance of Chromium (without Puppeteer) with the extension and let a tab at https://www.twitch.tv/drops/inventory and, yes, it does claim the drop!

I believe for me the extension works, at least with the browser (Twitch) window increased to a big enough size that it shows the chat, and not in headless mode. I don't know if the extension claims the drops in chat, if the extension claims them when TDB opens the inventory page, or if the bigger window size and headful mode gets TDB past the bot detection.

Notes: "--whitelisted-extension-id=kfhgpagdjjoieckminnmigmpeclkdmjm","--allowlisted-extension-id=kfhgpagdjjoieckminnmigmpeclkdmjm", I use, but I have no idea if they are useful. --disable-extensions-except= does not disable Google Hangouts, which is the only other extension that shows up in Chrome Task Manager, so I guess it's useless? My working setup does not include this argument.

Luckz avatar Oct 09 '22 04:10 Luckz

Notes: "--whitelisted-extension-id=kfhgpagdjjoieckminnmigmpeclkdmjm","--allowlisted-extension-id=kfhgpagdjjoieckminnmigmpeclkdmjm", I use, but I have no idea if they are useful. --disable-extensions-except= does not disable Google Hangouts, which is the only other extension that shows up in Chrome Task Manager, so I guess it's useless? My working setup does not include this argument.

I say trivial things but bot need to open 2 pages - a page with a video stream and inventory page from which extension claim drop. How i can see chat drop not now working in that extensions and userjs. If chorme or puppeter can execute userjs directly we may use lightweight js from greasyfork or openuserjs.org.

AndyShade avatar Oct 10 '22 08:10 AndyShade

I believe for me the extension works, at least with the browser (Twitch) window increased to a big enough size that it shows the chat, and not in headless mode.

• My account that worked in headful mode also claims new drops in headless, at "--window-size=952,512". • The other account I am testing with did not claim drops in headless, and does not claim drops in headful at the same resolution. I think it might be be because I did not react to the super big cookie prompt on Twitch that covers most of the screen? I will let it try to go for another drop and then if it again does not claim, I will try manually dealing with the cookies prompt. I compared cookies and Twitch localstorage between the two accounts and outside of a tracking(?) cookie on the account on which I didn't react to the GDPR cookies prompt yet, it seems to be the same stuff. • It's also possible that, because the second account I am testing has several unclaimed drops, this affects not claiming new ones. Maybe future drops won't get claimed if TDP regularly "spams" to claim the current queue. The working account (of course?) does not have that situation. Not testing this right now since I would rather not 'ruin' my test account with manual claiming, I already had to manually claim a few times to even be able to idle.

Luckz avatar Oct 10 '22 09:10 Luckz

I believe for.....

If what answer for me " chat drop not working" meaning extensions or js no claim drops from chat by viewing in normal browser (no matter Chrome or FF) on usual windows size like before twitch was that anibot update(no relogins in FF).But if open inv.tab drop got clime or keep invetory tab open then they works. Of course it only behavior descriptions on me. Ah and chat allway be closed.

AndyShade avatar Oct 10 '22 09:10 AndyShade

The other account I am testing with did not claim drops in headless, and does not claim drops in headful

I think it might be be because I did not react to the super big cookie prompt on Twitch that covers most of the screen?

If you have a "What kind of cookies would you like?" prompt that refuses to disappear, or you get "Something went wrong" when you try to log in, or you cannot manually claim a drop in that browser profile with "Error Occurred: Drop was not claimed.", you are shitlisted as a bot. These are all symptoms of integrity check failure. https://www.reddit.com/r/Twitch/comments/xld7cs/help_cookies_banner_wont_disappear_no_matter_what/ https://www.reddit.com/r/Twitch/comments/xm7how/something_went_wrong_when_trying_to_log_into/ You can verify this in the browser console too. If affected there is usually some message about integrity failure.

I spent a lot of time on trial and error to fix that troubled account. Spoilers: I think that I had ~10 pending drops was a big part of the problem. • I cannot log in through Twitch Drops Bot. • I can log in by hand through a regular web browser, and then hand the browser profile over to Twitch Drops Bot. • Saving the cookies and letting Puppeteer make a fresh profile with those cookies does not work for me. I can't rule out that I was doing something wrong, but on my PC I am using a persistent browser profile and that works. • Once Twitch Drops Bot starts, if there are pending drops to be claimed in the inventory, I believe TDB will start exhibiting bot behaviour and fail the integrity check because it tries to claim all of them at once. At least with 5–10 drops, once this happens, I can just delete the browser profile and start over. My 'fix' was to prevent execution of the relevant code: if (isDropReadyToClaim(drop)) { in twitch_drops_bot.js

If you don't feel like replacing the cookies-accountname.json values with new ones by hand and just delete the file, you will run into trouble with TWB wanting to make you log in, which will crash due to the lack of a login prompt; an ugly way to skip it is to neuter yield this.page.focus("#login-username"); in pages\login.js. (Of course if you use the same profile every time, cookie restoring on startup isn't necessary anyway.)

After that, with a persistent browser profile created manually (using the same profile every time is not supported in the current TDB release version), and using the extension, and (I guess) with the screen resized so that the chat with drop prompt appears for the extension to claim the drops, .. it works. 😅


so for config.json we want:

"browser": whatever browser you made the browser profile folder with (I use Chrome & Edge) "browser_args": here we need some things added to whatever commands you use, first add an appropriate window size, f.ex. "--window-size=952,512" then also load the unpacked extension, maybe it's just enough to have one of these two commands, I use both "--disable-extensions-except=C:\\Users\\MY_FUNNY_NAME\\AppData\\Local\\Temp\\kfhgpagdjjoieckminnmigmpeclkdmjm\\1.5.2_0","--load-extension=C:\\Users\\MY_FUNNY_NAME\\AppData\\Local\\Temp\\kfhgpagdjjoieckminnmigmpeclkdmjm\\1.5.2_0"

How to specify the path to your not-yet-detected user profile is a topic for https://github.com/TychoTheTaco/Twitch-Drops-Bot/pull/219

To test if your profile works, "headless": false, Afterwards for "production" work, "headless": "chrome",

And as a bonus, once you are happy and don't want to die of gigabyte sized log files anymore,

    "logging": {
        "level": "info"
    },

P.S.: I didn't figure out if there is a way to have Puppeteer launch Chrome without harming already installed Chrome Web Store extensions. It's of course not great to have to unpack the extension and keep it updated yourself, especially if using the same profile folder every time.

Luckz avatar Oct 11 '22 10:10 Luckz

I guess this kinda died now :(

PatrickJnr avatar Oct 13 '22 09:10 PatrickJnr