FriendTeamInc / VodBot

A command line interface VOD and Clip manager for Twitch.
MIT License
14 stars 1 forks source link

Stream chapters #34

Closed NotQuiteApex closed 2 years ago

NotQuiteApex commented 3 years ago

Twitch does not have a proper api endpoint for this, and whenever a request is made for a stream it always returns the first game played. However, there is a section of the video query called "moments" (VideoMomentConnection) that can be pulled. It's paginated, which shouldn't be a massive deal. It shows all the games switched to, how long each section lasted and when the section began in the stream. It should be noted that this is measured with milliseconds, not seconds.

# VOD chapters query
GET_VIDEO_CHAPTERS = """{{
video(id: {id}) {{
    moments(first=100) {{
        edges {{ cursor node {{
            createdAt description subDescription id type
            positionMilliseconds durationMilliseconds
}}  }}  }}  }}  }}
"""

Pulling this info for metadata purposes as well as displaying it when staging videos would be uber helpful.