Documented API for streams and VODs
It would be most helpful if there was a documented API for accessing live and VOD video streams that 3rd party clients could use.
It's no secret that there are a variety of 3rd party clients for different platforms that use undocumented APIs that Twitch has made available for a long time. Understandably this is not officially supported, and the future of this status quo is unclear.
See detailed comment below.
6 commentsComments are closed
But how can a channel by the name Dotatv247 be fully automated? Any guides to it?
While we have not provided an official API endpoint to retrieve a URL directly to streaming video, it's fair to say there was ambiguity in the developer agreement regarding this use case. As such, we've updated the section regarding embeddable experiences in the latest version of the developer agreement. It states that the embeddable player should be used to display Twitch content. You can see our mention of the update here: https://discuss.dev.twitch.tv/t/revised-developer-agreement/28101/
BugSlayerJohn, if it’s possible to use Webhooks in your development, the “Stream Changed” topic is going to provide the least latency when checking if a broadcaster is live or offline (https://dev.twitch.tv/docs/api/webhooks-reference#topic-stream-changed). Afterwards, “Get Streams” will also work to perform this check as you have mentioned.
Regarding MP4 URLs to download VODs, this is being tracked on “Extend Clips API to provide the MP4 url so editors can automate downloads,” which could also apply to all types of VODs. Please vote or add a comment on this idea if this is of interest: https://twitch.uservoice.com/forums/310213-developers/suggestions/39228784-extend-clips-api-to-provide-the-mp4-url-so-editors
There were undocumented endpoints to do this until a few days ago, when it appears they were deliberately shut down for 3rd party Client-IDs. These undocumented endpoints were the only way to:
- Determine whether a channel is actually broadcasting RIGHT NOW. There is an endpoint for getting current stream information for a channel, but it is delayed several minutes (I.E. returns null during the first several minutes of a broadcast, and returns stream information for several minutes after a broadcast ends.) For many systems this level of delay is simply not adequate.
- Reach the actual video stream. There are plenty of reasonable use cases for this, from 3rd party players, to automating archival, and more. In my case the video stream was needed for computer vision purposes (models processing the stream data to determine information about the game.)
The loss of these APIs leaves no workaround. I currently have no way to reliably determine whether a channel is actively broadcasting, and no way to access the actual broadcast video.
For comparison, Mixer works great: stream status information in official APIs is accurate to a split second at broadcast start and end, and fully supported well documented endpoints expose current broadcast manifests in 3 different formats.
@Breci Not just VODs, and not a download link, just the usual HLS. This absolutely could be put behind a separate oauth scope if that's something that would be helpful to Twitch.
In the current iteration of what I get in the browser, the HLS happens in the open; this doesn't give me a clear idea of to what degree Twitch wants to prevent unauthorized use, compared to say if they were using EME or similar. I appreciate that Twitch may see restricting access from third party client IDs as an element of defense-in-depth, and they may have future changes to this in the works. For now I can't draw any conclusion from this either way.
Whether third-party clients can access video is Twitch's decision to make. I want them to make it knowing that it is something someone is interested in.
I mainly use a 3rd party client as there are issues with how HP implemented their motherboard with the i7 processor in it that impacts long term performance, web browsers on my system(a linux system, i know twitch care little about us) cant take advantage of vaapi and one that do still drop frames like MAD. so the only choice i have is to use streamlink-twitch-gui and mpv to get a decent experience watching twitch.
this decision to randomly disable the undocumented API has seriously reduced when i watch twitch, i am also considering stopping my subs if this continues into December
Basically you'd like a download link on VODs, behind a oauth scope?
For live streams, you can always work with streamers so they can stream to your own servers and then do what you want with the data and send it to Twitch. otherwise it wouldn't be secure and would let malicious people to save copies of stream that aren't meant to have a VOD.