How to download HTTP Dynamic Streaming video using Livestreamer and UnPlug

Many websites now provide video using Adobe's HTTP Dynamic Streaming. Some videos delivered using this method can be viewed and downloaded by using Livestreamer and UnPlug without running non-free JavaScript.

First install the Mozilla add-on UnPlug in Abrowser:

https://addons.mozilla.org/en-US/firefox/addon/unplug/

Then install livestreamer using pip:

$ sudo aptitude install python-pip
$ sudo pip install livestreamer

or alternatively using easy_install

$ sudo easy_install livestreamer

In order to upgrade livestreamer run the command:

$ sudo pip install --upgrade livestreamer

or

$ sudo easy_install -U livestreamer

Here is an example of a website offering video using HTTP Dynamic Streaming:

http://news.walla.co.il/mahadura/?w=//2715352

By clicking the UnPlug icon the following link is offered but cannot be downloaded using the browser:

http://cache02.mintmark.co.il:1935/redirector/mediacache/_definst_/mp4:http/media_iphone/016/172/1617283-42.mp4

Now copy this link to Abrowser and insert "view-source:" before it:

view-source:http://cache02.mintmark.co.il:1935/redirector/mediacache/_definst_/mp4:http/media_iphone/016/172/1617283-42.mp4

Now more links are offered. Copy the one you want into Abrowser and add "view-source:" again:

view-source:http://199.203.85.3:1935/mediacache/_definst_/mp4:http/media_iphone/016/172/1617283-42.mp4/chunklist.m3u8?wowzasessionid=273365045

Now we are offered this link followed by a list of *.ts files so this is the final link:

https://stream01.wcdn.co.il/mediacache/_definst_/mp4:http/media_iphone/016/172/1617283-42.mp4/key.m3u8key?wowzasessionid=273365045

Now remove the final part (that starts with "key"), replace it by "manifest.f4m" and add "hds://" to the beginning of the url and feed it to livestreamer:

$ livestreamer hds://https://stream01.wcdn.co.il/mediacache/_definst_/mp4:http/media_iphone/016/172/1617283-42.mp4/manifest.f4m

Now you will see the following output:

[cli][info] Found matching plugin stream for URL hds://https://stream01.wcdn.co.il/mediacache/_definst_/mp4:http/media_iphone/016/172/1617283-42.mp4/manifest.f4m
Available streams: 234p (worst, best)

Now select the quality (e.g. "best") and download using "-o filename":

$ livestreamer hds://https://stream01.wcdn.co.il/mediacache/_definst_/mp4:http/media_iphone/016/172/1617283-42.mp4/manifest.f4m best -o out.flv

You will see that livestreamer is downloading the file:

[cli][info] Found matching plugin stream for URL hds://https://stream01.wcdn.co.il/mediacache/_definst_/mp4:http/media_iphone/016/172/1617283-42.mp4/manifest.f4m
[cli][info] Opening stream: 234p
Written 5661062 bytes[cli][error] Error when reading from stream: Read timeout

[cli][info] Stream ended

Now you can view the video using your favorite video player such as Totem, VLC or MPlayer. If you just want to view the stream without downloading it simply run the last command without the "-o" part:

$ livestreamer hds://https://stream01.wcdn.co.il/mediacache/_definst_/mp4:http/media_iphone/016/172/1617283-42.mp4/manifest.f4m best

The default player used is VLC. In order to use MPlayer instead create a file "~/.livestreamerrc" and paste into it:

player=mplayer -cache 2048

Update (November 2014): the Walla website has changed recently. In order to apply the above method one needs to set the user agent to a mobile device such as Android using user agent switcher add-on and one also needs to enable JavaScript from the domain Walla (if one uses NoScript).

Revisions

07/27/2014 - 10:10
aloniv