twitch-chatlog icon indicating copy to clipboard operation
twitch-chatlog copied to clipboard

Support Clips

Open freaktechnik opened this issue 7 years ago • 12 comments

Support fetching the chatlog from clips. This probably involves getting the VOD ID for the clip and the start offset. Or maybe there's a dedicated chat replay API.

freaktechnik avatar Dec 22 '17 20:12 freaktechnik

That's exactly how twitch does it. https://clips.twitch.tv/api/v2/clips/DepressedAdventurousPeanutKAPOW contains the VOD ID and content_offset_seconds value.

freaktechnik avatar Dec 22 '17 20:12 freaktechnik

I guess that information would also be in https://dev.twitch.tv/docs/v5/reference/clips#get-clip (offset is available as vod.offset)

freaktechnik avatar Dec 22 '17 20:12 freaktechnik

Sadly helix will not carry the offset.

freaktechnik avatar Dec 22 '17 20:12 freaktechnik

Any progress on the edition of clips support? I found this npm package and I need to extract chat data of a clip and this is the best I could find.

OgulcanCelik avatar Sep 01 '18 15:09 OgulcanCelik

I haven't worked on this at all. What needs to be done is primarily actually detecting when a clip should be loaded (or add a special param for it) and then getting the offset, length and source VOD id from the API above and then run the normal logic with that.

freaktechnik avatar Sep 01 '18 15:09 freaktechnik

Hmm, I tried exactly that, however, the length command does not work it seems. Maybe API is changed? Because whatever parameter I give as length, the outcome is always the same length chat log. If I can set the length of log with the starting time, I can get all information I want since clip api returns the vod id, clip offset as second and the length.

OgulcanCelik avatar Sep 01 '18 15:09 OgulcanCelik

The length option is working as expected for me. It will always return all message chunks that are in the given time range, which may return a few extra messages. There also may not be messages at all.

Specific parameters where it's not working for you would be very helpful.

freaktechnik avatar Sep 01 '18 16:09 freaktechnik

Thanks for replies, I really appreciate it! The clip which I'm trying to get it's text data is this: https://clips.twitch.tv/BenevolentPunchyLyrebirdMingLee. So I know the vod id of it is: 302339233, and the vodoffset is: 37565. Clip length is also 1 minute. So I'm trying with these parameters but only got few chat logs: twitch-chatlog 302339233 --start 10:26:04 -l 600 -C kimne78kx3ncx6brgo4mv6wki5h1ko

OgulcanCelik avatar Sep 01 '18 16:09 OgulcanCelik

Thank you for that. I've found a bug in the logic that decides if it should load another fragment. This should be fixed in 6.0.1

freaktechnik avatar Sep 01 '18 16:09 freaktechnik

It's fixed thank you very much. Uhm could be stupid but I have one more question. Do I need to use this packet only on console? I mean, is it possible to invoke the twitch-chatlog command like in an another js. file which could do some work with the output?

OgulcanCelik avatar Sep 02 '18 00:09 OgulcanCelik

You can invoke it like any other module. you can load the main module that does the whole loading with require("twitch-chatlog/lib"). All exported functions have docblocks, so you should be able to figure out how to use them - though the documentation may happen to be out of date in places. In general, the binary shows the usage of the exported functions, too.

freaktechnik avatar Sep 02 '18 00:09 freaktechnik

Okay. Thank you very much again for this awesome module.

OgulcanCelik avatar Sep 02 '18 00:09 OgulcanCelik