aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dl/extractor/mdr.py
diff options
context:
space:
mode:
authorRogério Brito <rbrito@ime.usp.br>2014-06-08 10:58:42 -0300
committerRogério Brito <rbrito@ime.usp.br>2014-06-08 10:58:42 -0300
commitc512650955de0b16d37e7fa7fb29ea0985e415bb (patch)
tree73fbcea5bc59685ab210c78be9f088671bae60a5 /youtube_dl/extractor/mdr.py
parentaf478477605bdf3f5d57562035885cfee905f379 (diff)
downloadyoutube-dl-c512650955de0b16d37e7fa7fb29ea0985e415bb.zip
youtube-dl-c512650955de0b16d37e7fa7fb29ea0985e415bb.tar.gz
youtube-dl-c512650955de0b16d37e7fa7fb29ea0985e415bb.tar.bz2
Imported Upstream version 2014.06.07
Diffstat (limited to 'youtube_dl/extractor/mdr.py')
-rw-r--r--youtube_dl/extractor/mdr.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/youtube_dl/extractor/mdr.py b/youtube_dl/extractor/mdr.py
index 7aa0080..1b8c4a3 100644
--- a/youtube_dl/extractor/mdr.py
+++ b/youtube_dl/extractor/mdr.py
@@ -1,15 +1,18 @@
+from __future__ import unicode_literals
+
import re
from .common import InfoExtractor
-from ..utils import (
- ExtractorError,
-)
class MDRIE(InfoExtractor):
- _VALID_URL = r'^(?P<domain>(?:https?://)?(?:www\.)?mdr\.de)/mediathek/(?:.*)/(?P<type>video|audio)(?P<video_id>[^/_]+)_.*'
+ _VALID_URL = r'^(?P<domain>https?://(?:www\.)?mdr\.de)/(?:.*)/(?P<type>video|audio)(?P<video_id>[^/_]+)(?:_|\.html)'
# No tests, MDR regularily deletes its videos
+ _TEST = {
+ 'url': 'http://www.mdr.de/fakt/video189002.html',
+ 'only_matching': True,
+ }
def _real_extract(self, url):
m = re.match(self._VALID_URL, url)
@@ -19,9 +22,9 @@ class MDRIE(InfoExtractor):
# determine title and media streams from webpage
html = self._download_webpage(url, video_id)
- title = self._html_search_regex(r'<h2>(.*?)</h2>', html, u'title')
+ title = self._html_search_regex(r'<h[12]>(.*?)</h[12]>', html, 'title')
xmlurl = self._search_regex(
- r'(/mediathek/(?:.+)/(?:video|audio)[0-9]+-avCustom.xml)', html, u'XML URL')
+ r'dataURL:\'(/(?:.+)/(?:video|audio)[0-9]+-avCustom.xml)', html, 'XML URL')
doc = self._download_xml(domain + xmlurl, video_id)
formats = []
@@ -41,7 +44,7 @@ class MDRIE(InfoExtractor):
if vbr_el is None:
format.update({
'vcodec': 'none',
- 'format_id': u'%s-%d' % (media_type, abr),
+ 'format_id': '%s-%d' % (media_type, abr),
})
else:
vbr = int(vbr_el.text) // 1000
@@ -49,12 +52,9 @@ class MDRIE(InfoExtractor):
'vbr': vbr,
'width': int(a.find('frameWidth').text),
'height': int(a.find('frameHeight').text),
- 'format_id': u'%s-%d' % (media_type, vbr),
+ 'format_id': '%s-%d' % (media_type, vbr),
})
formats.append(format)
- if not formats:
- raise ExtractorError(u'Could not find any valid formats')
-
self._sort_formats(formats)
return {