X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fheise.py;h=278d9f527fd41c8e1e2c180a9ae455a23fbef1fc;hb=ef428960c9b3972586977446e82ec3872094cc1e;hp=b3cb10fde4f900402add8033165c4b35988f5225;hpb=0155549d6cec6f49279ebe4a5a73cf6dcc6716fe;p=youtube-dl.git diff --git a/youtube_dl/extractor/heise.py b/youtube_dl/extractor/heise.py index b3cb10fde..278d9f527 100644 --- a/youtube_dl/extractor/heise.py +++ b/youtube_dl/extractor/heise.py @@ -1,120 +1,79 @@ # coding: utf-8 from __future__ import unicode_literals -import re - from .common import InfoExtractor from ..utils import ( - ExtractorError, - compat_urllib_parse, - get_meta_content, + determine_ext, + int_or_none, parse_iso8601, ) class HeiseIE(InfoExtractor): - _VALID_URL = ( - r'^https?://(?:www\.)?heise\.de/video/artikel/' + - r'.+?(?P[0-9]+)\.html$' - ) + _VALID_URL = r'''(?x) + https?://(?:www\.)?heise\.de/video/artikel/ + .+?(?P[0-9]+)\.html(?:$|[?#]) + ''' _TEST = { 'url': ( - 'http://www.heise.de/video/artikel/Podcast-c-t-uplink-3-3-' + - 'Owncloud-Tastaturen-Peilsender-Smartphone-2404147.html' + 'http://www.heise.de/video/artikel/Podcast-c-t-uplink-3-3-Owncloud-Tastaturen-Peilsender-Smartphone-2404147.html' ), 'md5': 'ffed432483e922e88545ad9f2f15d30e', 'info_dict': { 'id': '2404147', 'ext': 'mp4', 'title': ( - "Podcast: c't uplink 3.3 – Owncloud / Tastaturen / " + - "Peilsender Smartphone" + "Podcast: c't uplink 3.3 – Owncloud / Tastaturen / Peilsender Smartphone" ), - 'format_id': 'mp4_720', + 'format_id': 'mp4_720p', 'timestamp': 1411812600, 'upload_date': '20140927', + 'description': 'In uplink-Episode 3.3 geht es darum, wie man sich von Cloud-Anbietern emanzipieren kann, worauf man beim Kauf einer Tastatur achten sollte und was Smartphones über uns verraten.', + 'thumbnail': 're:^https?://.*\.jpe?g$', } } - _CONFIG = ( - r'".+?\?sequenz=(?P.+?)&container=(?P.+?)' + - r'(?:&hd=(?P.+?))?(?:&signature=(?P.+?))?&callback=\?"' - ) - _PREFIX = 'http://www.heise.de/videout/info?' - - def _warn(self, fmt, *args): - self.report_warning(fmt.format(*args), self._id) - - def _parse_config_url(self, html): - m = re.search(self._CONFIG, html) - if not m: - raise ExtractorError('No config found') - - qs = compat_urllib_parse.urlencode(dict((k, v) for k, v - in m.groupdict().items() - if v is not None)) - return self._PREFIX + qs - def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) - self._id = mobj.group('id') - - html = self._download_webpage(url, self._id) - config = self._download_json(self._parse_config_url(html), self._id) + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + + container_id = self._search_regex( + r'