rdavydov / Twitch-Channel-Points-Miner-v2

A simple script that will watch a stream for you and earn the channel points.
GNU General Public License v3.0
1.12k stars 333 forks source link

Auto claiming drops stopped working? #333

Open pchristod opened 11 months ago

pchristod commented 11 months ago

Describe the bug

Since a few days (somewhere in between last friday and yesterday) the miner started having problems with the auto claiming of drops. I thought at first this was a problem of the latest release so I temporarily reverted back to 1.8.3 with the same problem. It seems though that there's only a problem while the script is running, restarting the Miner (and having set claim on startup variable) will do the claim fine. Am I the only one having that problem or is there something with the Script/Twitch API?

Thanks!

Steps to reproduce

1) Start the Miner with config file 2) Watch a Streamer with Drops on 3) Drop will Progress, however not be claimed automatically while the script is running

Expected behavior

Claim Drops automatically like it used to until a few days ago when having 'claim_drops=True' set

Operating system

Docker on Synology NAS

Python version

Docker on Synology NAS

Miner version

latest

Other relevant software versions

No response

Logs

https://gist.github.com/pchristod/1d40e20200023768a3e057167b435622

Additional context

I've tried to capture the issue by starting some random drop campaign and setting the log to Debug (see the ling to the gist). The Drop named 'Necroghouly Wraith' is still sitting unclaimed in my Inventory.

met94 commented 11 months ago

I've been getting the same issue using docker on Linux and a friend said he's getting the issue running on windows

hoak2 commented 11 months ago

You are not alone. I've got the same issue for a very very long time and mentioned it once. I was told its an issue on my end so I just restart when I notice its stopping to claim. Just happened again.

pchristod commented 11 months ago

Hm strange, at least it doesn't seem I'm alone, thanks. I've never had that happen before, using the container since a few months. A restart will claim open drops as mentioned, however new drops won't be claimed during runtime as they used to until last week.

rdavydov commented 11 months ago

Guys, you should look at previous open issues, before submitting a duplicate. Working on the fix in https://github.com/rdavydov/Twitch-Channel-Points-Miner-v2/issues/284

pchristod commented 11 months ago

Ah I see. I saw that issue actually but just read the initial posting and dismissed it because it was a special case and open a while longer while it was still working for me. Plus the description doesn't fit a 100% (progress vs. claiming). I did not read the comments that followed until the latest. That explains it.

My bad, thanks for pointing it out. Will close this issue.

LeftMonster commented 11 months ago

Thanks. 谢谢!

rdavydov commented 11 months ago

Actually, let's keep this open. So I can test and debug this with my own account on the same drop. image

rdavydov commented 11 months ago

As I understood:

1) drops are progressing, no issues with progressing; 2) 100% progressed drops are not claimed automatically, they keep sitting in the Inventory unclaimed. 3) setting claim_drops_startup=True, claims those drops from the Inventory on the next miner restart.

Correct?

pchristod commented 11 months ago

Ok, sure 👍

Yes, the summary is correct. For me it didn't matter which drop, but great you found the same to test with.

Xallenzz commented 11 months ago

I also noticed that the drops are not taken by hand (due to an error that allegedly the browser does not fit), I turned on the vpn, and took it with my hands. This error came out as I made 26 twitch accounts

Xallenzz commented 11 months ago

I can give you a ready-made account, with a drop, so that you don't wait

Xallenzz commented 11 months ago

Can you add pls a log in the telegram that there is a drop on a certain account. Just if you set the method to pick up the drop at the entrance, it is picked up.

rdavydov commented 11 months ago

Can you add pls a log in the telegram that there is a drop on a certain account. Just if you set the method to pick up the drop at the entrance, it is picked up.

Create a new detailed feature request, it is off-topic here.

rdavydov commented 11 months ago

@pchristod and others: are you also not getting the info messages in the console and in the log about the campaign? And there should also be a drop.progress_bar(), I'm not seeing it.

