rdavydov/Twitch-Channel-Points-Miner-v2

Claim moments

silentguy256 opened this issue ยท 11 comments

I have not noticed any of my followed streamers use moments yet but I've seen people talk about them occasionally. They are described here: https://help.twitch.tv/s/article/moments

It seems this is a feature for "having been there when it happened" so it seems there is no need to consider them during priority etc, we would "just" need the ability to notice if there was a moment in one of the streams currently being farmed and if there was claim it within 180 seconds.

In essence it would be like claiming the regular bonus points but I have no idea how similar it would be in the backend, I have not quite understood the api interactions

More references:
chowder/ttv-cli@b05f421
chowder/ttv-cli@bce9b8a
chowder/ttv-cli@2af1a30

So mining for 15+ channels who frequently create Moments paid off. ๐Ÿ˜„

Here's the payload from the PubSub API when there's a moment active:

{
  "type": "active",
  "data": {
    "moment_id": "0ad4b5b8-be38-4245-b20d-af357aec18e9",
    "channel_id": "215105998",
    "clip_slug": "SparklySmokyFriesFloof-jwMEwyARRfqhEImG"
  }
}

(Moment link: https://clips.twitch.tv/SparklySmokyFriesFloof-jwMEwyARRfqhEImG)

Everything else about claiming Moments is as we already knew it from the conversations above.

First attempt is done. No error handling, plain and simple, but it should work just fine for now.

https://github.com/rdavydov/Twitch-Channel-Points-Miner-v2/tree/moments

Who's willing to test? Please report back any issues related to moments. Don't forget to enable DEBUG log.

Man, these moments are hard to catch! Haven't been able to find a single channel to test.
Does anyone have a Twitch channel and is willing to participate in moments testing?

Man, these moments are hard to catch! Haven't been able to find a single channel to test. Does anyone have a Twitch channel and is willing to participate in moments testing?

Oh the streamers I regularly watch I found one that had exactly one moment, created 5 months ago. I think you need to be an affiliate to have access to them, so sadly I can't test it with my never really used channel. And I fear most people that stream enough to actually earn money with twitch might not be interested in wasting their 5 a month for some tests :-(

@rdavydov - I follow a streamer which regularly uses all available moments each month.
I've updated to 1.7.7, configured Debug logging for the file based log and changed my run.py to capture the moments.
I should be able to capture a moment given some time. I'll keep an eye out for when this next happens and report back

The feature works fine for me, It claimed two moments with no issue.

10/03/23 21:09:00 - DEBUG - TwitchChannelPointsMiner.classes.WebSocketsPool - [on_message]: #4 - Received: { "type": "PONG" }
10/03/23 21:09:02 - DEBUG - TwitchChannelPointsMiner.classes.WebSocketsPool - [on_message]: #1 - Received: {"type":"MESSAGE","data":{"topic":"community-moments-channel-v1.26921830","message":"{\"type\":\"active\",\"data\":{\"moment_id\":\"9f3ee4d7-b0c8-4629-8f2c-5db7fc47c186\",\"channel_id\":\"26921830\",\"clip_slug\":\"GeniusFairKumquatFreakinStinkin-PW5OUByrEZQp0bFJ\"}}"}}

10/03/23 21:09:02 - DEBUG - TwitchChannelPointsMiner.classes.Twitch - [post_gql_request]: Data: {'operationName': 'CommunityMomentCallout_Claim', 'extensions': {'persistedQuery': {'version': 1, 'sha256Hash': 'e2d67415aead910f7f9ceb45a77b750a1e1d9622c936d832328a0689e054db62'}}, 'variables': {'input': {'momentID': '9f3ee4d7-b0c8-4629-8f2c-5db7fc47c186'}}}, Status code: 200, Content: {"data":{"claimCommunityMoment":{"moment":{"id":"9f3ee4d7-b0c8-4629-8f2c-5db7fc47c186","__typename":"CommunityMoment"},"error":null,"__typename":"ClaimCommunityMomentPayload"}},"extensions":{"durationMilliseconds":10,"operationName":"CommunityMomentCallout_Claim","requestID":"01GV6NP98F862E4YHNJH5PSPF4"}}


--

11/03/23 01:31:46 - DEBUG - TwitchChannelPointsMiner.classes.WebSocketsPool - [on_message]: #1 - Received: {"type":"MESSAGE","data":{"topic":"community-moments-channel-v1.26921830","message":"{\"type\":\"active\",\"data\":{\"moment_id\":\"fcc4c0af-b617-4985-be1f-3a302d2fece6\",\"channel_id\":\"26921830\",\"clip_slug\":\"PrettiestClumsySwanKevinTurtle-lnhuyYXuTWC_KACi\"}}"}}

11/03/23 01:31:47 - DEBUG - TwitchChannelPointsMiner.classes.Twitch - [post_gql_request]: Data: {'operationName': 'CommunityMomentCallout_Claim', 'extensions': {'persistedQuery': {'version': 1, 'sha256Hash': 'e2d67415aead910f7f9ceb45a77b750a1e1d9622c936d832328a0689e054db62'}}, 'variables': {'input': {'momentID': 'fcc4c0af-b617-4985-be1f-3a302d2fece6'}}}, Status code: 200, Content: {"data":{"claimCommunityMoment":{"moment":{"id":"fcc4c0af-b617-4985-be1f-3a302d2fece6","__typename":"CommunityMoment"},"error":null,"__typename":"ClaimCommunityMomentPayload"}},"extensions":{"durationMilliseconds":8,"operationName":"CommunityMomentCallout_Claim","requestID":"01GV74QCERZW5G6KFGEHRX08XW"}}

The feature works fine for me, It claimed two moments with no issue.

10/03/23 21:09:00 - DEBUG - TwitchChannelPointsMiner.classes.WebSocketsPool - [on_message]: #4 - Received: { "type": "PONG" }
10/03/23 21:09:02 - DEBUG - TwitchChannelPointsMiner.classes.WebSocketsPool - [on_message]: #1 - Received: {"type":"MESSAGE","data":{"topic":"community-moments-channel-v1.26921830","message":"{\"type\":\"active\",\"data\":{\"moment_id\":\"9f3ee4d7-b0c8-4629-8f2c-5db7fc47c186\",\"channel_id\":\"26921830\",\"clip_slug\":\"GeniusFairKumquatFreakinStinkin-PW5OUByrEZQp0bFJ\"}}"}}

10/03/23 21:09:02 - DEBUG - TwitchChannelPointsMiner.classes.Twitch - [post_gql_request]: Data: {'operationName': 'CommunityMomentCallout_Claim', 'extensions': {'persistedQuery': {'version': 1, 'sha256Hash': 'e2d67415aead910f7f9ceb45a77b750a1e1d9622c936d832328a0689e054db62'}}, 'variables': {'input': {'momentID': '9f3ee4d7-b0c8-4629-8f2c-5db7fc47c186'}}}, Status code: 200, Content: {"data":{"claimCommunityMoment":{"moment":{"id":"9f3ee4d7-b0c8-4629-8f2c-5db7fc47c186","__typename":"CommunityMoment"},"error":null,"__typename":"ClaimCommunityMomentPayload"}},"extensions":{"durationMilliseconds":10,"operationName":"CommunityMomentCallout_Claim","requestID":"01GV6NP98F862E4YHNJH5PSPF4"}}


--

11/03/23 01:31:46 - DEBUG - TwitchChannelPointsMiner.classes.WebSocketsPool - [on_message]: #1 - Received: {"type":"MESSAGE","data":{"topic":"community-moments-channel-v1.26921830","message":"{\"type\":\"active\",\"data\":{\"moment_id\":\"fcc4c0af-b617-4985-be1f-3a302d2fece6\",\"channel_id\":\"26921830\",\"clip_slug\":\"PrettiestClumsySwanKevinTurtle-lnhuyYXuTWC_KACi\"}}"}}

11/03/23 01:31:47 - DEBUG - TwitchChannelPointsMiner.classes.Twitch - [post_gql_request]: Data: {'operationName': 'CommunityMomentCallout_Claim', 'extensions': {'persistedQuery': {'version': 1, 'sha256Hash': 'e2d67415aead910f7f9ceb45a77b750a1e1d9622c936d832328a0689e054db62'}}, 'variables': {'input': {'momentID': 'fcc4c0af-b617-4985-be1f-3a302d2fece6'}}}, Status code: 200, Content: {"data":{"claimCommunityMoment":{"moment":{"id":"fcc4c0af-b617-4985-be1f-3a302d2fece6","__typename":"CommunityMoment"},"error":null,"__typename":"ClaimCommunityMomentPayload"}},"extensions":{"durationMilliseconds":8,"operationName":"CommunityMomentCallout_Claim","requestID":"01GV74QCERZW5G6KFGEHRX08XW"}}

That's great! Thanks for the feedback!

2bc4 commented

I can also confirm that multiple moments were claimed successfully on my end, seems like there's no issues with it. ๐Ÿ‘

@rdavydov - Can also confirm a successful claim after patiently wait for one to be created.
Full debug log attached for you if needed for error handling and whatnot.
Included everything from the PubSub Ping / Pong to the moment GQL request - There is a bunch of Drops Campaign info to likely skip over.
MomentCapture.log

@rdavydov - Can also confirm a successful claim after patiently wait for one to be created. Full debug log attached for you if needed for error handling and whatnot. Included everything from the PubSub Ping / Pong to the moment GQL request - There is a bunch of Drops Campaign info to likely skip over. MomentCapture.log

Nice, thanks for the feedback! I'm glad that it works as expected. :)