Downloading VODs

Twitch currently doesn't give you a way to download VODs from their website. Just because they don't really let you, doesn't mean it's impossible. There are a few hoops you need to jump through in order to do so.

When you watch a stream or VOD on Twitch, the entire video isn't downloaded to your computer all at once. It is split up into around 1mb chunks and sent down to you. In order to tell the flash player what all the chunks are and where they are located, Twitch sends basically a playlist to the player. It's this playlist that we need to get.

Here's the basic request flow:
Twitch VOD download request flow

1. Fetch Access Token


Returns: {"token":"{"user_id":null,"vod_id":VOD-ID,"expires":1432939520,"chansub":{"restricted_bitrates":[]},"privileged":false}","sig":"abc123"}

The "VOD-ID" is the id from a vod url. For example, 5492597 from

2. Fetch Quality Playlist




You can use any url in the list but the first one is the highest quality.

3. Fetch Playlist





Each of these index-* files are parts of the VOD. You can now append them to the url you just grabbed the playlist from to download each file.


Example Code

I put together a quick script up on Github that does all this for you and appends all the pieces into one file. Just pass it a VOD like so ruby download.rb

There will be more on something cool you can do with these vods in a future post. :)