Xallenzz commented 11 months ago

In the search in the logs, I did not find drop.progress_bar()

rdavydov commented 11 months ago

By drop.progress_bar() I meant the actual visual progress bar in the console.

rdavydov commented 11 months ago

Note for me: most likely the fix in 812472431d540bfc2920132878023583be664f24 is incorrect. campaigns should not be an empty list. Right now I see a not empty campaigns_ids, but with the empty campaigns. This is incorrect.

Malu007-YT commented 11 months ago

i have the same error but paying attention to the execution of the code, I noticed this error :

Exception in thread Sync campaigns/inventory: Traceback (most recent call last): File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/threading.py", line 953, in run self._target(*self._args, *self._kwargs) File "/home/runner/viuerh0eitnbj342ino34jprwetinbio349ityyyy777/TwitchChannelPointsMiner/classes/Twitch.py", line 799, in sync_campaigns self.get_drops_dashboard(status="ACTIVE") File "/home/runner/viuerh0eitnbj342ino34jprwetinbio349ityyyy777/TwitchChannelPointsMiner/classes/Twitch.py", line 700, in get_drops_dashboard filter(lambda x: x["status"] == status.upper(), campaigns)) TypeError: 'NoneType' object is not iterableException in thread Sync campaigns/inventory: Traceback (most recent call last): File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/threading.py", line 953, in run self._target(self._args, **self._kwargs) File "/home/runner/viuerh0eitnbj342ino34jprwetinbio349ityyyy777/TwitchChannelPointsMiner/classes/Twitch.py", line 799, in sync_campaigns self.get_drops_dashboard(status="ACTIVE") File "/home/runner/viuerh0eitnbj342ino34jprwetinbio349ityyyy777/TwitchChannelPointsMiner/classes/Twitch.py", line 700, in get_drops_dashboard filter(lambda x: x["status"] == status.upper(), campaigns)) TypeError: 'NoneType' object is not iterable

Malu007-YT commented 11 months ago

and in the code I changed only in main.py line 24, replacing false with true

pchristod commented 11 months ago

@pchristod and others: are you also not getting the info messages in the console and in the log about the campaign? And there should also be a drop.progress_bar(), I'm not seeing it.

@rdavydov How would that look like vaguely? I'm not seeing any visual indicators related to Drops/Campaigns in the Console as far as I can tell. The only thing related to drops when Debug Mode is on, is something like this (snippet):

