rdavydov / Twitch-Channel-Points-Miner-v2

[NEW] A simple script that will watch a stream for you and earn the channel points. A successor of Tkd-Alex's original repo.
GNU General Public License v3.0
1.25k stars 358 forks source link

Problem with generating new cookies file #15

Closed XaaRii closed 2 years ago

XaaRii commented 2 years ago

Describe the bug Problem with generating new cookies file, but existing ones work just fine

To Reproduce Steps to reproduce the behavior:

  1. Download latest version (currently 1.3.4)
  2. Install prerequisities with pip install -r requirements.txt
  3. Copy the example file and change the username (password set to "" -> will ask interactively)
  4. Run the modified script, be asked to enter the password
  5. After you fill the password, it crashes.

Expected behavior Expected a question for 2FA and the Twitch Miner to start.

Desktop (please complete the following information):

Additional context Problem with generating cookies file, because it works if i provide them one generated from before (i believe it was a version 1.2), but sadly, this problem occurs minimally from version 1.3.2 (tested this version, then moved on to the latest and the problem was still present). Would be amazing if that could be fixed.

Log:

28/10/22 18:59:34 - INFO - [run]: [username] Start session: 'sessionid' 28/10/22 18:59:34 - INFO - [login_flow]: [username] You'll have to login to Twitch! Enter Twitch password for username: Traceback (most recent call last): File "/home/ubuntu/twitchminers/runPawele.py", line 110, in twitch_miner.mine( File "/home/ubuntu/twitchminers/TwitchChannelPointsMiner/TwitchChannelPointsMiner.py", line 161, in mine self.run(streamers=streamers, blacklist=blacklist, followers=followers) File "/home/ubuntu/twitchminers/TwitchChannelPointsMiner/TwitchChannelPointsMiner.py", line 179, in run self.twitch.login() File "/home/ubuntu/twitchminers/TwitchChannelPointsMiner/classes/Twitch.py", line 84, in login if self.twitch_login.login_flow(): File "/home/ubuntu/twitchminers/TwitchChannelPointsMiner/classes/TwitchLogin.py", line 75, in login_flow login_response = self.send_login_request(post_data) File "/home/ubuntu/twitchminers/TwitchChannelPointsMiner/classes/TwitchLogin.py", line 152, in send_login_request return response.json() File "/usr/lib/python3/dist-packages/requests/models.py", line 900, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3.10/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/usr/lib/python3.10/json/decoder.py", line 340, in decode raise JSONDecodeError("Extra data", s, end) json.decoder.JSONDecodeError: Extra data: line 1 column 128 (char 127)

KraineOpasen commented 2 years ago

