ruutu-dl - Download video from ruutu.fi and jimtv.fi

As of 01 January 2018, this page and related content is no longer maintained. Content is preserved as-is for reference, archival, and historical reasons. Use at your own peril.

Description

ruutu-dl is a tool for downloading videos from ruutu.fi and jimtv.fi. ruutu-dl itself only parses HTML to resolve actual media URI and to generate output filename. Video payload is streamed using flvstreamer.

Download

Usage

% ruutu-dl http://www.jimtv.fi/ohjelmat/poliisit/etusivu/video/poliisit-kausi-5-jakso-51
% ruutu-dl http://www.jimtv.fi/.../poliisit-kausi-5-jakso-51 output.mp4

Please do observe flvstreamer’s output. Despite the effort ruutu-dl takes to work around issues with ruutu.fi, flvstreamer sometimes exists ungracefully and leaves a broken video behind. If you see an error from flvstreamer right before ruutu-dl returns, the file is probably broken. Trying again usually helps.

For reasons unknown to the author of ruutu-dl, ruutu.fi’s streaming servers sometimes behave badly, rendering the download nearly impossible. When this happens, the file download stops after less than a megabyte and flvstreamer keeps breaking the file continuously. Retrieving the entire file is then forbiddinly slow process - if possible at all.

Requirements

ruutu-dl is written in Ruby and it uses PTY module to spawn and watch flvstreamer, which is used to download actual data.

Technical stuff

At first glimpse ruutu-dl looks unnecessary compilcated. If you’re lucky, it is. Author used to download videos from ruutu.fi and friends using rtmpdump until he realised it didn’t work correctly. On author’s computer, rtmpdump restarts download every few megabytes and produces a broken video that is ten times the size of a working video. flvstreamer, on the other hand, freezes every few megabytes, but when aborted and restarted manually, produces a fully working video most of the time. Interestinly enough using flvstreamer’s timeout switch breaks the video. As a result, Ruby-version of ruutu-dl was born.

Current generation of ruutu-dl tries to recover from flvstreamer errors by remembering the file size and tail of the file for a few most recent attempts. When flvstreamer reports a broken file, ruutu-dl attempts to restore an older version of the file. Usually this works, but there are occasions when it doesn’t.