11.08.2023 20:45:04 11/08/23 20:45:04 - DEBUG - [post_gql_request]: Data: {'operationName': 'Inventory', 'variables': {'fetchRewardCampaigns': True}, 'extensions': {'persistedQuery': {'version': 1, 'sha256Hash': '37fea486d6179047c41d0f549088a4c3a7dd60c05c70956a1490262f532dccd9'}}}, Status code: 200, Content: {"data":{"currentUser":{"id":"158854206","inventory":{"dropCampaignsInProgress":[{"id":"5ce8b3ac-1c38-4620-b071-fb6d5e002899","detailsURL":"https://joinbattlebit.com/","accountLinkURL":"https://link.battlebit.cloud/LinkTwitchAccount","startAt":"2023-08-17T17:00:00Z","endAt":"2023-08-24T17:00:00Z","imageURL":"https://static-cdn.jtvnw.net/twitch-drops-assets-prod/CAMPAIGN-ba617103-d4da-44fb-8c75-3911a17ba2a1.png","name":"Drops Week 3 Rerun\t","status":"UPCOMING","self":{"isAccountConnected":true,"__typename":"DropCampaignSelfEdge"},"game":{"id":"496916","name":"BattleBit Remastered","boxArtURL":"https://static-cdn.jtvnw.net/ttv-boxart/496916_IGDB-285x380.jpg","__typename":"Game"},"allow":{"channels":null,"__typename":"DropCampaignACL"},"eventBasedDrops":[],"timeBasedDrops":[{"id":"22767298-a3da-478d-8c56-1bc98233f5e5","name":"ACR - Twitch Edition","startAt":"2023-08-17T17:00:00Z","endAt":"2023-08-

I have logs from last week where the whole auto claim during runtime still worked. There I'm seeing output like this (no Debug mode), which is missing in the newer logs, obviously because they are not auto claimed: 03/08/23 15:47:43 - INFO - TwitchChannelPointsMiner.classes.Twitch - [claim_drop]: Claim Drop(id=9bfc2d7b-9ec8-4719-84af-4555d9095fea, name=Supply Crates (Day 4), benefit=Supply Crate, minutes_required=120, has_preconditions_met=True, current_minutes_watched=120, percentage_progress=100%, drop_instance_id=27d3765a-1b44-41ae-95dc-bed0511d5a6e, is_claimed=False)

rdavydov commented 11 months ago

Note for me:

    def __get_drops_dashboard(self, status=None):
        response = self.post_gql_request(GQLOperations.ViewerDropsDashboard)
        campaigns = response["data"]["currentUser"]["dropCampaigns"]

for some reason it returns 'dropCampaigns': None.

In the browser:

{
  "operationName": "ViewerDropsDashboard",
  "variables": {
    "fetchRewardCampaigns": true
  },
  "extensions": {
    "persistedQuery": {
      "version": 1,
      "sha256Hash": "8d5d9b5e3f088f9d1ff39eb2caab11f7a4cf7a3353da9ce82b5778226ff37268"
    }
  }
}

returns dropCampaigns filled with the required data.

Bummer if it is because of the Client-Integrity header.

Malu007-YT commented 11 months ago

If it can help you, I had created a small script for Twitch drops :



def redeem_twitch_drops():
    for drop in twitch_api_library.get_completed_drops():
        twitch_api_library.redeem_drop(drop)

redeem_twitch_drops() 
rdavydov commented 11 months ago

Note for me:

    def __get_drops_dashboard(self, status=None):
        # response = self.post_gql_request(GQLOperations.ViewerDropsDashboard)
        response = self.post_gql_request(GQLOperations.Inventory)
        # campaigns = response["data"]["currentUser"]["dropCampaigns"] or []
        campaigns = response['data']['currentUser']['inventory']['dropCampaignsInProgress']

        if status is not None:
            campaigns = list(
                filter(lambda x: x["status"] == status.upper(), campaigns)) or []

        return campaigns

doesn't fix the issue, because __get_campaigns_details also returns ["data"]["user"]["dropCampaign"] as None.

jabbink commented 11 months ago

This is related to the same issue where for the TV app client ID not only the ViewerDropsDashboard is not returning drops anymore, but also for DropCampaignDetails, so when __get_campaigns_details is called on the result of __get_drops_dashboard, everything still gets reduced to an array of [None, None, ...]

Same issue in "the other" repository to watch in case they find a solution: https://github.com/DevilXD/TwitchDropsMiner/issues/264

rdavydov commented 11 months ago

Yep, that's the major problem. I've been experimenting all day, looks like there is no solution ATM.

Probably can add a very dirty hack to sync_campaigns to just call self.claim_all_drops_from_inventory() every 60 mins.

Very poor "solution", but I just don't see any other way now.

Malu007-YT commented 11 months ago

If it works and you don't mind doing it, you could give it a try! I advise you to put 30 minutes because many drops have at least 30 minutes so you would lose a drop! (since a drop is 30 min and you have to wait another 30 without making another one....)

ps. it's a wonderful program and it works perfectly, congratulations (I only found it today)

rdavydov commented 11 months ago

If it works and you don't mind doing it, you could give it a try! I advise you to put 30 minutes because many drops have at least 30 minutes so you would lose a drop! (since a drop is 30 min and you have to wait another 30 without making another one....)

ps. it's a wonderful program and it works perfectly, congratulations (I only found it today)

Thanks for the kind words! OK, I'll try to make it 30 minutes, good remark.

pchristod commented 11 months ago

Wow, developing anything for Twitch seems just horrible as they constantly change things. I would agree to those kind words, thank you for putting work into it 😊 Honestly I don't even like the Drops system, but using a bot i can at least get the rewards without doing it actively so the miner is just awesome.

Malu007-YT commented 11 months ago

hi this morning (I live in Italy) I was running the latest version of the script, but it won't let me run it because of this error:


  File ".github/ISSUE_TEMPLATE/bug_report.yml", line 36
    placeholder: Windows 11 Version 21H2 (OS Build 22000.1574)
                                     ^
SyntaxError: invalid decimal literal 
Malu007-YT commented 11 months ago

... of course I have that version of windows ...

rdavydov commented 11 months ago

hi this morning (I live in Italy) I was running the latest version of the script, but it won't let me run it because of this error:

  File ".github/ISSUE_TEMPLATE/bug_report.yml", line 36
    placeholder: Windows 11 Version 21H2 (OS Build 22000.1574)
                                     ^
SyntaxError: invalid decimal literal 

You're doing something completely wrong. First of all, how do you run the miner? Exact detailed steps, please.

Malu007-YT commented 11 months ago

wait

Malu007-YT commented 11 months ago

I just put the name and psw in the replit secret (with the appropriate names) and first i just imported "https://github.com/rdavydov/Twitch-Channel-Points-Miner-v2/releases/tag/1.8.5" to replit

ah, maybe i understand.... the reason is because i imported the code from github??

rdavydov commented 11 months ago

I just put the name and psw in the replit secret (with the appropriate names) and first i just imported "https://github.com/rdavydov/Twitch-Channel-Points-Miner-v2/releases/tag/1.8.5" to replit

ah, maybe i understand.... the reason is because i imported the code from github??

https://github.com/rdavydov/Twitch-Channel-Points-Miner-v2/blob/master/README.md#replit

Malu007-YT commented 11 months ago

bro, I'm very stupid, forgive me, I've only been using github for a while

Malu007-YT commented 11 months ago

bro, i made a replit with version 1.8.5 (also with keep_alive), do you want me to send you the name?

Malu007-YT commented 11 months ago

https://replit.com/@Malu007/Twitch-Channel-Points-Miner-v2-185-by-rdavydov

Malu007-YT commented 11 months ago

if you don't like it, I'll immediately delete the link

jabbink commented 11 months ago

@rdavydov it might be fixable by intercepting the WebSocket message and claim based on it

{
  "type": "MESSAGE",
  "data": {
    "topic": "user-drop-events.UserID",
    "message": "{\"type\":\"drop-progress\",\"data\":{\"drop_id\":\"DropID\",\"channel_id\":\"ChannelID\",\"current_progress_min\":59,\"required_progress_min\":60}}"
  }
}
jabbink commented 11 months ago

Seems to work for me

in WebSocketsPool.py

there's probably a better way, but I don't have the drop instance ID here

                    elif message.topic == "user-drop-events":
                        if message.type == "drop-progress":
                            if message.data["required_progress_min"] == message.data["current_progress_min"]:
                                ws.twitch.claim_all_drops_from_inventory()

and of course subscribe to it

                self.ws_pool.submit(
                    PubsubTopic(
                        "user-drop-events",
                        user_id=user_id,
                    )
                )
jabbink commented 11 months ago

Even better, there's message.type "drop-claim" which triggers instantly when stuff is claimable, and contains a drop_instance_id

I put the claim GQL request there and it works flawlessly

{"type":"MESSAGE","data":{"topic":"user-drop-events.UserId","message":"{\"type\":\"drop-claim\",\"data\":{\"drop_instance_id\":\"DropInstanceId\",\"drop_id\":\"DropId\",\"channel_id\":\"ChannelId\"}}"}}
Rakambda commented 11 months ago

As I implemented it in my version I have some feedback on it. While it seems to work on the web version, the Android TV client doesn't seem that have the permission to use it (i don't know for the mobile client). Subscribing to the topic leads to a ERR_BADAUTH response from the WS api.

2023-08-15T09:31:28,170 TRACE  - Sending WebSocket message: {"data":{"auth_token":"...","topics":["video-playback-by-id.xxxx"]},"nonce":"VsgrDA7Gcd7SMKDTpb5F5qFN8hzzlh","type":"LISTEN"}
2023-08-15T09:31:28,170 TRACE  - Sending WebSocket message: {"data":{"auth_token":"...","topics":["user-drop-events.xxxx"]},"nonce":"XutvfLJ8VdLikYk1G8YheaR71wvzom","type":"LISTEN"}
2023-08-15T09:31:28,328 TRACE  - Received Websocket message: {"type":"RESPONSE","error":"","nonce":"VsgrDA7Gcd7SMKDTpb5F5qFN8hzzlh"}
2023-08-15T09:31:28,488 TRACE  - Received Websocket message: {"type":"RESPONSE","error":"ERR_BADAUTH","nonce":"XutvfLJ8VdLikYk1G8YheaR71wvzom"}
2023-08-15T09:31:28,488 TRACE  - Parsed message: ResponseResponse(error=ERR_BADAUTH, nonce=XutvfLJ8VdLikYk1G8YheaR71wvzom)
2023-08-15T09:31:28,488 ERROR  - Received error response ResponseResponse(error=ERR_BADAUTH, nonce=XutvfLJ8VdLikYk1G8YheaR71wvzom)

Do you have an auth made from the android client when you did your tests?

jabbink commented 11 months ago

I have used the drop-progress event for ~a day applied to this repository as a local change (android tv) and am now using the drop-claim event instead, without issues so far.

Rakambda commented 11 months ago

Ok must be my bad, I guess UserId refers to the currently logged in user. I tried with the UserId of the channel being watched.

jabbink commented 11 months ago

Yes, it's your own user id, just like predictions-user-v1 and community-points-user-v1

Malu007-YT commented 11 months ago

I noticed that if I set priority on drops, it continues to watch live even if all the drops of that game have been redeemed, it doesn't recognize that some drops are locked due to the date. Screenshot_2023-08-18-22-38-11-63_f56d448df78e8512261d4bfbcb3978c7.jpg

Screenshot_2023-08-18-22-38-52-40_dce875ef40efa4e902b2719365b6f678.jpg

jabbink commented 11 months ago

@Malu007-YT

https://github.com/rdavydov/Twitch-Channel-Points-Miner-v2/issues/284#issuecomment-1646597966

StarrrLiteNL commented 7 months ago

I can also confirm claiming drops is not working at all for me, both campaigns and single drops never seem to auto-claim. It does seem to try do to it, but never actually does anything

I keep seeing this message in my logs, but it has never managed to succesfully actually claim it.

21/12/23 14:52:33 - INFO - TwitchChannelPointsMiner.classes.Twitch - [claim_drop]: Claim Drop(id=d15b1263-8ecf-11ee-9000-0a58a9feac02, name=Mamba Luminae Polaris SKIN, benefit=Mamba Luminae SKIN, minutes_required=120, has_preconditions_met=True, current_minutes_watched=120, percentage_progress=100%, drop_instance_id=44678773#ac5fc373-8ecf-11ee-ba99-0a58a9feac02#d15b1263-8ecf-11ee-9000-0a58a9feac02, is_claimed=False)

There are no errors or any indication in the logs why it would have failed to grab

yarin177 commented 4 months ago

Seems like this caused by failed intergrity check from Twitch. I will try to fix it myself and update if I manage to.

shinji257 commented 4 months ago

It has been working for me but I've been running the bot for a while. It doesn't always seem to claim but later on it gets them I think. Regardless when I go to watch Twitch I've been checking and finding none that need claimed.