Add twitch video (not clip) support
Seemingly, during the initial PR for Twitch Clip support, VOD support was added and then removed citing that "there's no point in downloading entire streams". Unfortunately, the /videos/ portion of the URI also happens to include highlights which are considerably more useful to download. I think it'd be nice if this was re-added if that's possible.
I think there is actually a great point in downloading entire streams anyway! VODs do get deleted after some time and so many people do download streams to preserve them. I'd love for that to be re-added.
hello! Any update on this?
would really love to use this feature as a speedrun moderator. many runs are submitted with twitch videos, and online tools for frame perfect retimes aren't always reliable
Just chiming into say this would be a nice feature, and I agree with the previous commenters. If nothing else, it's probably worth updating the documentation to say Cobalt only supports Twitch clips (and not VODs) in the meantime.
Just ran into this problem of not being able to download a full VOD to create clips. Definitely worth disclaiming that only clips are supported in the “Supported services” dropdown, or clarifying it if someone enters a twitch.tv link that isn’t detected as a clip.
I leave here some instruction in case of someone will want to implement vod downloading.
- Receive the
PlaybackAccessTokenvia a basic gql call, like this:
PlaybackAccessToken: (vod_id: string) => {
return {
operationName: "PlaybackAccessToken",
variables: {
isLive: false,
login: "",
isVod: true,
vodID: vod_id,
playerType: "channel_home_live",
platform: "web",
},
extensions: {
persistedQuery: {
version: 1,
sha256Hash: "ed230aa1e33e07eebb8928504583da78a5173989fadfb1ac94be06a04f3cdbe9";
}
}
}
};
- Get the VOD m3u8 manifest with available sources from the URL:
https://usher.ttvnw.net/vod/${vod_id}.m3u8?${query}. The query parameters should include thesigandtokenobtained in step 1. Parse it to get URLs for different qualities. query example:
const query = new URLSearchParams({
// not needed
// acmb: eyJBcHBWZXJzaW9uIjoiMTQwZjZkMDMtZjUyYS00MjZiLTk4NGQtYTMyZWEwYTQyZWNkIn0=
allow_source: "true",
browser_family: "chrome",
browser_version: "131.0",
cdm: "wv",
os_name: "Windows",
os_version: "NT 10.0",
p: "3141898",
platform: "web",
// not needed
// play_session_id: b4c74da3c461e38af1384931fdac1b13
player_backend: "mediaplayer",
player_version: "1.36.0-rc.1",
playlist_include_framerate: "true",
reassignments_supported: "true",
sig: sig,
supported_codecs: "av1,h265,h264",
token: token,
transcode_mode: "cbr_v1",
});
- Choose a quality and get the final m3u8 with TS chunks (there is no need for a token here).
- Download the chunked video. Use url of m3u8 + name of ts chunk.
P.S.: There is no rate limiting for downloading chunks; you can download many parts concurrently (I checked 10 parallel downloads).
100% upvote this.
Is this ever happening?