01/11/22 16:04:36 - INFO - [update_raid]: 🎭 Joining raid from Streamer(username=dezgamez, channel_id=41800397, channel_points=10.07k) to mouzakrobat! 01/11/22 16:05:35 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=skill4ltu, channel_id=110775952, channel_points=33.9k) - Reason: WATCH. 01/11/22 16:05:35 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=skill4ltu, channel_id=110775952, channel_points=33.9k)! 01/11/22 16:05:57 - INFO - [stop]: πŸ’¬ Leave IRC Chat: dezgamez 01/11/22 16:05:57 - INFO - [set_offline]: 😴 Streamer(username=dezgamez, channel_id=41800397, channel_points=10.07k) is Offline! 01/11/22 16:07:13 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.44k) - Reason: WATCH. 01/11/22 16:10:35 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=skill4ltu, channel_id=110775952, channel_points=33.91k) - Reason: WATCH. 01/11/22 16:12:06 - INFO - [on_message]: πŸš€ +10 β†’ Streamer(username=orzanel, channel_id=44536868, channel_points=26.69k) - Reason: WATCH. 01/11/22 16:12:06 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=orzanel, channel_id=44536868, channel_points=26.69k)! 01/11/22 16:17:06 - INFO - [on_message]: πŸš€ +10 β†’ Streamer(username=orzanel, channel_id=44536868, channel_points=26.7k) - Reason: WATCH. 01/11/22 16:20:06 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.45k) - Reason: WATCH. 01/11/22 16:20:06 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=quickybaby, channel_id=30623831, channel_points=32.45k)! 01/11/22 16:23:35 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=skill4ltu, channel_id=110775952, channel_points=33.92k) - Reason: WATCH. 01/11/22 16:25:05 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.46k) - Reason: WATCH. 01/11/22 16:28:36 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=skill4ltu, channel_id=110775952, channel_points=33.93k) - Reason: WATCH. 01/11/22 16:30:05 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.47k) - Reason: WATCH. 01/11/22 16:33:33 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=quickybaby, channel_id=30623831, channel_points=32.47k)! 01/11/22 16:33:34 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=skill4ltu, channel_id=110775952, channel_points=33.93k)! 01/11/22 16:33:36 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=skill4ltu, channel_id=110775952, channel_points=33.95k) - Reason: WATCH. 01/11/22 16:33:36 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=orzanel, channel_id=44536868, channel_points=26.7k)! 01/11/22 16:35:07 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.49k) - Reason: WATCH. 01/11/22 16:38:36 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=skill4ltu, channel_id=110775952, channel_points=33.96k) - Reason: WATCH. 01/11/22 16:40:07 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.5k) - Reason: WATCH. 01/11/22 16:43:36 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=skill4ltu, channel_id=110775952, channel_points=33.97k) - Reason: WATCH. 01/11/22 16:45:07 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.51k) - Reason: WATCH. 01/11/22 16:46:01 - INFO - [run]: πŸ’¬ Join IRC Chat: chessgenie 01/11/22 16:46:01 - INFO - [set_online]: πŸ₯³ Streamer(username=chessgenie, channel_id=111768177, channel_points=8k) is Online! 01/11/22 16:50:05 - INFO - [on_message]: πŸš€ +10 β†’ Streamer(username=chessgenie, channel_id=111768177, channel_points=8.01k) - Reason: WATCH. 01/11/22 16:50:05 - INFO - [on_message]: πŸš€ +450 β†’ Streamer(username=chessgenie, channel_id=111768177, channel_points=8.46k) - Reason: WATCH_STREAK. 01/11/22 16:50:05 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=chessgenie, channel_id=111768177, channel_points=8.46k)! 01/11/22 16:50:36 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.52k) - Reason: WATCH. 01/11/22 16:56:06 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.53k) - Reason: WATCH. 01/11/22 16:57:34 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=skill4ltu, channel_id=110775952, channel_points=33.98k) - Reason: WATCH. 01/11/22 17:01:06 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.55k) - Reason: WATCH. 01/11/22 17:02:35 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=skill4ltu, channel_id=110775952, channel_points=33.99k) - Reason: WATCH. 01/11/22 17:04:02 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=quickybaby, channel_id=30623831, channel_points=32.55k)! 01/11/22 17:04:03 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=skill4ltu, channel_id=110775952, channel_points=33.99k)! 01/11/22 17:04:04 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=orzanel, channel_id=44536868, channel_points=26.7k)! 01/11/22 17:04:06 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=chessgenie, channel_id=111768177, channel_points=8.46k)! 01/11/22 17:04:31 - INFO - [run]: πŸ’¬ Join IRC Chat: mailand 01/11/22 17:04:31 - INFO - [set_online]: πŸ₯³ Streamer(username=mailand, channel_id=61776958, channel_points=5.38k) is Online! 01/11/22 17:06:06 - INFO - [on_message]: πŸš€ +10 β†’ Streamer(username=mailand, channel_id=61776958, channel_points=5.39k) - Reason: WATCH. 01/11/22 17:06:06 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=mailand, channel_id=61776958, channel_points=5.39k)! 01/11/22 17:06:06 - INFO - [on_message]: πŸš€ +450 β†’ Streamer(username=mailand, channel_id=61776958, channel_points=5.84k) - Reason: WATCH_STREAK. 01/11/22 17:06:36 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.56k) - Reason: WATCH. 01/11/22 17:12:05 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.57k) - Reason: WATCH. 01/11/22 17:14:36 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=skill4ltu, channel_id=110775952, channel_points=34.01k) - Reason: WATCH. 01/11/22 17:17:06 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.58k) - Reason: WATCH. 01/11/22 17:19:36 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=skill4ltu, channel_id=110775952, channel_points=34.02k) - Reason: WATCH. 01/11/22 17:22:05 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.59k) - Reason: WATCH. 01/11/22 17:24:36 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=skill4ltu, channel_id=110775952, channel_points=34.03k) - Reason: WATCH. 01/11/22 17:27:06 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.61k) - Reason: WATCH. 01/11/22 17:29:13 - INFO - [on_message]: πŸ“Œ Streamer(username=mailand, channel_id=61776958, channel_points=5.84k) have only 5836 channel points and the minimum for bet is: 20000 01/11/22 17:29:36 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=skill4ltu, channel_id=110775952, channel_points=34.04k) - Reason: WATCH. 01/11/22 17:32:05 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.62k) - Reason: WATCH. 01/11/22 17:34:09 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=quickybaby, channel_id=30623831, channel_points=32.62k)! 01/11/22 17:34:10 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=skill4ltu, channel_id=110775952, channel_points=34.04k)! 01/11/22 17:34:11 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=orzanel, channel_id=44536868, channel_points=26.7k)! 01/11/22 17:34:13 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=chessgenie, channel_id=111768177, channel_points=8.46k)! 01/11/22 17:34:14 - INFO - [claim_bonus]: 🎁 Claiming the bonus for Streamer(username=mailand, channel_id=61776958, channel_points=5.84k)! 01/11/22 17:34:35 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=skill4ltu, channel_id=110775952, channel_points=34.05k) - Reason: WATCH. 01/11/22 17:37:06 - INFO - [on_message]: πŸš€ +12 β†’ Streamer(username=quickybaby, channel_id=30623831, channel_points=32.63k) - Reason: WATCH.

