Giter Site home page Giter Site logo

rdavydov / twitch-channel-points-miner-v2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bossoq/twitch-channel-points-miner-v2

1.1K 42.0 330.0 2.34 MB

A simple script that will watch a stream for you and earn the channel points.

License: GNU General Public License v3.0

JavaScript 5.81% Python 87.90% CSS 0.77% HTML 4.99% Dockerfile 0.44% Batchfile 0.09%
automation bets coins drops farming miner mining points raids twitch chat moments

twitch-channel-points-miner-v2's Introduction

Twitch Channel Points Miner - v2

Latest Version GitHub Repo stars GitHub Traffic GitHub Clones License GitHub last commit

Docker Version Docker Stars Docker Pulls Docker Images Size AMD64 Docker Images Size ARM64 Docker Images Size ARMv7

Credits

A simple script that will watch a stream for you and earn the channel points.

It can wait for a streamer to go live (+450 points when the stream starts), it will automatically click the bonus button (+50 points), and it will follow raids (+250 points).

Read more about the channel points here.

README Contents

  1. 🀝 Community
  2. πŸš€ Main differences from the original repository
  3. 🧾 Logs feature
  4. 🧐 How to use
  5. πŸ”§ Settings
  6. πŸ“ˆ Analytics
  7. πŸͺ Migrating from an old repository (the original one)
  8. πŸͺŸ Windows
  9. πŸ“± Termux
  10. ⚠️ Disclaimer

Community

If you want to help with this project, please leave a star 🌟 and share it with your friends! 😎

If you want to offer me a coffee, I would be grateful! ❀️

Donate BTC bc1qq49mvgda2zw4f9kta0a85xztwuxewqwac5eckd (BTC)
Donate DOGE DAKzncwKkpfPCm1xVU7u2pConpXwX7HS3D (DOGE)
Donate via DonationAlerts https://www.donationalerts.com/r/rdavydov
Donate via Boosty https://boosty.to/rdavydov/donate

If you have any issues or you want to contribute, you are welcome! But please read the CONTRIBUTING.md file.

Main differences from the original repository:

  • Improved logging: emojis, colors, files and much more βœ”οΈ
  • Final report with all the data βœ”οΈ
  • Rewritten codebase now uses classes instead of modules with global variables βœ”οΈ
  • Automatic downloading of the list of followers and using it as an input βœ”οΈ
  • Better 'Watch Streak' strategy in the priority system #11 βœ”οΈ
  • Auto claiming game drops from the Twitch inventory #21 βœ”οΈ
  • Placing a bet / making a prediction with your channel points #41 (@lay295) βœ”οΈ
  • Switchable analytics chart that shows the progress of your points with various annotations #96 βœ”οΈ
  • Joining the IRC Chat to increase the watch time and get StreamElements points #47 βœ”οΈ
  • Moments claiming #182 βœ”οΈ
  • Notifying on @nickname mention in the Twitch chat #227 βœ”οΈ

Logs feature

Full logs

%d/%m/%y %H:%M:%S - INFO - [run]: πŸ’£  Start session: '9eb934b0-1684-4a62-b3e2-ba097bd67d35'
%d/%m/%y %H:%M:%S - INFO - [run]: πŸ€“  Loading data for x streamers. Please wait ...
%d/%m/%y %H:%M:%S - INFO - [set_offline]: 😴  Streamer(username=streamer-username1, channel_id=0000000, channel_points=67247) is Offline!
%d/%m/%y %H:%M:%S - INFO - [set_offline]: 😴  Streamer(username=streamer-username2, channel_id=0000000, channel_points=4240) is Offline!
%d/%m/%y %H:%M:%S - INFO - [set_offline]: 😴  Streamer(username=streamer-username3, channel_id=0000000, channel_points=61365) is Offline!
%d/%m/%y %H:%M:%S - INFO - [set_offline]: 😴  Streamer(username=streamer-username4, channel_id=0000000, channel_points=3760) is Offline!
%d/%m/%y %H:%M:%S - INFO - [set_online]: πŸ₯³  Streamer(username=streamer-username, channel_id=0000000, channel_points=61365) is Online!
%d/%m/%y %H:%M:%S - INFO - [start_bet]: πŸ”§  Start betting for EventPrediction(event_id=xxxx-xxxx-xxxx-xxxx, title=Please star this repo) owned by Streamer(username=streamer-username, channel_id=0000000, channel_points=61365)
%d/%m/%y %H:%M:%S - INFO - [__open_coins_menu]: πŸ”§  Open coins menu for EventPrediction(event_id=xxxx-xxxx-xxxx-xxxx, title=Please star this repo)
%d/%m/%y %H:%M:%S - INFO - [__click_on_bet]: πŸ”§  Click on the bet for EventPrediction(event_id=xxxx-xxxx-xxxx-xxxx, title=Please star this repo)
%d/%m/%y %H:%M:%S - INFO - [__enable_custom_bet_value]: πŸ”§  Enable input of custom value for EventPrediction(event_id=xxxx-xxxx-xxxx-xxxx, title=Please star this repo)
%d/%m/%y %H:%M:%S - INFO - [on_message]: ⏰  Place the bet after: 89.99s for: EventPrediction(event_id=xxxx-xxxx-xxxx-xxxx-15c61914ef69, title=Please star this repo)
%d/%m/%y %H:%M:%S - INFO - [on_message]: πŸš€  +12 β†’ Streamer(username=streamer-username, channel_id=0000000, channel_points=61377) - Reason: WATCH.
%d/%m/%y %H:%M:%S - INFO - [make_predictions]: πŸ€  Going to complete bet for EventPrediction(event_id=xxxx-xxxx-xxxx-xxxx-15c61914ef69, title=Please star this repo) owned by Streamer(username=streamer-username, channel_id=0000000, channel_points=61377)
%d/%m/%y %H:%M:%S - INFO - [make_predictions]: πŸ€  Place 5k channel points on: SI (BLUE), Points: 848k, Users: 190 (70.63%), Odds: 1.24 (80.65%)
%d/%m/%y %H:%M:%S - INFO - [on_message]: πŸš€  +6675 β†’ Streamer(username=streamer-username, channel_id=0000000, channel_points=64206) - Reason: PREDICTION.
%d/%m/%y %H:%M:%S - INFO - [on_message]: πŸ“Š  EventPrediction(event_id=xxxx-xxxx-xxxx-xxxx, title=Please star this repo) - Result: WIN, Points won: 6675
%d/%m/%y %H:%M:%S - INFO - [on_message]: πŸš€  +12 β†’ Streamer(username=streamer-username, channel_id=0000000, channel_points=64218) - Reason: WATCH.
%d/%m/%y %H:%M:%S - INFO - [on_message]: πŸš€  +12 β†’ Streamer(username=streamer-username, channel_id=0000000, channel_points=64230) - Reason: WATCH.
%d/%m/%y %H:%M:%S - INFO - [claim_bonus]: 🎁  Claiming the bonus for Streamer(username=streamer-username, channel_id=0000000, channel_points=64230)!
%d/%m/%y %H:%M:%S - INFO - [on_message]: πŸš€  +60 β†’ Streamer(username=streamer-username, channel_id=0000000, channel_points=64290) - Reason: CLAIM.
%d/%m/%y %H:%M:%S - INFO - [on_message]: πŸš€  +12 β†’ Streamer(username=streamer-username, channel_id=0000000, channel_points=64326) - Reason: WATCH.
%d/%m/%y %H:%M:%S - INFO - [on_message]: πŸš€  +400 β†’ Streamer(username=streamer-username, channel_id=0000000, channel_points=64326) - Reason: WATCH_STREAK.
%d/%m/%y %H:%M:%S - INFO - [claim_bonus]: 🎁  Claiming the bonus for Streamer(username=streamer-username, channel_id=0000000, channel_points=64326)!
%d/%m/%y %H:%M:%S - INFO - [on_message]: πŸš€  +60 β†’ Streamer(username=streamer-username, channel_id=0000000, channel_points=64386) - Reason: CLAIM.
%d/%m/%y %H:%M:%S - INFO - [on_message]: πŸš€  +12 β†’ Streamer(username=streamer-username, channel_id=0000000, channel_points=64398) - Reason: WATCH.
%d/%m/%y %H:%M:%S - INFO - [update_raid]: 🎭  Joining raid from Streamer(username=streamer-username, channel_id=0000000, channel_points=64398) to another-username!
%d/%m/%y %H:%M:%S - INFO - [on_message]: πŸš€  +250 β†’ Streamer(username=streamer-username, channel_id=0000000, channel_points=6845) - Reason: RAID.

Less logs

%d/%m %H:%M:%S - πŸ’£  Start session: '9eb934b0-1684-4a62-b3e2-ba097bd67d35'
%d/%m %H:%M:%S - πŸ€“  Loading data for 13 streamers. Please wait ...
%d/%m %H:%M:%S - 😴  streamer-username1 (xxx points) is Offline!
%d/%m %H:%M:%S - 😴  streamer-username2 (xxx points) is Offline!
%d/%m %H:%M:%S - 😴  streamer-username3 (xxx points) is Offline!
%d/%m %H:%M:%S - 😴  streamer-username4 (xxx points) is Offline!
%d/%m %H:%M:%S - πŸ₯³  streamer-username (xxx points) is Online!
%d/%m %H:%M:%S - πŸ”§  Start betting for EventPrediction: Please star this repo owned by streamer-username (xxx points)
%d/%m %H:%M:%S - πŸ”§  Open coins menu for EventPrediction: Please star this repo
%d/%m %H:%M:%S - πŸ”§  Click on the bet for EventPrediction: Please star this repo
%d/%m %H:%M:%S - πŸ”§  Enable input of custom value for EventPrediction: Please star this repo
%d/%m %H:%M:%S - ⏰  Place the bet after: 89.99s EventPrediction: Please star this repo
%d/%m %H:%M:%S - πŸš€  +12 β†’ streamer-username (xxx points) - Reason: WATCH.
%d/%m %H:%M:%S - πŸ€  Going to complete bet for EventPrediction: Please star this repo owned by streamer-username (xxx points)
%d/%m %H:%M:%S - πŸ€  Place 5k channel points on: SI (BLUE), Points: 848k, Users: 190 (70.63%), Odds: 1.24 (80.65%)
%d/%m %H:%M:%S - πŸš€  +6675 β†’ streamer-username (xxx points) - Reason: PREDICTION.
%d/%m %H:%M:%S - πŸ“Š  EventPrediction: Please star this repo - Result: WIN, Points won: 6675
%d/%m %H:%M:%S - πŸš€  +12 β†’ streamer-username (xxx points) - Reason: WATCH.
%d/%m %H:%M:%S - πŸš€  +12 β†’ streamer-username (xxx points) - Reason: WATCH.
%d/%m %H:%M:%S - πŸš€  +60 β†’ streamer-username (xxx points) - Reason: CLAIM.
%d/%m %H:%M:%S - πŸš€  +12 β†’ streamer-username (xxx points) - Reason: WATCH.
%d/%m %H:%M:%S - πŸš€  +400 β†’ streamer-username (xxx points) - Reason: WATCH_STREAK.
%d/%m %H:%M:%S - πŸš€  +60 β†’ streamer-username (xxx points) - Reason: CLAIM.
%d/%m %H:%M:%S - πŸš€  +12 β†’ streamer-username (xxx points) - Reason: WATCH.
%d/%m %H:%M:%S - 🎭  Joining raid from streamer-username (xxx points) to another-username!
%d/%m %H:%M:%S - πŸš€  +250 β†’ streamer-username (xxx points) - Reason: RAID.

