aboutsummaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/extractor/rtl2.py
diff options
context:
space:
mode:
authorYen Chi Hsuan <[email protected]>2015-08-21 13:20:32 +0800
committerYen Chi Hsuan <[email protected]>2015-08-21 13:20:51 +0800
commit5e1a5ac8de12391cb22d2fa0dfb2119527bd7fc2 (patch)
tree1b8617f5b16f2396130a0f36cb5b56cfaef4f772 /youtube_dl/extractor/rtl2.py
parent9eb4ab6ad915a777b6f7d7b39d03d05d7d31cd24 (diff)
downloadyoutube-dl-5e1a5ac8de12391cb22d2fa0dfb2119527bd7fc2.tar.gz
youtube-dl-5e1a5ac8de12391cb22d2fa0dfb2119527bd7fc2.zip
[rtl2] Fix extraction for test_RTL2_1
Diffstat (limited to 'youtube_dl/extractor/rtl2.py')
-rw-r--r--youtube_dl/extractor/rtl2.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/youtube_dl/extractor/rtl2.py b/youtube_dl/extractor/rtl2.py
index 9e0c6890e..276612fc7 100644
--- a/youtube_dl/extractor/rtl2.py
+++ b/youtube_dl/extractor/rtl2.py
@@ -1,6 +1,7 @@
# encoding: utf-8
from __future__ import unicode_literals
+import re
from .common import InfoExtractor
@@ -28,6 +29,10 @@ class RTL2IE(InfoExtractor):
'title': 'Anna erwischt Alex!',
'description': 'Anna ist Alex\' Tochter bei Köln 50667.'
},
+ 'params': {
+ # rtmp download
+ 'skip_download': True,
+ },
}]
def _real_extract(self, url):
@@ -38,10 +43,17 @@ class RTL2IE(InfoExtractor):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
- vico_id = self._html_search_regex(
- r'vico_id\s*:\s*([0-9]+)', webpage, 'vico_id')
- vivi_id = self._html_search_regex(
- r'vivi_id\s*:\s*([0-9]+)', webpage, 'vivi_id')
+ mobj = re.search(
+ r'<div[^>]+data-collection="(?P<vico_id>\d+)"[^>]+data-video="(?P<vivi_id>\d+)"',
+ webpage)
+ if mobj:
+ vico_id = mobj.group('vico_id')
+ vivi_id = mobj.group('vivi_id')
+ else:
+ vico_id = self._html_search_regex(
+ r'vico_id\s*:\s*([0-9]+)', webpage, 'vico_id')
+ vivi_id = self._html_search_regex(
+ r'vivi_id\s*:\s*([0-9]+)', webpage, 'vivi_id')
info_url = 'http://www.rtl2.de/video/php/get_video.php?vico_id=' + vico_id + '&vivi_id=' + vivi_id
info = self._download_json(info_url, video_id)