X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=youtube_dl%2Fextractor%2Ftagesschau.py;h=73e7657d4bec7b1bc37753923744d92b769d8843;hb=d055bf91ccab5c25956f3d360c3b79ed86ad44b9;hp=682f8df8f6d1f701af14d9009a63cab822c7ddd6;hpb=3c6ae8b59ed2517891ff19507e4cef2322ef9eb4;p=youtube-dl
diff --git a/youtube_dl/extractor/tagesschau.py b/youtube_dl/extractor/tagesschau.py
index 682f8df8f..73e7657d4 100644
--- a/youtube_dl/extractor/tagesschau.py
+++ b/youtube_dl/extractor/tagesschau.py
@@ -4,21 +4,21 @@ from __future__ import unicode_literals
import re
from .common import InfoExtractor
-from ..utils import parse_filesize, ExtractorError
+from ..utils import parse_filesize
class TagesschauIE(InfoExtractor):
- _VALID_URL = r'https?://(?:www\.)?tagesschau\.de/multimedia/(?:sendung/(ts|tsg|tt|nm|bab/bab)|video/video|tsvorzwanzig)(?P-?[0-9]+)(?:~[-_a-zA-Z0-9]*)?\.html'
+ _VALID_URL = r'https?://(?:www\.)?tagesschau\.de/multimedia/(?:[^/]+/)*?[^/#?]+?(?P-?[0-9]+)(?:~_[^/#?]+?)?\.html'
_TESTS = [{
- 'url': 'http://www.tagesschau.de/multimedia/video/video1399128.html',
- 'md5': 'bcdeac2194fb296d599ce7929dfa4009',
+ 'url': 'http://www.tagesschau.de/multimedia/video/video-102143.html',
+ 'md5': '917a228bc7df7850783bc47979673a09',
'info_dict': {
- 'id': '1399128',
+ 'id': '102143',
'ext': 'mp4',
- 'title': 'Harald Range, Generalbundesanwalt, zu den Ermittlungen',
- 'description': 'md5:69da3c61275b426426d711bde96463ab',
- 'thumbnail': 're:^http:.*\.jpg$',
+ 'title': 'Regierungsumbildung in Athen: Neue Minister in Griechenland vereidigt',
+ 'description': 'md5:171feccd9d9b3dd54d05d501568f6359',
+ 'thumbnail': 're:^https?:.*\.jpg$',
},
}, {
'url': 'http://www.tagesschau.de/multimedia/sendung/ts-5727.html',
@@ -28,58 +28,39 @@ class TagesschauIE(InfoExtractor):
'ext': 'mp4',
'description': 'md5:695c01bfd98b7e313c501386327aea59',
'title': 'Sendung: tagesschau \t04.12.2014 20:00 Uhr',
- 'thumbnail': 're:^http:.*\.jpg$',
- }
+ 'thumbnail': 're:^https?:.*\.jpg$',
+ },
}, {
- 'url': 'http://www.tagesschau.de/multimedia/sendung/tsg-3771.html',
- 'md5': '90757268b49ef56deae90c7b48928d58',
+ 'url': 'http://www.tagesschau.de/multimedia/politikimradio/audio-18407.html',
+ 'md5': 'aef45de271c4bf0a5db834aa40bf774c',
'info_dict': {
- 'id': '3771',
- 'ext': 'mp4',
- 'description': '',
- 'title': 'Sendung: tagesschau (mit Gebärdensprache) \t14.07.2015 20:00 Uhr',
- 'thumbnail': 're:^http:.*\.jpg$',
- }
+ 'id': '18407',
+ 'ext': 'mp3',
+ 'title': 'Flüchtlingsdebatte: Hitzig, aber wenig hilfreich',
+ 'description': 'Flüchtlingsdebatte: Hitzig, aber wenig hilfreich',
+ 'thumbnail': 're:^https?:.*\.jpg$',
+ },
+ }, {
+ 'url': 'http://www.tagesschau.de/multimedia/sendung/tsg-3771.html',
+ 'only_matching': True,
}, {
'url': 'http://www.tagesschau.de/multimedia/sendung/tt-3827.html',
- 'md5': '6e3ebdc75e8d67da966a8d06721eda71',
- 'info_dict': {
- 'id': '3827',
- 'ext': 'mp4',
- 'description': 'md5:d511d0e278b0ad341a95ad9ab992ce66',
- 'title': 'Sendung: tagesthemen \t14.07.2015 22:15 Uhr',
- 'thumbnail': 're:^http:.*\.jpg$',
- }
+ 'only_matching': True,
}, {
'url': 'http://www.tagesschau.de/multimedia/sendung/nm-3475.html',
- 'md5': '8a8875a568f0a5ae5ceef93c501a225f',
- 'info_dict': {
- 'id': '3475',
- 'ext': 'mp4',
- 'description': 'md5:ed149f5649cda3dac86813a9d777e131',
- 'title': 'Sendung: nachtmagazin \t15.07.2015 00:15 Uhr',
- 'thumbnail': 're:^http:.*\.jpg$',
- }
+ 'only_matching': True,
+ }, {
+ 'url': 'http://www.tagesschau.de/multimedia/sendung/weltspiegel-3167.html',
+ 'only_matching': True,
}, {
'url': 'http://www.tagesschau.de/multimedia/tsvorzwanzig-959.html',
- 'md5': 'be4d6f0421f2acd8abe25ea29f6f015b',
- 'info_dict': {
- 'id': '959',
- 'ext': 'mp4',
- 'description': '',
- 'title': 'Sendung: tagesschau vor 20 Jahren \t14.07.2015 22:45 Uhr',
- 'thumbnail': 're:^http:.*\.jpg$',
- }
+ 'only_matching': True,
}, {
'url': 'http://www.tagesschau.de/multimedia/sendung/bab/bab-3299~_bab-sendung-209.html',
- 'md5': '42e3757018d9908581481a80cc1806da',
- 'info_dict': {
- 'id': '3299',
- 'ext': 'mp4',
- 'description': '',
- 'title': 'Nach dem Referendum: Schaltgespräch nach Athen',
- 'thumbnail': 're:^http:.*\.jpg$',
- }
+ 'only_matching': True,
+ }, {
+ 'url': 'http://www.tagesschau.de/multimedia/video/video-102303~_bab-sendung-211.html',
+ 'only_matching': True,
}]
_FORMATS = {
@@ -99,19 +80,26 @@ class TagesschauIE(InfoExtractor):
playerpage = self._download_webpage(
player_url, display_id, 'Downloading player page')
- medias = re.findall(
- r'"(http://media.+?)", type:"video/(.+?)", quality:"(.+?)"',
- playerpage)
formats = []
- for url, ext, res in medias:
+ for media in re.finditer(
+ r'''(?x)
+ (?P["\'])(?Phttp://media.+?)(?P=q_url)
+ ,\s*type:(?P["\'])(?Pvideo|audio)/(?P.+?)(?P=q_type)
+ (?:,\s*quality:(?P["\'])(?P.+?)(?P=q_quality))?
+ ''', playerpage):
+ url = media.group('url')
+ type_ = media.group('type')
+ ext = media.group('ext')
+ res = media.group('quality')
f = {
- 'format_id': res + '_' + ext,
+ 'format_id': '%s_%s' % (res, ext) if res else ext,
'url': url,
'ext': ext,
+ 'vcodec': 'none' if type_ == 'audio' else None,
}
f.update(self._FORMATS.get(res, {}))
formats.append(f)
- thumbnail_fn = re.findall(r'"(/multimedia/.+?\.jpg)"', playerpage)[-1]
+ thumbnail = self._og_search_thumbnail(playerpage)
title = self._og_search_title(webpage).strip()
description = self._og_search_description(webpage).strip()
else:
@@ -149,22 +137,14 @@ class TagesschauIE(InfoExtractor):
'filesize_approx': parse_filesize(m.group('filesize_approx')),
})
formats.append(format)
- thumbnail_fn = self._search_regex(
- r'(?s)(.*?)
',
- webpage, 'description', fatal=False)
- except ExtractorError:
- pass
+ thumbnail = self._og_search_thumbnail(webpage)
+ description = self._html_search_regex(
+ r'(?s)(.*?)
',
+ webpage, 'description', default=None)
title = self._html_search_regex(
r'(.*?)', webpage, 'title')
self._sort_formats(formats)
- thumbnail = 'http://www.tagesschau.de' + thumbnail_fn
return {
'id': display_id,