Final report:

%d/%m/%y %H:%M:%S - πŸ›‘  End session 'f738d438-cdbc-4cd5-90c4-1517576f1299'
%d/%m/%y %H:%M:%S - πŸ“„  Logs file: /.../path/Twitch-Channel-Points-Miner-v2/logs/username.timestamp.log
%d/%m/%y %H:%M:%S - βŒ›  Duration 10:29:19.547371

%d/%m/%y %H:%M:%S - πŸ“Š  BetSettings(Strategy=Strategy.SMART, Percentage=7, PercentageGap=20, MaxPoints=7500
%d/%m/%y %H:%M:%S - πŸ“Š  EventPrediction(event_id=xxxx-xxxx-xxxx-xxxx, title="Event Title1")
		Streamer(username=streamer-username, channel_id=0000000, channel_points=67247)
		Bet(TotalUsers=1k, TotalPoints=11M), Decision={'choice': 'B', 'amount': 5289, 'id': 'xxxx-yyyy-zzzz'})
		Outcome0(YES (BLUE) Points: 7M, Users: 641 (58.49%), Odds: 1.6, (5}%)
		Outcome1(NO (PINK),Points: 4M, Users: 455 (41.51%), Odds: 2.65 (37.74%))
		Result: {'type': 'LOSE', 'won': 0}
%d/%m/%y %H:%M:%S - πŸ“Š  EventPrediction(event_id=yyyy-yyyy-yyyy-yyyy, title="Event Title2")
		Streamer(username=streamer-username, channel_id=0000000, channel_points=3453464)
		Bet(TotalUsers=921, TotalPoints=11M), Decision={'choice': 'A', 'amount': 4926, 'id': 'xxxx-yyyy-zzzz'})
		Outcome0(YES (BLUE) Points: 9M, Users: 562 (61.02%), Odds: 1.31 (76.34%))
		Outcome1(YES (PINK) Points: 3M, Users: 359 (38.98%), Odds: 4.21 (23.75%))
		Result: {'type': 'WIN', 'won': 6531}
%d/%m/%y %H:%M:%S - πŸ“Š  EventPrediction(event_id=ad152117-251b-4666-b683-18e5390e56c3, title="Event Title3")
		Streamer(username=streamer-username, channel_id=0000000, channel_points=45645645)
		Bet(TotalUsers=260, TotalPoints=3M), Decision={'choice': 'A', 'amount': 5054, 'id': 'xxxx-yyyy-zzzz'})
		Outcome0(YES (BLUE) Points: 689k, Users: 114 (43.85%), Odds: 4.24 (23.58%))
		Outcome1(NO (PINK) Points: 2M, Users: 146 (56.15%), Odds: 1.31 (76.34%))
		Result: {'type': 'LOSE', 'won': 0}

%d/%m/%y %H:%M:%S - πŸ€–  Streamer(username=streamer-username, channel_id=0000000, channel_points=67247), Total points gained (after farming - before farming): -7838
%d/%m/%y %H:%M:%S - πŸ’°  CLAIM(11 times, 550 gained), PREDICTION(1 times, 6531 gained), WATCH(35 times, 350 gained)
%d/%m/%y %H:%M:%S - πŸ€–  Streamer(username=streamer-username2, channel_id=0000000, channel_points=61365), Total points gained (after farming - before farming): 977
%d/%m/%y %H:%M:%S - πŸ’°  CLAIM(4 times, 240 gained), REFUND(1 times, 605 gained), WATCH(11 times, 132 gained)
%d/%m/%y %H:%M:%S - πŸ€–  Streamer(username=streamer-username5, channel_id=0000000, channel_points=25960), Total points gained (after farming - before farming): 1680
%d/%m/%y %H:%M:%S - πŸ’°  CLAIM(17 times, 850 gained), WATCH(53 times, 530 gained)
%d/%m/%y %H:%M:%S - πŸ€–  Streamer(username=streamer-username6, channel_id=0000000, channel_points=9430), Total points gained (after farming - before farming): 1120
%d/%m/%y %H:%M:%S - πŸ’°  CLAIM(14 times, 700 gained), WATCH(42 times, 420 gained), WATCH_STREAK(1 times, 450 gained)

How to use:

First of all please create a run.py file. You can just copy example.py and modify it according to your needs.

# -*- coding: utf-8 -*-

import logging
from colorama import Fore
from TwitchChannelPointsMiner import TwitchChannelPointsMiner
from TwitchChannelPointsMiner.logger import LoggerSettings, ColorPalette
from TwitchChannelPointsMiner.classes.Chat import ChatPresence
from TwitchChannelPointsMiner.classes.Discord import Discord
from TwitchChannelPointsMiner.classes.Webhook import Webhook
from TwitchChannelPointsMiner.classes.Telegram import Telegram
from TwitchChannelPointsMiner.classes.Settings import Priority, Events, FollowersOrder
from TwitchChannelPointsMiner.classes.entities.Bet import Strategy, BetSettings, Condition, OutcomeKeys, FilterCondition, DelayMode
from TwitchChannelPointsMiner.classes.entities.Streamer import Streamer, StreamerSettings

twitch_miner = TwitchChannelPointsMiner(
    username="your-twitch-username",
    password="write-your-secure-psw",           # If no password will be provided, the script will ask interactively
    claim_drops_startup=False,                  # If you want to auto claim all drops from Twitch inventory on the startup
    priority=[                                  # Custom priority in this case for example:
        Priority.STREAK,                        # - We want first of all to catch all watch streak from all streamers
        Priority.DROPS,                         # - When we don't have anymore watch streak to catch, wait until all drops are collected over the streamers
        Priority.ORDER                          # - When we have all of the drops claimed and no watch-streak available, use the order priority (POINTS_ASCENDING, POINTS_DESCENDING)
    ],
    enable_analytics=False,			# Disables Analytics if False. Disabling it significantly reduces memory consumption
    disable_ssl_cert_verification=False,	# Set to True at your own risk and only to fix SSL: CERTIFICATE_VERIFY_FAILED error
    disable_at_in_nickname=False,               # Set to True if you want to check for your nickname mentions in the chat even without @ sign
    logger_settings=LoggerSettings(
        save=True,                              # If you want to save logs in a file (suggested)
        console_level=logging.INFO,             # Level of logs - use logging.DEBUG for more info
        console_username=False,                 # Adds a username to every console log line if True. Also adds it to Telegram, Discord, etc. Useful when you have several accounts
        auto_clear=True,                        # Create a file rotation handler with interval = 1D and backupCount = 7 if True (default)
        time_zone="",                           # Set a specific time zone for console and file loggers. Use tz database names. Example: "America/Denver"
        file_level=logging.DEBUG,               # Level of logs - If you think the log file it's too big, use logging.INFO
        emoji=True,                             # On Windows, we have a problem printing emoji. Set to false if you have a problem
        less=False,                             # If you think that the logs are too verbose, set this to True
        colored=True,                           # If you want to print colored text
        color_palette=ColorPalette(             # You can also create a custom palette color (for the common message).
            STREAMER_online="GREEN",            # Don't worry about lower/upper case. The script will parse all the values.
            streamer_offline="red",             # Read more in README.md
            BET_wiN=Fore.MAGENTA                # Color allowed are: [BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET].
        ),
        telegram=Telegram(                                                          # You can omit or set to None if you don't want to receive updates on Telegram
            chat_id=123456789,                                                      # Chat ID to send messages @getmyid_bot
            token="123456789:shfuihreuifheuifhiu34578347",                          # Telegram API token @BotFather
            events=[Events.STREAMER_ONLINE, Events.STREAMER_OFFLINE,
                    Events.BET_LOSE, Events.CHAT_MENTION],                          # Only these events will be sent to the chat
            disable_notification=True,                                              # Revoke the notification (sound/vibration)
        ),
        discord=Discord(
            webhook_api="https://discord.com/api/webhooks/0123456789/0a1B2c3D4e5F6g7H8i9J",  # Discord Webhook URL
            events=[Events.STREAMER_ONLINE, Events.STREAMER_OFFLINE,
                    Events.BET_LOSE, Events.CHAT_MENTION],					                         # Only these events will be sent to the chat
        ),
        webhook=Webhook(
            endpoint="https://example.com/webhook",                                                                    # Webhook URL
            method="GET",                                                                   # GET or POST
            events=[Events.STREAMER_ONLINE, Events.STREAMER_OFFLINE,
                    Events.BET_LOSE, Events.CHAT_MENTION],                                  # Only these events will be sent to the endpoint
        ),
        matrix=Matrix(
            username="twitch_miner",                                                   # Matrix username (without homeserver)
            password="...",                                                            # Matrix password
            homeserver="matrix.org",                                                   # Matrix homeserver
            room_id="...",                                                             # Room ID
            events=[Events.STREAMER_ONLINE, Events.STREAMER_OFFLINE, Events.BET_LOSE], # Only these events will be sent
        ),
        pushover=Pushover(
            userkey="YOUR-ACCOUNT-TOKEN",                                             # Login to https://pushover.net/, the user token is on the main page
            token="YOUR-APPLICATION-TOKEN",                                           # Create a application on the website, and use the token shown in your application
            priority=0,                                                               # Read more about priority here: https://pushover.net/api#priority
            sound="pushover",                                                         # A list of sounds can be found here: https://pushover.net/api#sounds
            events=[Events.CHAT_MENTION, Events.DROP_CLAIM],                          # Only these events will be sent
        )
    ),
    streamer_settings=StreamerSettings(
        make_predictions=True,                  # If you want to Bet / Make prediction
        follow_raid=True,                       # Follow raid to obtain more points
        claim_drops=True,                       # We can't filter rewards base on stream. Set to False for skip viewing counter increase and you will never obtain a drop reward from this script. Issue #21
	claim_moments=True,                     # If set to True, https://help.twitch.tv/s/article/moments will be claimed when available
        watch_streak=True,                      # If a streamer go online change the priority of streamers array and catch the watch screak. Issue #11
        chat=ChatPresence.ONLINE,               # Join irc chat to increase watch-time [ALWAYS, NEVER, ONLINE, OFFLINE]
        bet=BetSettings(
            strategy=Strategy.SMART,            # Choose you strategy!
            percentage=5,                       # Place the x% of your channel points
            percentage_gap=20,                  # Gap difference between outcomesA and outcomesB (for SMART strategy)
            max_points=50000,                   # If the x percentage of your channel points is gt bet_max_points set this value
            stealth_mode=True,                  # If the calculated amount of channel points is GT the highest bet, place the highest value minus 1-2 points Issue #33
            delay_mode=DelayMode.FROM_END,      # When placing a bet, we will wait until `delay` seconds before the end of the timer
            delay=6,
            minimum_points=20000,               # Place the bet only if we have at least 20k points. Issue #113
            filter_condition=FilterCondition(
                by=OutcomeKeys.TOTAL_USERS,     # Where apply the filter. Allowed [PERCENTAGE_USERS, ODDS_PERCENTAGE, ODDS, TOP_POINTS, TOTAL_USERS, TOTAL_POINTS]
                where=Condition.LTE,            # 'by' must be [GT, LT, GTE, LTE] than value
                value=800
            )
        )
    )
)

