Svtplay

From Umeå Hackerspace
Jump to: navigation, search

I have been coding some stuff for svtplay. svtplaydump This is what I have learned: Svt uses HLS. They have no plans to use the html5 standard as it doesn't support DRM. The content they make available is either clips or videos and is of a program. The unique identifier for all content is article_id. For some content HLS encryption is used. For a simple decoding method see download_from_playlist in svtplaydump. ffmpeg and mplayer also decrypts on the fly when streaming. They have a bunch of undocumented API's.

Proxy use of svtplaydump

svtplaydump downloads the (chopped up) encrypted MPEG TS video stream from SVT Play and at the same time retrieves the AES decryption key through the HTTP header EXT-X-KEY. This stream is piped (concatenated) through mkvmerge, which assembles an MKV file with proper metadata and can deliver the resulting stream to STDOUT.

Assuming svtplaydump runs as a web service over HTTP, where a functional GET API is already implemented and thus can get a URL path, we can deliver the STDOUT data for users to download as a file through a web browser or similar. Currently there are no plans to implement partial retrieval with an initial offset.

Planned setup

The suggestion is to run a simple redirect service on svtget.se:80 and access a list of (running) proxies. The list will consist of IPs/hostnames and ports for running proxies and is delivered with a temporary HTTP redirect. These proxies will probably be listening on other ports than :80.

Example usage

wget http://svtget.se/video/1315147/del-5-av-8-manniskans-forsta-krig
URL='http://www.svtplay.se/video/1315147/del-5-av-8-manniskans-forsta-krig'
curl $(echo $URL | sed s/svtplay\.se/svtget.se/) > video.mkv

SVT Play's API

/ajax/videos?antal=100&category=news&sida=2

Get all programs in html

antal
is the number of items per page. Default is 8.
category
is the category, can be multiple
sida
is the paging. Default is 1
title
only show matching title
context=title
?Don't concatenate title and part?
/ajax/videospager?category=news 

This is is very much like the call above but returns a total footer. Antal and sida does not work.

/kanaler/svt2?output=json
/ajax/rekommenderatpager?
/ajax/program.json

Returns all programs with metadata

/ajax/clipspager?category=news&style=Alt
/ajax/sok/avsnitt?q=uppdra&sida=2&antal=8
/ajax/sok/live?q=a&sida=2&antal=8
/ajax/sok/klipp?style=Alt&q=a&sida=2&antal=8
/ajax/sok/program?q=a&sida=2&antal=8