@antipatico

Is there a way to login and then port the cookie back to docker?

Yes, there is. Just copy the cookie file! :) So okay?

rdavydov commented 2 years ago

@KraineOpasen Dude, not cool. Use gist or pastebin for long logs. And this is not a debug log. It's just your console output.

KraineOpasen commented 2 years ago

@KraineOpasen Dude, not cool. Use gist or pastebin for long logs.

Dude do you think everyone is advanced like you?

rdavydov commented 2 years ago

@KraineOpasen Stop being rude and arrogant or you will not get any help. This kind of behavior is not accepted here. First warning. I already replied to you.

KraineOpasen commented 2 years ago

@KraineOpasen Stop being rude and arrogant or you will not get any help. This kind of behavior is not welcome here. First warning. I already replied to you.

Are you offended? Don't take it to heart, I didn't mean to offend you! You are great for supporting and continuing to develop the bot. Please tell me what I need to do.

KraineOpasen commented 2 years ago

Only thanks to you everything works here

rdavydov commented 2 years ago

Please tell me what I need to do.

  1. Try to delete the cookie file (cookies\username.pkl), obtain it again with 1.4.0 and see how it goes.
  2. Set
    logger_settings=LoggerSettings(
    save=True,
    console_level=logging.INFO,
    file_level=logging.DEBUG,
    less=True,

    in your runner script (run.py).

  3. When you open Twitch in your browser (like a normal user), do you have a green box waiting to be claimed in the channel?
  4. If it is there, but the miner can't claim it, stop the miner and then post the contents of the log file (logs\username.log) to https://gist.github.com/ and give me a link here.
  5. And create another gist with your console output, just in case. Paste a link here as well.
rdavydov commented 2 years ago

@antipatico Your message is hidden, same thing regarding long logs. This issue page will be impossible to read if everyone will be posting hundreds of lines.

antipatico commented 2 years ago

@rdavydov I figured it was not getting input from stdin, but I guess that is another bug. I managed to login, but I am still getting flagged as a bad bot:

(venv) PS C:\Users\antipatico\Desktop\Twitch-Channel-Points-Miner-v2> python .\run.py
01/11/22 18:06:06 - ERROR - [analytics]: Can't start analytics(), please set enable_analytics=True
01/11/22 18:06:06 - INFO - [run]: πŸ’£  Start session: 'e2dba171-0e67-4c97-8063-37bf80910cb0'
01/11/22 18:06:06 - INFO - [login_flow]: You'll have to login to Twitch!
01/11/22 18:06:07 - INFO - [login_flow]: Console login unavailable (CAPTCHA solving required).
01/11/22 18:06:07 - INFO - [login_flow_backup]: Now a browser window will open, it will login with your data.
01/11/22 18:06:13 - INFO - [patch_exe]: patching driver executable C:\Users\antipatico\appdata\roaming\undetected_chromedriver\56b6f67061d336a7_chromedriver.exe
01/11/22 18:06:23 - INFO - [login_flow_backup]: Enter your verification code in the browser and wait for the Twitch website to load, then press Enter here.

01/11/22 18:07:23 - INFO - [login_flow_backup]: Extracting cookies...
01/11/22 18:07:24 - ERROR - [post_integrity]: Uh-oh, Twitch has detected this miner as a "Bad Bot"
01/11/22 18:07:25 - INFO - [run]: πŸ“‹  Load 69 followers from your profile!
01/11/22 18:07:25 - INFO - [run]: πŸ€“  Loading data for 69 streamers. Please wait...

Edit: it seems like working anyway, great work! I'm opening a PR for the above mentioned bug

rdavydov commented 2 years ago

@antipatico

I figured it was not getting input from stdin I managed to login

And how did you make it get the input eventually?

but I am still getting flagged as a bad bot

It was already discussed here. I even mentioned it in the release notes. This error can be safely ignored, it's purely informational.

P.S. You also need to set enable_analytics=True if you need Analytics.

XaaRii commented 2 years ago

So, i wanted to run it on my windows machine (tested on my personal Win10 and on a clean install of Win11). (Friendly reminder, it requires vc_redist (x64), otherwise it crashes with some error about failed dll load of _brotli.) Anyways, both machines crashed while opening the browser (last thing in the log: DEBUG - uc - [__init__]: did not find a bad exit_type flag). Well, that IS because i have Firefox on my main pc / Edge on the clean one. After installing Chrome, it seems to be working... would be nice to write somewhere it is mandatory, not everyone runs chrome. Also, if the password is not set in file.py, it will not be filled in the browser after opening. Cookies file created, i will report later if everything is alright. But i don't expect issues as others have already reported it's working just fine.

Lastly, huge thanks for that #, executable_path= in TwitchLogin.py file, as I intend to download a portable version of chrome(ium? if possible) without cluttering my system with another browser.

rdavydov commented 2 years ago

@XaaRii Great report, thank you!

FarmerBrianW commented 2 years ago

For my solution, I was on a PuTTY session on my raspberry pi, running just enough OS for the command line, so no GUI, and no graphical browser, just running python from the command line, so I was never getting prompted for the 2FA. I will create a Docker and see if I have better luck.

rdavydov commented 2 years ago

For my solution, I was on a PuTTY session on my raspberry pi, running just enough OS for the command line, so no GUI, and no graphical browser, just running python from the command line, so I was never getting prompted for the 2FA. I will create a Docker and see if I have better luck.

What solution? Manual cookies extraction from the browser? It was already implemented in the miner even before I forked it. I used it in 1.3.5. And the most important part: you can't collect bonuses with it if you haven't obtained a "console" cookie before. If you're fine with it - you're free to use your method or 1.3.5.

Glass47 commented 1 year ago

Getting "Unknown error: {'error': 'Please update your device to the latest version of Android or iOS to continue.', 'error_code': 5024, 'error_description': 'client not supported for app upgrade'}" 1 or so day ago i tried and everything worked, tried today and this shows up. I will try this on W11 if same issue persists, just want to make sure problem is not coming from me.