# You can customize the settings for each streamer. If not settings were provided, the script would use the streamer_settings from TwitchChannelPointsMiner.
# If no streamer_settings are provided in TwitchChannelPointsMiner the script will use default settings.
# The streamers array can be a String -> username or Streamer instance.

# The settings priority are: settings in mine function, settings in TwitchChannelPointsMiner instance, default settings.
# For example, if in the mine function you don't provide any value for 'make_prediction' but you have set it on TwitchChannelPointsMiner instance, the script will take the value from here.
# If you haven't set any value even in the instance the default one will be used

#twitch_miner.analytics(host="127.0.0.1", port=5000, refresh=5, days_ago=7)   # Start the Analytics web-server (replit: host="0.0.0.0")

twitch_miner.mine(
    [
        Streamer("streamer-username01", settings=StreamerSettings(make_predictions=True  , follow_raid=False , claim_drops=True  , watch_streak=True , bet=BetSettings(strategy=Strategy.SMART      , percentage=5 , stealth_mode=True,  percentage_gap=20 , max_points=234   , filter_condition=FilterCondition(by=OutcomeKeys.TOTAL_USERS,      where=Condition.LTE, value=800 ) ) )),
        Streamer("streamer-username02", settings=StreamerSettings(make_predictions=False , follow_raid=True  , claim_drops=False ,                     bet=BetSettings(strategy=Strategy.PERCENTAGE , percentage=5 , stealth_mode=False, percentage_gap=20 , max_points=1234  , filter_condition=FilterCondition(by=OutcomeKeys.TOTAL_POINTS,     where=Condition.GTE, value=250 ) ) )),
        Streamer("streamer-username03", settings=StreamerSettings(make_predictions=True  , follow_raid=False ,                     watch_streak=True , bet=BetSettings(strategy=Strategy.SMART      , percentage=5 , stealth_mode=False, percentage_gap=30 , max_points=50000 , filter_condition=FilterCondition(by=OutcomeKeys.ODDS,             where=Condition.LT,  value=300 ) ) )),
        Streamer("streamer-username04", settings=StreamerSettings(make_predictions=False , follow_raid=True  ,                     watch_streak=True                                                                                                                                                                                                                                 )),
        Streamer("streamer-username05", settings=StreamerSettings(make_predictions=True  , follow_raid=True  , claim_drops=True ,  watch_streak=True , bet=BetSettings(strategy=Strategy.HIGH_ODDS  , percentage=7 , stealth_mode=True,  percentage_gap=20 , max_points=90    , filter_condition=FilterCondition(by=OutcomeKeys.PERCENTAGE_USERS, where=Condition.GTE, value=300 ) ) )),
        Streamer("streamer-username06"),
        Streamer("streamer-username07"),
        Streamer("streamer-username08"),
        "streamer-username09",
        "streamer-username10",
        "streamer-username11"
    ],                                  # Array of streamers (order = priority)
    followers=False,                    # Automatic download the list of your followers
    followers_order=FollowersOrder.ASC  # Sort the followers list by follow date. ASC or DESC
)

You can also use all the default values except for your username obv. Short version:

from TwitchChannelPointsMiner import TwitchChannelPointsMiner
from TwitchChannelPointsMiner.classes.Settings import FollowersOrder
twitch_miner = TwitchChannelPointsMiner("your-twitch-username")
twitch_miner.mine(["streamer1", "streamer2"])                                                       # Array of streamers OR
twitch_miner.mine(followers=True, followers_order=FollowersOrder.ASC)                               # Automatic use the followers list OR
twitch_miner.mine(["streamer1", "streamer2"], followers=True, followers_order=FollowersOrder.DESC)  # Mixed

If you follow so many streamers on Twitch, but you don't want to mine points for all of them, you can blacklist the users with the blacklist keyword. #94

from TwitchChannelPointsMiner import TwitchChannelPointsMiner
twitch_miner = TwitchChannelPointsMiner("your-twitch-username")
twitch_miner.mine(followers=True, blacklist=["user1", "user2"])  # Blacklist example

By cloning the repository

  1. Clone this repository git clone https://github.com/rdavydov/Twitch-Channel-Points-Miner-v2
  2. Install all the requirements pip install -r requirements.txt . If you have problems with requirements, make sure to have at least Python3.6. You could also try to create a virtualenv and then install all the requirements
pip install virtualenv
virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt

Start mining! python run.py πŸ₯³

Docker

Docker Hub

Official Docker images are on https://hub.docker.com/r/rdavidoff/twitch-channel-points-miner-v2 for linux/amd64, linux/arm64 and linux/arm/v7.

The following file is mounted :

  • run.py : this is your starter script with your configuration

These folders are mounted :

  • analytics : to save the analytics data
  • cookies : to provide login information
  • logs : to keep logs outside of container

Example using docker-compose:

version: "3.9"

services:
  miner:
    image: rdavidoff/twitch-channel-points-miner-v2
    stdin_open: true
    tty: true
    environment:
      - TERM=xterm-256color
    volumes:
      - ./analytics:/usr/src/app/analytics
      - ./cookies:/usr/src/app/cookies
      - ./logs:/usr/src/app/logs
      - ./run.py:/usr/src/app/run.py:ro
    ports:
      - "5000:5000"

Example with docker run:

docker run \
    -v $(pwd)/analytics:/usr/src/app/analytics \
    -v $(pwd)/cookies:/usr/src/app/cookies \
    -v $(pwd)/logs:/usr/src/app/logs \
    -v $(pwd)/run.py:/usr/src/app/run.py:ro \
    -p 5000:5000 \
    rdavidoff/twitch-channel-points-miner-v2

$(pwd) Could not work on Windows (cmd), please use the absolute path instead, like: /path/of/your/cookies:/usr/src/app/cookies.

The correct solution for Windows lies in the correct command line: docker run -v C:\Absolute\Path\To\Twitch-Channel-Points-Miner-v2\run.py:/usr/src/app/run.py:ro rdavidoff/twitch-channel-points-miner-v2.

run.py MUST be mounted as a volume (-v).

If you don't mount the volume for the analytics (or cookies or logs) folder, the folder will be automatically created on the Docker container, and you will lose all the data when it is stopped.

If you don't have a cookie or it's your first time running the script, you will need to login to Twitch and start the container with -it args. If you need to run multiple containers you can bind different ports (only if you need also the analytics) and mount dirrent run.py file, like

docker run --name user1 -v $(pwd)/user1.py:/usr/src/app/run.py:ro -p 5001:5000 rdavidoff/twitch-channel-points-miner-v2
docker run --name user2 -v $(pwd)/user2.py:/usr/src/app/run.py:ro -p 5002:5000 rdavidoff/twitch-channel-points-miner-v2

Portainer

Link to the illustrated guide on how to deploy a Docker container in Portainer.

Replit

Official Repl: https://replit.com/@rdavydov/Twitch-Channel-Points-Miner-v2

Provided "as is" with no support. Testing purposes only. Updates may be delayed.

Limits

Twitch has a limit - you can't watch more than two channels at one time. We take the first two streamers from the list as they have the highest priority.

Make sure to write the streamers array in order of priority from left to right. If you use followers=True you can choose to download the followers sorted by follow date (ASC or DESC).

Settings

Most of the settings are self-explained and are commented on in the example. You can watch only two streamers per time. With priority settings, you can select which streamers watch by use priority. You can use an array of priority or single item. I suggest using at least one priority from ORDER, POINTS_ASCENDING, POINTS_DESCENDING because, for example, If you set only STREAK after catch all watch streak, the script will stop to watch streamers. Available values are the following:

  • STREAK - Catch the watch streak from all streamers
  • DROPS - Claim all drops from streamers with drops tags enabled
  • SUBSCRIBED - Prioritize streamers you're subscribed to (higher subscription tiers are mined first)
  • ORDER - Following the order of the list
  • POINTS_ASCENDING - On top the streamers with the lowest points
  • POINTS_DESCENDING - On top the streamers with the highest points

You can combine all priority but keep in mind that use ORDER and POINTS_ASCENDING in the same settings doesn't make sense.

LoggerSettings

Key Type Default Description
save bool True If you want to save logs in file (suggested)
less bool False Reduce the logging format and message verbosity #10
console_level level logging.INFO Level of logs in terminal - Use logging.DEBUG for more helpful messages.
console_username bool False Adds a username to every log line in the console if True. #602
time_zone str None Set a specific time zone for console and file loggers. Use tz database names. Example: "America/Denver" #205
file_level level logging.DEBUG Level of logs in file save - If you think the log file it's too big, use logging.INFO
emoji bool For Windows is False else True On Windows, we have a problem printing emoji. Set to false if you have a problem
colored bool True If you want to print colored text #45 #82
auto_clear bool True Create a file rotation handler with interval = 1D and backupCount = 7 #215
color_palette ColorPalette All messages are Fore.RESET except WIN and LOSE bet (GREEN and RED) Create your custom color palette. Read more above.
telegram Telegram None (Optional) Receive Telegram updates for multiple events list #233
discord Discord None (Optional) Receive Discord updates for multiple events list #320

Color Palette

Now you can customize the color of the terminal message. We have created a default ColorPalette that provide all the message with DEFAULT (RESET) color and the BET_WIN and BET_LOSE message GREEN and RED respectively. You can change the colors of all Events enum class. The colors allowed are all the Fore color from Colorama: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET. The script was developed to handle all the human error, lower-case upper case and more, but I want to suggest using the following code-style

from colorama import Fore
ColorPalette(
    STREAMER_ONLINE = Fore.GREEN,
    STREAMER_OFFLINE = Fore.RED,
    GAIN_FOR_RAID = Fore.YELLOW,
    GAIN_FOR_CLAIM = Fore.YELLOW,
    GAIN_FOR_WATCH = Fore.YELLOW,
    GAIN_FOR_WATCH_STREAK = Fore.YELLOW,
    BET_WIN = Fore.GREEN,
    BET_LOSE = Fore.RED,
    BET_REFUND = Fore.RESET,
    BET_FILTERS = Fore.MAGENTA,
    BET_GENERAL = Fore.BLUE,
    BET_FAILED = Fore.RED,
)

Telegram

If you want to receive logs update on Telegram, initiate a new Telegram class, else omit this parameter or set as None.

  1. Create a bot with @BotFather
  2. Get you chat_id with @getmyid_bot
