Download videos from Yle servers
Copyright (C) 2010-2017 Antti Ajanki, antti.ajanki@iki.fi
License: GPLv3
Homepage: https://aajanki.github.com/yle-dl/index-en.html
Source code: https://github.com/aajanki/yle-dl
yle-dl is a tool for downloading media files from the video streaming services of the Finnish national broadcasting company Yle: Yle Areena, Elävä Arkisto and Yle news.
Installation
Below are general installation instructions. See a separate page for specialized installation instructions for Debian, Ubuntu and Mac OS X.
1. Install the dependencies
- Python 2.7 or 3.5+
- pip
- pycrypto
- wget
- PHP interpreter
- PHP extensions: bcmath, curl, mcrypt and SimpleXML
- ffmpeg
- setuptools (when installing from the sources)
Optionally for certain types of streams:
- rtmpdump (for downloading Areena audio streams. Version 2.4 or newer, preferably the latest development version from the project homepage at https://rtmpdump.mplayerhq.hu/)
Enable the PHP extensions by appending the following lines with the correct paths in the php.ini:
extension=/path/to/curl.so
extension=/path/to/mcrypt.so
2. Install yle-dl
Easier way (installation without downloading the source codes):
sudo pip install --upgrade yle-dl
Installation from sources. Download the sources and run the following on the source directory:
sudo python setup.py install
Installation with youtube-dl as an alternative downloader backend
By default, yle-dl downloads streams from Yle Areena using the included copy of AdobeHDS.php. If the default downloader does not work for some reason, it is possible to use youtube-dl instead. yle-dl will automatically fall back to youtube-dl if it is installed and downloading with AdobeHDS.php fails.
Follow the above installation instructions (except for the PHP and the PHP libraries) and additionally install youtube-dl:
- Mac OS X:
brew install youtube-dl - Debian/Ubuntu/other operating systems:
pip install --upgrade youtube_dl
Using with libav instead of ffmpeg
yle-dl --ffmpeg avconv --ffprobe avprobe ...
Integration tests
python setup.py pytest
Some tests succeed only when run on a Finnish IP address because some
Areena streams are available only in Finland. To skip those test, set
the environment variable ENABLE_FINLAND_TESTS to 0:
export ENABLE_FINLAND_TESTS=0
python setup.py pytest
Packages for various distros
Usage
yle-dl [options] URL
or
yle-dl [options] -i filename
where URL is the address of the Areena or Elävä arkisto web page where you would normally watch the video in a browser.
yle-dl options:
-
-o filenameSave stream to the named file -
-i filenameRead input URLs to process from the named file, one URL per line -
--latestepisodeDownload the latest episodes -
--showurlPrint the URL of the stream, don't download -
--showtitlePrint stream title, don't download -
--showmetadataPrint stream metadata as JSON -
--vfatCreate Windows-compatible filenames -
--audiolang langSelect stream's audio language if available, lang = fin (default) or swe -
--sublang langDownload stream's subtitle language, lang = fin, swe, smi, none or all (default) -
--resolution resMaximum vertical resolution in pixels -
--maxbitrate brMaximum bitrate stream to download, integer in kB/s or "best" or "worst". Not all streams support limited bitrates. -
--rtmpdump pathSet path to rtmpdump binary -
--adobehds cmdSet command for executing AdobeHDS.php script -
--postprocess cmdExecute a command cmd after a successful download. The command is called with the downloaded FLV file as the first parameter and subtitle files (if any) as the following parameters. -
--proxy uriProxy for downloading stream manifests. Example:--proxy socks5://localhost:7777 -
--destdir dirSave files to dir -
--pipeDump stream to stdout for piping to media player. E.g.yle-dl --pipe URL | vlc -. -
--backend valsDownloaders that are tried until one of them succeeds (a comma-separated list). Possible values:adobehdsphp(download HDS streams using AdobeHDS.php),youtubedl(download HDS streams using youtube-dl). -
-V, --verboseShow verbose debug output
Type yle-dl --help to see the full list of options.
Any unrecognized options will be relayed to rtmpdump process (when downloading RTMP streams).
Firewall must allow outgoing traffic on ports 80 and 1935.
Examples
yle-dl https://areena.yle.fi/1-1544491 -o video.flv
yle-dl --backend youtubedl https://areena.yle.fi/1-1544491 -o video.flv
yle-dl http://yle.fi/aihe/artikkeli/2010/10/28/studio-julmahuvi-roudasta-rospuuttoon
Playing in mplayer (or vlc and others) without downloading first:
yle-dl --pipe https://areena.yle.fi/1-2409251 | vlc --file-caching=10000 -
Executing a script to postprocess a downloaded video (see the example postprocessing script at scripts/muxmp4):
yle-dl --postprocess scripts/muxmp4 https://areena.yle.fi/1-1864726
Set default values for arguments using alias:
alias yle-dl-defaults="yle-dl --resolution 720p --destdir ~/videos"
yle-dl-defaults https://areena.yle.fi/1-1864726