Twitchのチャンネルポイントを自動で貯める

2021年9月25日

2021/9/30 追記
Twitch APIが変更されたようで「streamer does not exist」とエラーが出るようになりました。
エラーを解消する手順6.(修正ファイルのダウンロード~ファイル置き換え)を追記しました。

配信を開かずにチャンネルポイントを貯めることが出来るツールの紹介。
自分で作った配信者リストの配信開始を待ち、時間に応じたポイントを受け取り、ボーナス箱を自動で開ける。
なお、Twitchの制限上ポイントを同時に取得出来るチャンネル数は2つのみ。

  1. pythonインストール
  2. コマンドプロンプトまたはWindows PowerShellを起動
  3. 作業フォルダを作成しても良い場所にカレントディレクトリを変更
  4. cd c:¥
  5. 下記コマンドを実行
  6. git clone https://github.com/Tkd-Alex/Twitch-Channel-Points-Miner-v2
  7. フォルダ「Twitch-Channel-Points-Miner-v2」が作成されるので、下記コマンドを実行
  8. cd Twitch-Channel-Points-Miner-v2
  9. 下記ファイルをダウンロード・解凍
    フォルダ内のファイルを全てコピーしてフォルダ「Twitch-Channel-Points-Miner-v2」内に貼り付け
    全てのファイルを置き換える
  10. Twitch-Channel-Points-Miner-v2-wout-helix-api.zip
    Download

  11. 下記コマンドを実行
  12. pip install -r requirements.txt
  13. 下記ファイルをダウンロードし、フォルダ「Twitch-Channel-Points-Miner-v2」内に入れる
  14. run.py
    Download

  15. ファイル「run.py」をテキストエディタで開く
  16. 12行目「username=""」にTwitchユーザ名を入力
    13行目「password=""」にTwitchパスワードを入力
  17. 40行目「join_chat=」はTrueにするとチャット欄に表示(視聴者としてカウント)されるようになる
    入手出来るチャンネルポイント数は増えるが、お好みで
  18. 69行目~77行目「Streamer(“")」にチャンネルポイントを貯めたい配信者のIDを記載
    順番が上ほど優先度が高い
    文末のカンマ有無に注意
  19. 他の行はイジらなくて良い、お好みで
  20. 
    # -*- coding: utf-8 -*-
    
    import logging
    from colorama import Fore
    from TwitchChannelPointsMiner import TwitchChannelPointsMiner
    from TwitchChannelPointsMiner.logger import LoggerSettings, ColorPalette
    from TwitchChannelPointsMiner.classes.Settings import Priority
    from TwitchChannelPointsMiner.classes.entities.Bet import Strategy, BetSettings, Condition, OutcomeKeys, FilterCondition, DelayMode
    from TwitchChannelPointsMiner.classes.entities.Streamer import Streamer, StreamerSettings
    
    twitch_miner = TwitchChannelPointsMiner(
        username="",
        password="",                                # If no password will be provided, the script will ask interactively
        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.SUBSCRIBED,                    # - We want first of all to catch all watch streak from all streamers
            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.SUBSCRIBED,                    # - Prioritize streamers you're subscribed to (higher subscription tiers are mined first)
            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=True,                              # If you want to save logs in a file (suggested)
            console_level=logging.INFO,             # Level of logs - use logging.DEBUG for more info)
            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].
            )
        ),
        streamer_settings=StreamerSettings(
            make_predictions=False,                 # If you want to Bet / Make prediction
            follow_raid=False,                      # 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
            watch_streak=True,                      # If a streamer go online change the priotiry of streamers array and catch the watch screak. Issue #11
            join_chat=False,                        # Join irc chat to increase watch-time
            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 stragegy)
                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=2000,                # 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.mine(
        [
            Streamer("baikin_lol"),
            Streamer("syouhizei"),
            Streamer("pinkwardlol"),
            Streamer("shaclone"),
            Streamer("hikashikun"),
            Streamer("kagamikota"),
            Streamer("taityou_rx"),
            Streamer("rnorno"),
            Streamer("akihito_kawamori_")
        ],                                 # Array of streamers (order = priority)
        followers=False                    # Automatic download the list of your followers (unable to set custom settings for you followers list)
    )
    
  21. 編集が完了したら上書き保存
  22. 下記コマンドを実行
  23. python run.py
  24. 二段階認証を設定している場合は、コードの入力を求められる
  25. コマンドプロンプトまたはWindows PowerShellを閉じないようにする
  26. 今後はファイル「run.py」をダブルクリックすれば実行出来る