Key Type Default Description
chat_id int Chat ID to send messages @getmyid_bot
token string Telegram API token @BotFather
events list Only these events will be sent to the chat. Array of Event. or str
disable_notification bool false Revoke the notification (sound/vibration)
Telegram(
    chat_id=123456789,
    token="123456789:shfuihreuifheuifhiu34578347",
    events=[Events.STREAMER_ONLINE, Events.STREAMER_OFFLINE,
                    Events.BET_LOSE, Events.CHAT_MENTION],
    disable_notification=True,
)

Discord

If you want to receive log updates on Discord initialize a new Discord class, else leave omit this parameter or set it as None YT Video

  1. Go to the Server you want to receive updates
  2. Click "Edit Channel"
  3. Click "Integrations"
  4. Click "Webhooks"
  5. Click "New Webhook"
  6. Name it if you want
  7. Click on "Copy Webhook URL"
Key Type Default Description
webhook_api string Discord webhook URL
events list Only these events will be sent to the chat. Array of Event. or str
Discord(
   webhook_api="https://discord.com/api/webhooks/0123456789/0a1B2c3D4e5F6g7H8i9J",
   events=[Events.STREAMER_ONLINE, Events.STREAMER_OFFLINE,
                    Events.BET_LOSE, Events.CHAT_MENTION],
)

Generic Webhook

You can use generic webhook

Key Type Default Description
endpoint string webhook url
method string POST or GET
events list Only these events will be sent to the endpoint. Array of Event. or str
Webhook(
   endpoint="https://example.com/webhook",
   method="GET",
   events=[Events.STREAMER_ONLINE, Events.STREAMER_OFFLINE,
                    Events.BET_LOSE, Events.CHAT_MENTION],
)

Events

  • STREAMER_ONLINE
  • STREAMER_OFFLINE
  • GAIN_FOR_RAID
  • GAIN_FOR_CLAIM
  • GAIN_FOR_WATCH
  • BET_WIN
  • BET_LOSE
  • BET_REFUND
  • BET_FILTERS
  • BET_GENERAL
  • BET_FAILED
  • BET_START
  • BONUS_CLAIM
  • MOMENT_CLAIM
  • JOIN_RAID
  • DROP_CLAIM
  • DROP_STATUS
  • CHAT_MENTION

StreamerSettings

Key Type Default Description
make_predictions bool True Choose if you want to make predictions / bet or not
follow_raid bool True Choose if you want to follow raid +250 points
claim_drops bool True If this value is True, the script will increase the watch-time for the current game. With this, you can claim the drops from Twitch Inventory #21
claim_moments bool True If set to True, moments will be claimed when available
watch_streak bool True Choose if you want to change a priority for these streamers and try to catch the Watch Streak event #11
bet BetSettings Rules to follow for the bet
chat ChatPresence ONLINE Join IRC-Chat to appear online in chat and attempt to get StreamElements channel points and increase view-time #47

Allowed values for chat are:

  • ALWAYS Join in IRC chat and never leave
  • NEVER Never join IRC chat
  • ONLINE Partecipate to IRC chat if the streamer is online (leave if offline)
  • OFFLINE Partecipate to IRC chat if the streamer is offline (leave if online)

BetSettings

Key Type Default Description
strategy Strategy SMART Choose your strategy! See below for more info
percentage int 5 Place the x% of your channel points
percentage_gap int 20 Gap difference between outcomesA and outcomesB (for SMART stragegy)
max_points int 50000 If the x percentage of your channel points is GT bet_max_points set this value
stealth_mode bool False If the calculated amount of channel points is GT the highest bet, place the highest value minus 1-2 points #33
delay_mode DelayMode FROM_END Define how is calculating the waiting time before placing a bet
delay float 6 Value to be used to calculate bet delay depending on delay_mode value

