aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/helsinki.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-02-17 11:26:09 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-02-17 11:26:09 +0100
commit4412ca751d68185ed60b0164b91687073215f01e (patch)
treea733a79456f82cab1cb60c9ad98d8d98006d7d6d /youtube_dl/extractor/helsinki.py
parentcbffec0c95043656a12b9900507bb8dc34b35e0b (diff)
parent66c43a53e4b1b4d4e530ae4dcded2d382d51b264 (diff)
Merge remote-tracking branch 'Nikerabbit/hki'
Diffstat (limited to 'youtube_dl/extractor/helsinki.py')
-rw-r--r--youtube_dl/extractor/helsinki.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/youtube_dl/extractor/helsinki.py b/youtube_dl/extractor/helsinki.py
new file mode 100644
index 000000000..2a54f3cca
--- /dev/null
+++ b/youtube_dl/extractor/helsinki.py
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+
+
+class HelsinkiIE(InfoExtractor):
+ _VALID_URL = r'https?://video\.helsinki\.fi/Arkisto/flash\.php\?id=(?P<id>\d+)'
+ _TEST = {
+ 'url': 'http://video.helsinki.fi/Arkisto/flash.php?id=20258',
+ 'md5': 'cd829201b890905682eb194cbdea55d7',
+ 'info_dict': {
+ 'id': '20258',
+ 'ext': 'mp4',
+ 'title': 'Tietotekniikkafoorumi-iltapäivä',
+ }
+ }
+
+ def _real_extract(self, url):
+ mobj = re.match(self._VALID_URL, url)
+ vid = mobj.group('id')
+ webpage = self._download_webpage(url, vid)
+ formats = []
+ mobj = re.search('file=((\w+):[^&]+)', webpage)
+ if mobj: formats.append({
+ 'ext': mobj.group(2),
+ 'play_path': mobj.group(1),
+ 'url': 'rtmp://flashvideo.it.helsinki.fi/vod/',
+ 'player_url': 'http://video.helsinki.fi/player.swf',
+ 'format_note': 'sd'
+ })
+
+ mobj = re.search('hd\.file=((\w+):[^&]+)', webpage)
+ if mobj: formats.append({
+ 'ext': mobj.group(2),
+ 'play_path': mobj.group(1),
+ 'url': 'rtmp://flashvideo.it.helsinki.fi/vod/',
+ 'player_url': 'http://video.helsinki.fi/player.swf',
+ 'format_note': 'hd'
+ })
+
+ return {
+ 'id': vid,
+ 'title': self._og_search_title(webpage).replace('Video: ', ''),
+ 'description': self._og_search_description(webpage),
+ 'thumbnail': self._og_search_thumbnail(webpage),
+ 'formats': formats
+ }