freaktechnik / twitch-chatlog

Fetch the chatlog to a twitch VOD from your command line.
https://www.npmjs.com/package/twitch-chatlog
MIT License
83 stars 15 forks source link

Support Clips #69

Open freaktechnik opened 6 years ago

freaktechnik commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

Sadly helix will not carry the offset.

OgulcanCelik commented 6 years ago

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.

freaktechnik commented 6 years ago

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.

OgulcanCelik commented 6 years ago

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.

freaktechnik commented 6 years ago

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.

OgulcanCelik commented 6 years ago

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

freaktechnik commented 6 years ago

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

OgulcanCelik commented 6 years ago

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?

freaktechnik commented 6 years ago

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.

OgulcanCelik commented 6 years ago

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