Bet strategy

  • MOST_VOTED: Select the option most voted based on users count
  • HIGH_ODDS: Select the option with the highest odds
  • PERCENTAGE: Select the option with the highest percentage based on odds (It's the same that show Twitch) - Should be the same as select LOWEST_ODDS
  • SMART_MONEY: Select the option with the highest points placed. #331
  • SMART: If the majority in percent chose an option, then follow the other users, otherwise select the option with the highest odds
  • NUMBER_1: Always select the 1st option, BLUE side if there are only two options
  • NUMBER_2: Always select the 2nd option, PINK side if there are only two options
  • NUMBER_3: Always select the 3rd option
  • NUMBER_4: Always select the 4th option
  • NUMBER_5: Always select the 5th option
  • NUMBER_6: Always select the 6th option
  • NUMBER_7: Always select the 7th option
  • NUMBER_8: Always select the 8th option

Screenshot

Here a concrete example:

  • MOST_VOTED: 21 Users have select 'over 7.5', instead of 9 'under 7.5'
  • HIGH_ODDS: The highest odd is 2.27 on 'over 7.5' vs 1.79 on 'under 7.5'
  • PERCENTAGE: The highest percentage is 56% for 'under 7.5'
  • SMART: Calculate the percentage based on the users. The percentages are: 'over 7.5': 70% and 'under 7.5': 30%. If the difference between the two percentages is higher than percentage_gap select the highest percentage, else the highest odds.

In this case if percentage_gap = 20 ; 70-30 = 40 > percentage_gap, so the bot will select 'over 7.5'

FilterCondition

Key Type Default Description
by OutcomeKeys None Key to apply the filter
where Condition None Condition that should match for place bet
value number None Value to compare

Allowed values for by are:

  • PERCENTAGE_USERS (no sum) [Would never want a sum as it'd always be 100%]
  • ODDS_PERCENTAGE (no sum) [Doesn't make sense to sum odds]
  • ODDS (no sum) [Doesn't make sense to sum odds]
  • DECISION_USERS (no sum)
  • DECISION_POINTS (no sum)
  • TOP_POINTS (no sum) [Doesn't make sense to the top points of both sides]
  • TOTAL_USERS (sum)
  • TOTAL_POINTS (sum)

Allowed values for where are: GT, LT, GTE, LTE

Example

  • If you want to place the bet ONLY if the total of users participants in the bet is greater than 200 FilterCondition(by=OutcomeKeys.TOTAL_USERS, where=Condition.GT, value=200)
  • If you want to place the bet ONLY if the winning odd of your decision is greater than or equal to 1.3 FilterCondition(by=OutcomeKeys.ODDS, where=Condition.GTE, value=1.3)
  • If you want to place the bet ONLY if the highest bet is lower than 2000 FilterCondition(by=OutcomeKeys.TOP_POINTS, where=Condition.LT, value=2000)

DelayMode

  • FROM_START: Will wait delay seconds from when the bet was opened
  • FROM_END: Will until there is delay seconds left to place the bet
  • PERCENTAGE: Will place the bet when delay percent of the set timer is elapsed

Here's a concrete example. Let's suppose we have a bet that is opened with a timer of 10 minutes:

  • FROM_START with delay=20: The bet will be placed 20s after the bet is opened
  • FROM_END with delay=20: The bet will be placed 20s before the end of the bet (so 9mins 40s after the bet is opened)
  • PERCENTAGE with delay=0.2: The bet will be placed when the timer went down by 20% (so 2mins after the bet is opened)

Analytics

We have recently introduced a little frontend where you can show with a chart you points trend. The script will spawn a Flask web-server on your machine where you can select binding address and port. The chart provides some annotation to handle the prediction and watch strike events. Usually annotation are used to notice big increase / decrease of points. If you want to can disable annotations. On each (x, y) points Its present a tooltip that show points, date time and reason of points gained / lost. This web page was just a funny idea, and it is not intended to use for a professional usage. If you want you can toggle the dark theme with the dedicated checkbox.

Light theme Dark theme
Light theme Dark theme

For use this feature just call the analytics() method before start mining. Read more at: #96 The chart will be autofreshed each refresh minutes. If you want to connect from one to second machine that have that webpanel you have to use 0.0.0.0 instead of 127.0.0.1. With the days_ago arg you can select how many days you want to show by default in your analytics graph.

from TwitchChannelPointsMiner import TwitchChannelPointsMiner
twitch_miner = TwitchChannelPointsMiner("your-twitch-username")
twitch_miner.analytics(host="127.0.0.1", port=5000, refresh=5, days_ago=7)   # Analytics web-server
twitch_miner.mine(followers=True, blacklist=["user1", "user2"])

enable_analytics option in twitch_minerfile toggles Analytics needed for the analytics() method

Disabling Analytics significantly reduces memory consumption and saves some disk space by not creating and writing /analytics/*.json.

Set this option to True if you need Analytics. Otherwise set this option to False (default value).

Migrating from an old repository (the original one):

If you already have a twitch-cookies.pkl and you don't want to log in again, please create a cookies/ folder in the current directory and then copy the .pkl file with a new name your-twitch-username.pkl

.
+-- run.py
+-- cookies
|   +-- your-twitch-username.pkl

Windows

Other users have find multiple problems on Windows. Suggestions are:

  • Stop using Windows 😝
  • Suppress the emoji in logs with logger_settings=LoggerSettings(emoji=False)

Other useful info can be found here:

You can also follow this video tutorial.

Termux

1. Upgrade packages

pkg upgrade

2. Install packages to Termux

pkg install python git rust libjpeg-turbo libcrypt ndk-sysroot clang zlib binutils tur-repo
LDFLAGS="-L${PREFIX}/lib/" CFLAGS="-I${PREFIX}/include/" pip install --upgrade wheel pillow

Note: pkg install tur-repo will basically enable the user repository (Very similar to Arch AUR) and python-pandas pre-compiled package comes exactly from this repository.

3. Install pandas

pkg install python-pandas

4. Clone this repository

git clone https://github.com/rdavydov/Twitch-Channel-Points-Miner-v2

5. Go to the miner's directory

cd Twitch-Channel-Points-Miner-v2

6. Configure your miner on your preferences by typing

nano example.py

7. Rename file name (optional)

mv example.py run.py

8. Install packages

pip install -r requirements.txt
pip install Twitch-Channel-Points-Miner-v2

9. Run the miner!

python run.py

Read more at #92 #76

Note

If you can't install cryptography, please try:

export RUSTFLAGS=" -C lto=no" && export CARGO_BUILD_TARGET="$(rustc -vV | sed -n 's|host: ||p')" && pip install cryptography

⚠️ Installation of pandas, maturin and cryptography takes a long time.

Disclaimer

This project comes with no guarantee or warranty. You are responsible for whatever happens from using this project. It is possible to get soft or hard banned by using this project if you are not careful. This is a personal project and is in no way affiliated with Twitch.

twitch-channel-points-miner-v2's People

Contributors

actions-user avatar anoviel avatar antipatico avatar bossoq avatar bpnordin avatar caterpyowo avatar chowder avatar dennis-mulder avatar dependabot[bot] avatar element21 avatar gottagofaster236 avatar honomoa avatar jonny-gm avatar nahsystemu avatar najager avatar njallam avatar noxrare avatar prograstinator avatar rakambda avatar rdavydov avatar shimadananaki avatar signko avatar silentguy256 avatar spencer-0003 avatar tipicodev avatar tkd-alex avatar vil-s avatar vojtak42 avatar wendyliga avatar zacholade avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twitch-channel-points-miner-v2's Issues

Handle error 5023 as a temporary ban from Twitch

Inspired by #46

test Python 3.11.0-amd64 / latest updates The old account from previously received cookie works fine.

TODO:

  • handle this error and inform user
  • suggest waiting 24 hours till they lift the ban from the account

can I use an old version?

Can I use the 1.34 version instead of the new one? I don't really trust the fact that I need to log in from a browser, or is it safe to use this bot without getting banned even when I log in from chrome and not from the bot itself?

Replit

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

AttributeError: type object 'Settings' has no attribute 'analytics_path'

Describe the bug
After an event prediction the Python Traceback is thrown:

23/11/22 16:49:43 - INFO - [on_message]: β–’  +35486 β–’ Streamer(username=sneakylol, channel_id=24538518, channel_points=505.86k) - Reason: PREDICTION.
23/11/22 16:49:43 - INFO - [on_message]: β–’  EventPrediction(event_id=1c5e4751-dc68-4e77-9e1b-48344ab56965, streamer=Streamer(username=sneakylol, channel_id=24538518, channel_points=505.86k), title=win losed) - Decision: A: win (BLUE) - Result: WIN, Gained: +10.74k
23/11/22 16:49:43 - ERROR - [on_message]: Exception raised for topic: predictions-user-v1 and message: {'type': 'prediction-result', 'data': {'timestamp': '2022-11-23T15:49:43.801462104Z', 'prediction': {'id': '9c79201e3cc8e897850903447df52d718cf83349a99b89f56f858569cf5d04b6', 'event_id': '1c5e4751-dc68-4e77-9e1b-48344ab56965', 'outcome_id': '8b6de5e2-b5f4-4ad3-a03b-909a4fbff05b', 'channel_id': '24538518', 'points': 24748, 'predicted_at': '2022-11-23T14:57:56.405231894Z', 'updated_at': '2022-11-23T15:49:43.79642088Z', 'user_id': '52606759', 'result': {'type': 'WIN', 'points_won': 35486, 'is_acknowledged': False}, 'user_display_name': None}}}
Traceback (most recent call last):
  File "Twitch-Channel-Points-Miner-v2/TwitchChannelPointsMiner/classes/WebSocketsPool.py", line 364, in on_message
    ws.streamers[streamer_index].persistent_annotations(
  File "Twitch-Channel-Points-Miner-v2/TwitchChannelPointsMiner/classes/entities/Streamer.py", line 219, in persistent_annotations
    self.__save_json("annotations", data)
  File "Twitch-Channel-Points-Miner-v2/TwitchChannelPointsMiner/classes/entities/Streamer.py", line 234, in __save_json
    fname = os.path.join(Settings.analytics_path, f"{self.username}.json")
AttributeError: type object 'Settings' has no attribute 'analytics_path'

To Reproduce
Steps to reproduce the behavior:

  1. Clone git
  2. add credentials to example.py
  3. change some settings in the example.py (for example Streamer Order)

Expected behavior
Not to thow the excetption

Desktop (please complete the following information):

  • OS: Linux 64bit (4.15.0-167-generic)
  • Python version 3.8.5

Log
is there the hole log needed?
Relevant Console Output is shown in the top section, if you need more logs I can provide them.

All Other
Thanks for you great work!

Can't get "CLAIM" points (50pts)

Expected behavior
Only points for watch (Reason: WATCH.) appears on console
Miner won't get clain point (Reason: CLAIM.) automatically

Desktop (please complete the following information):

  • OS: Windows
  • Python version 3

Bot sending messages?

So I am using this bot for a day now and I got banned from multiply streamers that were on the list, I didn't touch twitch at all when I got banned, my question is: is it possible that the bot sending auto messages from my account? or is it something with my account that I need to fix?

error notification

I want to be able to receive a notification in discord or telegram when the script throws any error to restart the script

Auto 2FA

I'm always frustrated when i forgot about the Miner and lost multiple hours because it restartet and wanted a new 2FA code

There is a Library called pyotp i used wayback for my bot.
There you can give it your secret and it can generate the 2fa code on its own.
You would need to extract the code from the QR-Code when setting up 2fa but thats doable

Dockerfile expose port 5000

Hi,

I want to use traefik to expose the service of my vps. But in your dockerfile you don't expose port 5000.

Can you expose this port by default to avoid overloading the dockerfile and use it?

Problem with logging in maybe?

Screenshot_20221029-123428
Screenshot_20221029-123435
On termux
Even when I have my login info in the py it still says so. This is same issue that I posted in the other repo since don't know where to post it

Prediction

2022-11-02T09:01:10.950569+00:00 app[worker.1]: 02/11 09:01:10 - Going to complete bet for EventPrediction: xqc (36.2k points) - Who wins ???
2022-11-02T09:01:10.950813+00:00 app[worker.1]: 02/11 09:01:10 - Skip betting for the event EventPrediction: xqc (36.2k points) - Who wins ???
2022-11-02T09:01:10.950956+00:00 app[worker.1]: 02/11 09:01:10 - Skip settings FilterCondition(by=TOTAL_USERS, where=LTE, value=800), current value is: 1489

help with Docker

It would not be bad to make detailed instructions for those who do not know how to use Docker

Create Docker Container

Do you consider creating a runnable Docker container as currently from my understanding there is no way to run this in a Docker container.

Drops

It stopped collecting drops again it worked for a couple of days

Using docker newest miner version

If user has no Chrome installed

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.

Originally posted by @XaaRii in #15 (comment)

Raspberry Pi3b to slow for CAPTCHA

Hello Together
First of all, thank you for the exact project :)

Until Twitch changed the login 1.3.2 everything ran fine on my Raspberry Pi3b. Now you have to plug in yes with CAPTCHA certified, oke display installed and run the script.

Problem is that the Raspberry Pi3b takes a very long time to open Chromium Browser. Unfortunately the script then aborts the login attempt because the Chromium browser is not ready.
I think the problem is not with the script.

Does anyone have this problem too, is there a solution? Is it possible to extend the login timeout.

Best thanks in advance. :)

Here is the log for the sake of completeness.

python run.py 11/11/22 11:12:14 - INFO - [run]: πŸ’£ Start session: 'bcedefbf-c22a-4496-81a7-1ef3d8522234' 11/11/22 11:12:14 - INFO - [login_flow]: You'll have to login to Twitch! 11/11/22 11:12:15 - INFO - [login_flow]: Console login unavailable (CAPTCHA solving required). 11/11/22 11:12:18 - INFO - [login_flow_backup]: Now a browser window will open, it will login with your data. 11/11/22 11:12:20 - INFO - [patch_exe]: patching driver executable /home/pi/.local/share/undetected_chromedriver/6d16b5cb10291e5f_chromedriver Traceback (most recent call last): File "/home/pi/Twitch-Channel-Points-Miner-v2-1.4.1/run.py", line 86, in <module> twitch_miner.mine( File "/home/pi/Twitch-Channel-Points-Miner-v2-1.4.1/TwitchChannelPointsMiner/TwitchChannelPointsMiner.py", line 162, in mine self.run(streamers=streamers, blacklist=blacklist, followers=followers) File "/home/pi/Twitch-Channel-Points-Miner-v2-1.4.1/TwitchChannelPointsMiner/TwitchChannelPointsMiner.py", line 180, in run self.twitch.login() File "/home/pi/Twitch-Channel-Points-Miner-v2-1.4.1/TwitchChannelPointsMiner/classes/Twitch.py", line 87, in login if self.twitch_login.login_flow(): File "/home/pi/Twitch-Channel-Points-Miner-v2-1.4.1/TwitchChannelPointsMiner/classes/TwitchLogin.py", line 155, in login_flow self.set_token(self.login_flow_backup(password)) File "/home/pi/Twitch-Channel-Points-Miner-v2-1.4.1/TwitchChannelPointsMiner/classes/TwitchLogin.py", line 191, in login_flow_backup driver = uc.Chrome( File "/home/pi/.local/lib/python3.9/site-packages/seleniumwire/undetected_chromedriver/webdriver.py", line 61, in __init__ super().__init__(*args, **kwargs) File "/home/pi/.local/lib/python3.9/site-packages/undetected_chromedriver/__init__.py", line 409, in __init__ super(Chrome, self).__init__( File "/home/pi/.local/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__ super().__init__(DesiredCapabilities.CHROME['browserName'], "goog", File "/home/pi/.local/lib/python3.9/site-packages/selenium/webdriver/chromium/webdriver.py", line 89, in __init__ self.service.start() File "/home/pi/.local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 71, in start self.process = subprocess.Popen(cmd, env=self.env, File "/usr/lib/python3.9/subprocess.py", line 951, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 8] Exec format error: '/home/pi/.local/share/undetected_chromedriver/6d16b5cb10291e5f_chromedriver' --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.9/logging/handlers.py", line 1431, in emit self.enqueue(self.prepare(record)) File "/usr/lib/python3.9/logging/handlers.py", line 1416, in prepare record = copy.copy(record) File "/usr/lib/python3.9/copy.py", line 92, in copy rv = reductor(4) ImportError: sys.meta_path is None, Python is likely shutting down Call stack: File "/home/pi/.local/lib/python3.9/site-packages/undetected_chromedriver/__init__.py", line 657, in __del__ self.quit() File "/home/pi/.local/lib/python3.9/site-packages/seleniumwire/webdriver.py", line 68, in quit super().quit() File "/home/pi/.local/lib/python3.9/site-packages/undetected_chromedriver/__init__.py", line 608, in quit logger.debug("closing webdriver") Message: 'closing webdriver' Arguments: () --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.9/logging/handlers.py", line 1431, in emit self.enqueue(self.prepare(record)) File "/usr/lib/python3.9/logging/handlers.py", line 1416, in prepare record = copy.copy(record) File "/usr/lib/python3.9/copy.py", line 92, in copy rv = reductor(4) ImportError: sys.meta_path is None, Python is likely shutting down Call stack: File "/home/pi/.local/lib/python3.9/site-packages/undetected_chromedriver/__init__.py", line 657, in __del__ self.quit() File "/home/pi/.local/lib/python3.9/site-packages/seleniumwire/webdriver.py", line 68, in quit super().quit() File "/home/pi/.local/lib/python3.9/site-packages/undetected_chromedriver/__init__.py", line 618, in quit logger.debug("killing browser") Message: 'killing browser' Arguments: () --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.9/logging/handlers.py", line 1431, in emit self.enqueue(self.prepare(record)) File "/usr/lib/python3.9/logging/handlers.py", line 1416, in prepare record = copy.copy(record) File "/usr/lib/python3.9/copy.py", line 92, in copy rv = reductor(4) ImportError: sys.meta_path is None, Python is likely shutting down Call stack: File "/home/pi/.local/lib/python3.9/site-packages/undetected_chromedriver/__init__.py", line 657, in __del__ self.quit() File "/home/pi/.local/lib/python3.9/site-packages/seleniumwire/webdriver.py", line 68, in quit super().quit() File "/home/pi/.local/lib/python3.9/site-packages/undetected_chromedriver/__init__.py", line 643, in quit logger.debug("successfully removed %s" % self.user_data_dir) Message: 'successfully removed /tmp/tmpoeuw4_r_' Arguments: () --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.9/logging/handlers.py", line 1431, in emit self.enqueue(self.prepare(record)) File "/usr/lib/python3.9/logging/handlers.py", line 1416, in prepare record = copy.copy(record) File "/usr/lib/python3.9/copy.py", line 92, in copy rv = reductor(4) ImportError: sys.meta_path is None, Python is likely shutting down Call stack: File "/home/pi/.local/lib/python3.9/site-packages/undetected_chromedriver/__init__.py", line 657, in __del__ self.quit() File "/home/pi/.local/lib/python3.9/site-packages/seleniumwire/webdriver.py", line 68, in quit super().quit() File "/home/pi/.local/lib/python3.9/site-packages/undetected_chromedriver/__init__.py", line 649, in quit self.patcher = None File "/home/pi/.local/lib/python3.9/site-packages/undetected_chromedriver/patcher.py", line 270, in __del__ logger.debug("successfully unlinked %s" % self.executable_path) Message: 'successfully unlinked /home/pi/.local/share/undetected_chromedriver/6d16b5cb10291e5f_chromedriver' Arguments: ()

Originally posted by @spardas1981 in Tkd-Alex#648

Support for Kick.com

Describe alternatives you've considered
Kick.com uses twitch as base so maybe this can be forked or added to the miner

maybe this can be done easy because its 99.9% the same platform

thanks

ZeroDivisionError: division by zero

Hey,
me again, after fixing this issue:
#58

i will now get the next error message:

> 29/11/22 21:17:53 - ERROR - [on_message]: Exception raised for topic: predictions-channel-v1 and message: {'type': 'event-updated', 'data': {'timestamp': '2022-11-29T20:17:53.324501213Z', 'event': {'id': '04d778f0-db61-4d8e-b8a3-8f5cd6a07515', 'channel_id': '45044816', 'created_at': '2022-11-29T20:17:39.152537603Z', 'created_by': {'type': 'USER', 'user_id': '170024516', 'user_display_name': 'PhilippGet', 'extension_client_id': None}, 'ended_at': None, 'ended_by': None, 'locked_at': None, 'locked_by': None, 'outcomes': [{'id': 'dc326425-d0fe-46fe-8f33-9a05937a0533', 'color': 'BLUE', 'title': 'Ja', 'total_points': 16790, 'total_users': 8, 'top_predictors': [{'id': '2fe1ef5be78222eaa9a08e884bb0652bd56fe2c65eee14f47723fa20733b00ae', 'event_id': '04d778f0-db61-4d8e-b8a3-8f5cd6a07515', 'outcome_id': 'dc326425-d0fe-46fe-8f33-9a05937a0533', 'channel_id': '45044816', 'points': 13000, 'predicted_at': '2022-11-29T20:17:52.40119694Z', 'updated_at': '2022-11-29T20:17:52.40119694Z', 'user_id': '760127434', 'result': None, 'user_display_name': 'schweizerischer'}, {'id': '4a761f23dd159d18ea548b1d80425e3bb0f8ee6e824a618f4f754cf72683eb23', 'event_id': '04d778f0-db61-4d8e-b8a3-8f5cd6a07515', 'outcome_id': 'dc326425-d0fe-46fe-8f33-9a05937a0533', 'channel_id': '45044816', 'points': 2000, 'predicted_at': '2022-11-29T20:17:49.117969408Z', 'updated_at': '2022-11-29T20:17:49.117969408Z', 'user_id': '698487185', 'result': None, 'user_display_name': 'polstergeistxd'}, {'id': '25e3d0b635d6b9a18599cd91056ac62b490d24e6d7d279b4c9de141ed247f056', 'event_id': '04d778f0-db61-4d8e-b8a3-8f5cd6a07515', 'outcome_id': 'dc326425-d0fe-46fe-8f33-9a05937a0533', 'channel_id': '45044816', 'points': 600, 'predicted_at': '2022-11-29T20:17:51.352361848Z', 'updated_at': '2022-11-29T20:17:51.352361848Z', 'user_id': '581580284', 'result': None, 'user_display_name': 'alex_berziege'}, {'id': 'fc3d3592738c38f95a635ce8c2070259c2042341d6d61354afb22574fe274912', 'event_id': '04d778f0-db61-4d8e-b8a3-8f5cd6a07515', 'outcome_id': 'dc326425-d0fe-46fe-8f33-9a05937a0533', 'channel_id': '45044816', 'points': 600, 'predicted_at': '2022-11-29T20:17:51.665012891Z', 'updated_at': '2022-11-29T20:17:51.665012891Z', 'user_id': '590720944', 'result': None, 'user_display_name': 'snex46'}, {'id': 'f782416bbd754419cfc6c62e6f9788ef40b79b01aab11b6e3863f5bba7d0ce1c', 'event_id': '04d778f0-db61-4d8e-b8a3-8f5cd6a07515', 'outcome_id': 'dc326425-d0fe-46fe-8f33-9a05937a0533', 'channel_id': '45044816', 'points': 500, 'predicted_at': '2022-11-29T20:17:51.291905837Z', 'updated_at': '2022-11-29T20:17:51.291905837Z', 'user_id': '443352737', 'result': None, 'user_display_name': '826jonas'}, {'id': '69042e004ba08823ec14c248ad147257a3eb6906efb17febcbc9bf256b061f0f', 'event_id': '04d778f0-db61-4d8e-b8a3-8f5cd6a07515', 'outcome_id': 'dc326425-d0fe-46fe-8f33-9a05937a0533', 'channel_id': '45044816', 'points': 70, 'predicted_at': '2022-11-29T20:17:48.322067896Z', 'updated_at': '2022-11-29T20:17:52.912022457Z', 'user_id': '40564330', 'result': None, 'user_display_name': 'itsMelissa'}, {'id': '3e6cdc4dc52f169ef71cbc75146ff6e6ed95dc06a0d8afd72a5e36e33882985a', 'event_id': '04d778f0-db61-4d8e-b8a3-8f5cd6a07515', 'outcome_id': 'dc326425-d0fe-46fe-8f33-9a05937a0533', 'channel_id': '45044816', 'points': 10, 'predicted_at': '2022-11-29T20:17:47.981082817Z', 'updated_at': '2022-11-29T20:17:47.981082817Z', 'user_id': '441239311', 'result': None, 'user_display_name': 'thaxani'}, {'id': '4b19275be8b2369ece4f6602b42fdb0398fa6fbbcaea1d10ffe497a66f844eb8', 'event_id': '04d778f0-db61-4d8e-b8a3-8f5cd6a07515', 'outcome_id': 'dc326425-d0fe-46fe-8f33-9a05937a0533', 'channel_id': '45044816', 'points': 10, 'predicted_at': '2022-11-29T20:17:52.283973211Z', 'updated_at': '2022-11-29T20:17:52.283973211Z', 'user_id': '770535549', 'result': None, 'user_display_name': 'The_Real_NeXus13'}], 'badge': {'version': 'blue-1', 'set_id': 'predictions'}}, {'id': 'ef5959fa-64e0-4bf2-b7f5-377766a5b8d2', 'color': 'BLUE', 'title': 'Nein', 'total_points': 327, 'total_users': 4, 'top_predictors': [{'id': '342af372b3f1ce745e72630807db8ac67f398f966c7d8fcbda7b7408c19d166e', 'event_id': '04d778f0-db61-4d8e-b8a3-8f5cd6a07515', 'outcome_id': 'ef5959fa-64e0-4bf2-b7f5-377766a5b8d2', 'channel_id': '45044816', 'points': 197, 'predicted_at': '2022-11-29T20:17:46.532263264Z', 'updated_at': '2022-11-29T20:17:52.886967001Z', 'user_id': '132940471', 'result': None, 'user_display_name': 'KommandantHelm'}, {'id': '4b08b185b32341e64e7ac2408527d3acfd9d9afebe6f2263b9091f271a6b57b8', 'event_id': '04d778f0-db61-4d8e-b8a3-8f5cd6a07515', 'outcome_id': 'ef5959fa-64e0-4bf2-b7f5-377766a5b8d2', 'channel_id': '45044816', 'points': 100, 'predicted_at': '2022-11-29T20:17:47.221023486Z', 'updated_at': '2022-11-29T20:17:52.254358051Z', 'user_id': '522504592', 'result': None, 'user_display_name': 'derbig_max'}, {'id': 'e0fcdadab9bcc50e464829ada95d3f8836bf3bf6bb4daa8a198b344a77b6cade', 'event_id': '04d778f0-db61-4d8e-b8a3-8f5cd6a07515', 'outcome_id': 'ef5959fa-64e0-4bf2-b7f5-377766a5b8d2', 'channel_id': '45044816', 'points': 30, 'predicted_at': '2022-11-29T20:17:50.794241396Z', 'updated_at': '2022-11-29T20:17:53.293500549Z', 'user_id': '205713747', 'result': None, 'user_display_name': 'cjwupti'}, {'id': '6483667140d39bf15e0aee059c042583ff933e5d0574a7902382b07bb365ecf4', 'event_id': '04d778f0-db61-4d8e-b8a3-8f5cd6a07515', 'outcome_id': 'ef5959fa-64e0-4bf2-b7f5-377766a5b8d2', 'channel_id': '45044816', 'points': 10, 'predicted_at': '2022-11-29T20:17:46.676865131Z', 'updated_at': '2022-11-29T20:17:46.676865131Z', 'user_id': '44140506', 'result': None, 'user_display_name': 'TenzeiZ'}], 'badge': {'version': 'blue-2', 'set_id': 'predictions'}}, {'id': '0e566304-e324-4d54-a34e-d9db6e04d928', 'color': 'BLUE', 'title': 'Kommt nicht in Gulag', 'total_points': 0, 'total_users': 0, 'top_predictors': [], 'badge': {'version': 'blue-3', 'set_id': 'predictions'}}], 'prediction_window_seconds': 300, 'status': 'ACTIVE', 'title': 'Wird Monte den Gulag gewinnen?', 'winning_outcome_id': None}}}
> Traceback (most recent call last):
>   File "/home/andi/twitch_miner/Twitch-Channel-Points-Miner-v2/TwitchChannelPointsMiner/classes/WebSocketsPool.py", line 313, in on_message
>     ws.events_predictions[event_id].bet.update_outcomes(
>   File "/home/andi/twitch_miner/Twitch-Channel-Points-Miner-v2/TwitchChannelPointsMiner/classes/entities/Bet.py", line 177, in update_outcomes
>     self.total_points / self.outcomes[index][OutcomeKeys.TOTAL_POINTS]
> ZeroDivisionError: division by zero

tell me please if you need more information, I will surely provide them, keep up the great work!

Is it possible to set up in Termux anymore?

First, thanks for your continuing updates :)
I have tried to set up Tkd-Alex's version on Termux for an whole day and failed repeadly.
After seeing that the readme wasn't changed and #21 , I want to ask if Termux is still useable or not since i really don't have any energy to try this.

Random connection/timeout errors

When running the script, there are random timeout error messages in the log. I'm not sure if this is a problem with the miner or a problem with the VPS I'm using but I thought i would report it here just in case.

To Reproduce
Steps to reproduce the behavior:
Just came from using the bot so not eally sure what to put here.
Here's my modified script if it helps: https://gist.github.com/RCNOverwatcher/15ef22227c17295c979694f55e3ae48c

Expected behavior
No errors should be printed to the console ideally.

Desktop (please complete the following information):

  • Host: DigitalOcean
  • OS: Ubuntu 22.10
  • Python version: 3.10.7
  • Miner version: 1.5.2

Log
Error messages: https://gist.github.com/RCNOverwatcher/97bd6c5d27eafea85f626eb1506630cd

Additional context
These errors don't seem to impact the miner's functionality but it might result in fewer points being mined idk.

Error sending minute

16/11/22 21:31:45 - ERROR - [send_minute_watched_events]: Exception raised in send minute watched
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\Twitch-Channel-Points-Miner-v2-master\TwitchChannelPointsMiner\classes\Twitch.py", line 457, in send_minute_watched_events
response = requests.post(
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 115, in post
return request("post", url, data=data, json=json, **kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 573, in request
prep = self.prepare_request(req)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 484, in prepare_request
p.prepare(
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 368, in prepare
self.prepare_url(url, params)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 439, in prepare_url
raise MissingSchema(
requests.exceptions.MissingSchema: Invalid URL 'None': No scheme supplied. Perhaps you meant http://None?

Run replit

Do you plan to make a template to run this in replit?

How do I resolve this error?

16/11/22 01:39:17 - DEBUG - urllib3.connectionpool - [_new_conn]: Starting new HTTPS connection (1): raw.githubusercontent.com:443
16/11/22 01:39:18 - DEBUG - urllib3.connectionpool - [_make_request]: https://raw.githubusercontent.com:443 "GET /rdavydov/Twitch-Channel-Points-Miner-v2/master/TwitchChannelPointsMiner/init.py HTTP/1.1" 200 125
16/11/22 01:39:18 - INFO - TwitchChannelPointsMiner.TwitchChannelPointsMiner - [run]: Start session: '30d70f56-7f9c-4140-bebc-63f3e72775a4'
16/11/22 01:39:18 - INFO - TwitchChannelPointsMiner.classes.TwitchLogin - [login_flow]: You'll have to login to Twitch!
16/11/22 01:39:18 - DEBUG - urllib3.connectionpool - [_new_conn]: Starting new HTTPS connection (1): passport.twitch.tv:443
16/11/22 01:39:18 - DEBUG - urllib3.connectionpool - [_make_request]: https://passport.twitch.tv:443 "POST /protected_login HTTP/1.1" 400 135
16/11/22 01:39:18 - INFO - TwitchChannelPointsMiner.classes.TwitchLogin - [login_flow]: Console login unavailable (CAPTCHA solving required).

Analytics throwing AttributeError

When trying to run analytics on a web service I get this error
I do have analytics set to True in the file as well

Oct 24 04:26:29 AM AttributeError: analytics Oct 24 04:28:00 AM ==> Starting service with 'python run.py -p $PORT' Oct 24 04:28:09 AM Traceback (most recent call last): Oct 24 04:28:09 AM File "run.py", line 80, in <module> Oct 24 04:28:09 AM twitch_miner.analytics(host="0.0.0.0", port=5000, refresh=10, days_ago=25) # Analytics web-server

[False] +50 bonus still not working

hey i came to your project a few days back after the bonus claim ( +50 ) stopped working on the main repo
tried your version of the project and neither +50 nor auto claim drop is working using this code as well

am i missing something or was the bonus claim not solved in the first place ?

Switchable Analytics, Discord, Telegram

Add a global variable like enableAnalytics, enableDiscord, enableTelegram.
Check it everywhere (in all files) and execute pieces of code only if this variable is true.

Should reduce memory consumption by disabling non-needed modules and save disk space by not creating and writing /analytics/*.json.

/usr/local/bin/python: can't find '__main__' module in '/usr/src/app/run.py'

Describe the bug
Installed the docker container with docker compose.
Started the container and it crashed with error:
/usr/local/bin/python: can't find 'main' module in '/usr/src/app/run.py'

  • OS: Linux Ubuntu 22.04 live server
  • Miner version latest

Docker version:

Client: Docker Engine - Community
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 23:02:46 2022
OS/Arch: linux/amd64
Context: default
Experimental: true

Server: Docker Engine - Community
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.17.11
Git commit: a89b842
Built: Mon Jun 6 23:00:51 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.7
GitCommit: 0197261a30bf81f1ee8e6a4dd2dea0ef95d67ccb
runc:
Version: 1.1.3
GitCommit: v1.1.3-0-g6724737
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Docker compose version:

docker-compose version 1.29.2, build 5becea4c docker-py version: 5.0.0 CPython version: 3.7.10 OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019

WARNING - websocket - [warning]: websocket connected

Describe the bug
After running and loading the list of streamers, this error floods.
After this error the script continues to work as usual
I looked through the forums, and they say that need to turn off some logs.
I'm not good at this, and I don't understand anything.

23/11/22 22:38:27 - DEBUG - TwitchChannelPointsMiner.classes.TwitchWebSocket - [send]: #4 - Send: {"type":"PING"}
23/11/22 22:38:27 - WARNING - websocket - [warning]: websocket connected
23/11/22 22:38:27 - DEBUG - TwitchChannelPointsMiner.classes.TwitchWebSocket - [send]: #4 - Send: {"type":"LISTEN","nonce":"g40xqtXUceAYpxWy4LISJP3xYQnuHB","data":{"topics":["raid.36366181"]}}
23/11/22 22:38:27 - WARNING - websocket - [warning]: websocket connected
23/11/22 22:38:27 - DEBUG - TwitchChannelPointsMiner.classes.TwitchWebSocket - [send]: #6 - Send: {"type":"LISTEN","nonce":"4v7XWa15wMfIgcgdFolCfoCJ1zC6jU","data":{"topics":["raid.526542187"]}}
23/11/22 22:38:27 - DEBUG - TwitchChannelPointsMiner.classes.TwitchWebSocket - [send]: #6 - Send: {"type":"PING"}

To Reproduce
Steps to reproduce the behavior:

  1. Go to main folder
  2. Click on examlpe.py
  3. Awaiting upload. scroll down to the list of streamers check online/offline
  4. See error

Expected behavior
Expected that this error would not occur.

Desktop (please complete the following information):

  • OS: Windows 10
  • Python 3.10.5

Log
How to provide a DEBUG log:
The top I left a piece in which the bug appears. if this is not enough tell me if I can provide logs in any other way?
the site does not load (gist)

Additional context
Add any other context about the problem here.
image

Login Error

When starting the container i revcieve an error after i get the 2 factor code

Desktop:

  • OS: Win 11
  • Python version: 3.10.7
  • Miner version: v2-1.5.3
  • Docker Desktop

Log

C:\Users\NVME-PC.DESKTOP-NLUGAJU\Downloads\NeuerOrdner\Twitch-Channel-Points-Miner-v2>docker run -v C:\Users\NVME-PC.DESKTOP-NLUGAJU\Downloads\NeuerOrdner\Twitch-Channel-Points-Miner-v2\run.py:/usr/src/app/run.py:ro rdavidoff/twitch-channel-points-miner-v2
07/12/22 19:11:24 - INFO - [init]: Twitch Channel Points Miner v2-1.5.3 (fork by rdavydov)
07/12/22 19:11:24 - INFO - [init]: https://github.com/rdavydov/Twitch-Channel-Points-Miner-v2
07/12/22 19:11:24 - INFO - [run]: πŸ’£ Start session: 'a324239c-3827-4f93-b95b-e52b1dbcd3eb'
07/12/22 19:11:24 - INFO - [login_flow]: You'll have to login to Twitch!
Please enter the 6-digit code sent to g****@l***.xyz: Traceback (most recent call last):
07/12/22 19:11:24 - INFO - [login_flow]: Login Verification code required.
File "/usr/src/app/run.py", line 82, in
twitch_miner.mine(
File "/usr/src/app/TwitchChannelPointsMiner/TwitchChannelPointsMiner.py", line 173, in mine
self.run(streamers=streamers, blacklist=blacklist, followers=followers)
File "/usr/src/app/TwitchChannelPointsMiner/TwitchChannelPointsMiner.py", line 191, in run
self.twitch.login()
File "/usr/src/app/TwitchChannelPointsMiner/classes/Twitch.py", line 87, in login
if self.twitch_login.login_flow():
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/TwitchChannelPointsMiner/classes/TwitchLogin.py", line 117, in login_flow
twofa = input(
^^^^^^
EOFError: EOF when reading a line
.

Tag version in docker HUB

Hi,

What is the latest version in docker hub ?

Can you improve your docker on hub to display version of release ?

Actually i can see the latest build as pushed 20h ago.

image

I thought this update was for version 1.5.3, but that doesn't seem to be the case.

image

Thanks for your work.

'Something went wrong' when you try to login with the miner

They did it again. :(
They've started to detect UC and won't let you login with the miner.

Error message:

Something went wrong.
Please try again.

/integrity response:

{
    "error": "Oops! We encountered an unexpected error. Please try again.",
    "errors": [
        "Oops! We encountered an unexpected error. Please try again."
    ],
    "error_code": 5025,
    "error_description": "integrity failed"
}

Related issue: ultrafunkamsterdam/undetected-chromedriver#897

html doesnt show graphs

image

<title>Twitch-Channel-Points-Miner-v2</title>
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.6.1/css/bulma.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet"
    integrity="sha512-1ycn6IcaQQ40/MKBW2W4Rhis/DbILU74C1vSrLJxCq57o941Ym01SwNsOMqvEBFlcgUa6xLiPY/NS5R+E6ztJQ=="
    crossorigin="anonymous" referrerpolicy="no-referrer" />

<link href="{{url_for('static', filename='dark-theme.css')}}" rel="stylesheet" />
<link href="{{url_for('static', filename='style.css')}}" rel="stylesheet" />
banner
License
Python3
PRsWelcome
GitHub Repo stars
GitHub closed issues
GitHub last commit
            <br>
            <a href="https://www.buymeacoffee.com/tkdalex" target="_blank">
                <img src="https://cdn.buymeacoffee.com/buttons/lato-yellow.png" alt="Buy Me A Coffee" height="5"
                    width="138">
            </a>
        </div>
    </div>

    <div class="columns" style="margin-top: -30px">
        <div class="column is-2 has-text-left">
            <div class="dropdown">
                <div class="dropdown-trigger">
                    <button class="button" aria-haspopup="true" aria-controls="dropdown-menu">
                        <span id="sorting-by"></span>
                        <span class="icon is-small">
                            <i class="fas fa-angle-down" aria-hidden="true"></i>
                        </span>
                    </button>
                </div>
                <div class="dropdown-menu" id="dropdown-menu" role="menu">
                    <div class="dropdown-content">
                        <a href="#" class="dropdown-item" onClick="changeSortBy(this)">
                            Name ascending
                        </a>
                        <a href="#" class="dropdown-item" onClick="changeSortBy(this)">
                            Name descending
                        </a>
                        <a href="#" class="dropdown-item" onClick="changeSortBy(this)">
                            Points ascending
                        </a>
                        <a href="#" class="dropdown-item" onClick="changeSortBy(this)">
                            Points descending
                        </a>
                    </div>
                </div>
            </div>
        </div>
        <div class="column is-2 has-text-left">
            <input class="input" type="date" id="startDate">
        </div>
        <div class="column is-2 has-text-left">
            <input class="input" type="date" id="endDate">
        </div>
        <div class="column has-text-right" style="margin: auto">
            <label class="checkbox checkbox-label">
                Annotations
                <input type="checkbox" checked="true" id="annotations">
            </label>
            <label class="checkbox checkbox-label">
                Dark mode
                <input type="checkbox" checked="true" id="dark-mode">
            </label>
        </div>
    </div>
    <div class="columns">
        <div class="column is-2">
            <div class="tabs">
                <ul id="streamers-list"></ul>
            </div>
        </div>
        <div class="column">
            <div class="box" id="chart" style="padding: 0.30rem;"></div>
        </div>
    </div>
</div>
<script type="text/javascript"> // n.b. Seems that we are unable to call Flask variable in JS code imported from JS file. // That's why "link[href='{{url_for('static', filename='dark-theme.css')}}']", {{ refresh }}, {{ daysAgo }} are here. function toggleDarkMode() { var darkMode = $('#dark-mode').prop("checked") $("link[href='{{url_for('static', filename='dark-theme.css')}}']").prop("disabled", !darkMode); chart.updateOptions({ colors: darkMode === true ? ["#f9826c"] : ['#008ffb'], chart: { foreColor: darkMode === true ? "#fff" : '#373d3f' }, tooltip: { theme: darkMode === true ? "dark" : "light" } }) } var refresh = parseInt("{{ refresh }}"); var daysAgo = parseInt("{{ daysAgo }}"); </script> <script type="text/javascript" src="{{url_for('static', filename='script.js')}}"></script>

Windows 11 Docker Error

Hello good day
When I build and run the code on docker in windows 11, it gives the following error, how can I fix this error?

image

docker run twitchbot:experimental
Error: python: can't open file 'run.py': [Errno 2] No such file or directory

The steps I followed

  • Download the repo from Github and edit it according to myself (password etc.)
  • docker build -t twitchbot:experimental . build using this code
  • run container with code docker run twitchbot:experimental

- OS: Windows 11
- Docker Desktop version 4.13.1 (90346)
- Python version 3.8

Docker + Analytics

Thanks for your response @rdavydov, thanks to what you have told me, now it notifies that the web has been opened in the configuration that I have set, localhost:5000. But it seems that although everything seems to be correct, when I try to enter with the browser there is no response :(

I attach the dockerfile and the file run.py // I changed to .txt to allow github to upload it

Thanks in advance.

run.txt docker-compose.txt

Tkd-Alex#96

@tmaarcxs Try this variants in run.py:
twitch_miner.analytics(host="127.0.0.1", port=5000, refresh=5, days_ago=7) # Analytics web-server
twitch_miner.analytics(host="0.0.0.0", port=5000, refresh=5, days_ago=7) # Analytics web-server

I see that you are using Docker.

  1. Are you running the Docker image on your desktop/notebook machine or on something else, like Raspberry Pi?
  2. Do you have any firewall rules regarding Docker?
  3. Could you please try running it from sources and not via Docker.

Waiting for your results.

Replit Error

03/12/22 05:07:03 - ERROR - [error]: error from callback <function WebSocketsPool.on_message at 0x7ff0741b7280>: Error while trying to listen for a topic: {'type': 'RESPONSE', 'error': 'ERR_BADMESSAGE', 'nonce': 'IGuen3rtCAi7weLSBa0Ett9VkanBJD'}
03/12/22 05:07:03 - ERROR - [on_error]: #0 - WebSocket error: Error while trying to listen for a topic: {'type': 'RESPONSE', 'error': 'ERR_BADMESSAGE', 'nonce': 'IGuen3rtCAi7weLSBa0Ett9VkanBJD'}

RequestsDependencyWarning: urllib3 (1.26.12) or chardet (3.0.4)

0|twitch   | /usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.12) or chardet (3.0.4) doesn't match a supported version!
0|twitch   |   warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "

I need ignore this or i did something wrong ?

login required

03/11/22 20:51:52 - INFO - TwitchChannelPointsMiner.classes.TwitchLogin - [login_flow]: You'll have to login to Twitch!
03/11/22 20:51:52 - DEBUG - urllib3.connectionpool - [_new_conn]: Starting new HTTPS connection (1): passport.twitch.tv:443
03/11/22 20:51:53 - DEBUG - urllib3.connectionpool - [_make_request]: https://passport.twitch.tv:443 "POST /protected_login HTTP/1.1" 400 135
03/11/22 20:51:53 - INFO - TwitchChannelPointsMiner.classes.TwitchLogin - [login_flow]: Console login unavailable (CAPTCHA solving required).

latest update and name and pass is in the run.py but no screen show to add my captcha

No module named 'colorama'

when I ran the example.py file, before that I installed all the modules from the requirements file.
everything was done in a virtual environment

Steps to reproduce the behavior:

  1. execute example.py
  2. error:
    from colorama import Fore
    ModuleNotFoundError: No module named 'colorama'
  • OS: [Windows]
  • Python version [3.10.8]
  • Miner version [1.5.3]

Any idea how is this possible?

I noticed I was often getting douple raid points aka 250 and 250. But didn't look into it since never went in raid officially but this is broken
Screenshot_20221101-170117

Selenium logins fails when password is set to None in TwitchChannelPointsMiner

Describe the bug
When the password is set to None in the constructor of TwitchChannelPointsMiner in the run.py file, the program crashes when it tries to login using selenium.

To Reproduce
Run the bot using the following run.py and input any password

# -*- coding: utf-8 -*-

import os
import logging
from colorama import Fore
from TwitchChannelPointsMiner import TwitchChannelPointsMiner
from TwitchChannelPointsMiner.logger import LoggerSettings, ColorPalette
from TwitchChannelPointsMiner.classes.Chat import ChatPresence
from TwitchChannelPointsMiner.classes.Discord import Discord
from TwitchChannelPointsMiner.classes.Telegram import Telegram
from TwitchChannelPointsMiner.classes.Settings import Priority, Events, FollowersOrder
from TwitchChannelPointsMiner.classes.entities.Bet import Strategy, BetSettings, Condition, OutcomeKeys, FilterCondition, DelayMode
from TwitchChannelPointsMiner.classes.entities.Streamer import Streamer, StreamerSettings

twitch_miner = TwitchChannelPointsMiner(
    username="TESTBUG123",
    password=None,
    claim_drops_startup=True,                  # If you want to auto claim all drops from Twitch inventory on the startup
    priority=[                                  # Custom priority in this case for example:
        Priority.STREAK,                        # - We want first of all to catch all watch streak from all streamers
        Priority.DROPS,                         # - When we don't have anymore watch streak to catch, wait until all drops are collected over the streamers
        Priority.ORDER                          # - When we have all of the drops claimed and no watch-streak available, use the order priority (POINTS_ASCENDING, POINTS_DESCEDING)
    ],
    logger_settings=LoggerSettings(
        save=False,                              # If you want to save logs in a file (suggested)
        console_level=logging.INFO,             # Level of logs - use logging.DEBUG for more info
        emoji=True,                             # On Windows, we have a problem printing emoji. Set to false if you have a problem
        less=False,                             # If you think that the logs are too verbose, set this to True
        colored=True,                           # If you want to print colored text
        color_palette=ColorPalette(             # You can also create a custom palette color (for the common message).
            streamer_online="GREEN",            # Don't worry about lower/upper case. The script will parse all the values.
            streamer_offline="RED",             # Read more in README.md
            bet_win=Fore.MAGENTA                # Color allowed are: [BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET].
        )
    ),
    streamer_settings=StreamerSettings(
        make_predictions=False,
        follow_raid=True,
        claim_drops=True,
        watch_streak=True,
        chat=ChatPresence.ONLINE,
        bet=BetSettings(
            strategy=Strategy.SMART,      # Choose you strategy!
            percentage=5,                       # Place the x% of your channel points
            percentage_gap=15,
            max_points=50000,                   # If the x percentage of your channel points is gt bet_max_points set this value
            stealth_mode=True,                  # If the calculated amount of channel points is GT the highest bet, place the highest value minus 1-2 points Issue #33
            delay_mode=DelayMode.FROM_END,      # When placing a bet, we will wait until `delay` seconds before the end of the timer
            delay=5,
            minimum_points=2000,                # Place the bet only if we have at least 2k points. Issue #113
            filter_condition=FilterCondition(
                by=OutcomeKeys.TOTAL_POINTS,     # Where apply the filter. Allowed [PERCENTAGE_USERS, ODDS_PERCENTAGE, ODDS, TOP_POINTS, TOTAL_USERS, TOTAL_POINTS]
                where=Condition.GTE,             # 'by' must be [GT, LT, GTE, LTE] than value
                value=100000
            )
        )
    )
)

# Analytics web-server
twitch_miner.analytics(host="0.0.0.0", port=5000, refresh=5, days_ago=30)

# You can customize the settings for each streamer. If not settings were provided, the script would use the streamer_settings from TwitchChannelPointsMiner.
# If no streamer_settings are provided in TwitchChannelPointsMiner the script will use default settings.
# The streamers array can be a String -> username or Streamer instance.

# The settings priority are: settings in mine function, settings in TwitchChannelPointsMiner instance, default settings.
# For example, if in the mine function you don't provide any value for 'make_prediction' but you have set it on TwitchChannelPointsMiner instance, the script will take the value from here.
# If you haven't set any value even in the instance the default one will be used


twitch_miner.mine(
    [], # Array of streamers (order = priority)
    followers=True,                    # Automatic download the list of your followers
    followers_order=FollowersOrder.ASC  # Sort the followers list by follow date. ASC or DESC
)

Expected behavior
The program tries to login using the password given from stdin.

Desktop (please complete the following information):

  • OS: Windows / Linux
  • Python version 3.11

Additional context
I am providing a patch soon

Problem with generating new cookies file

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):

  • OS: Canonical Ubuntu with architecture aarch64 (arm64) (you could think of it as running on Raspberry Pi, never had problems tho)
  • Python version 3.10.6

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.