1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-16 06:15:46 +00:00

[tagesschau] Relax _VALID_URL and simplify

This commit is contained in:
Sergey M․ 2015-07-23 00:30:48 +06:00
parent c356620ec1
commit 948199deac

View file

@ -8,7 +8,7 @@ from ..utils import parse_filesize, ExtractorError
class TagesschauIE(InfoExtractor): class TagesschauIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tagesschau\.de/multimedia/(?:sendung/(ts|tsg|tt|nm|bab/bab)|video/video|tsvorzwanzig)(?P<id>-?[0-9]+)(?:~[-_a-zA-Z0-9]*)?\.html' _VALID_URL = r'https?://(?:www\.)?tagesschau\.de/multimedia/(?:[^/]+/)*?[^/#?]+?(?P<id>-?[0-9]+)(?:~_[^/#?]+?)?\.html'
_TESTS = [{ _TESTS = [{
'url': 'http://www.tagesschau.de/multimedia/video/video-102143.html', 'url': 'http://www.tagesschau.de/multimedia/video/video-102143.html',
@ -29,57 +29,31 @@ class TagesschauIE(InfoExtractor):
'description': 'md5:695c01bfd98b7e313c501386327aea59', 'description': 'md5:695c01bfd98b7e313c501386327aea59',
'title': 'Sendung: tagesschau \t04.12.2014 20:00 Uhr', 'title': 'Sendung: tagesschau \t04.12.2014 20:00 Uhr',
'thumbnail': 're:^http:.*\.jpg$', 'thumbnail': 're:^http:.*\.jpg$',
} },
}, { }, {
'url': 'http://www.tagesschau.de/multimedia/sendung/tsg-3771.html', 'url': 'http://www.tagesschau.de/multimedia/sendung/tsg-3771.html',
'md5': '90757268b49ef56deae90c7b48928d58', 'only_matching': True,
'info_dict': {
'id': '3771',
'ext': 'mp4',
'description': None,
'title': 'Sendung: tagesschau (mit Gebärdensprache) \t14.07.2015 20:00 Uhr',
'thumbnail': 're:^http:.*\.jpg$',
}
}, { }, {
'url': 'http://www.tagesschau.de/multimedia/sendung/tt-3827.html', 'url': 'http://www.tagesschau.de/multimedia/sendung/tt-3827.html',
'md5': '6e3ebdc75e8d67da966a8d06721eda71', 'only_matching': True,
'info_dict': {
'id': '3827',
'ext': 'mp4',
'description': 'md5:d511d0e278b0ad341a95ad9ab992ce66',
'title': 'Sendung: tagesthemen \t14.07.2015 22:15 Uhr',
'thumbnail': 're:^http:.*\.jpg$',
}
}, { }, {
'url': 'http://www.tagesschau.de/multimedia/sendung/nm-3475.html', 'url': 'http://www.tagesschau.de/multimedia/sendung/nm-3475.html',
'md5': '8a8875a568f0a5ae5ceef93c501a225f', 'only_matching': True,
'info_dict': { }, {
'id': '3475', 'url': 'http://www.tagesschau.de/multimedia/sendung/weltspiegel-3167.html',
'ext': 'mp4', 'only_matching': True,
'description': 'md5:ed149f5649cda3dac86813a9d777e131',
'title': 'Sendung: nachtmagazin \t15.07.2015 00:15 Uhr',
'thumbnail': 're:^http:.*\.jpg$',
}
}, { }, {
'url': 'http://www.tagesschau.de/multimedia/tsvorzwanzig-959.html', 'url': 'http://www.tagesschau.de/multimedia/tsvorzwanzig-959.html',
'md5': 'be4d6f0421f2acd8abe25ea29f6f015b', 'only_matching': True,
'info_dict': {
'id': '959',
'ext': 'mp4',
'description': None,
'title': 'Sendung: tagesschau vor 20 Jahren \t14.07.2015 22:45 Uhr',
'thumbnail': 're:^http:.*\.jpg$',
}
}, { }, {
'url': 'http://www.tagesschau.de/multimedia/sendung/bab/bab-3299~_bab-sendung-209.html', 'url': 'http://www.tagesschau.de/multimedia/sendung/bab/bab-3299~_bab-sendung-209.html',
'md5': '42e3757018d9908581481a80cc1806da', 'only_matching': True,
'info_dict': { }, {
'id': '3299', 'url': 'http://www.tagesschau.de/multimedia/video/video-102303~_bab-sendung-211.html',
'ext': 'mp4', 'only_matching': True,
'description': None, }, {
'title': 'Nach dem Referendum: Schaltgespräch nach Athen', 'url': 'http://www.tagesschau.de/multimedia/politikimradio/audio-18407.html',
'thumbnail': 're:^http:.*\.jpg$', 'only_matching': True,
}
}] }]
_FORMATS = { _FORMATS = {
@ -152,11 +126,9 @@ class TagesschauIE(InfoExtractor):
thumbnail_fn = self._search_regex( thumbnail_fn = self._search_regex(
r'(?s)<img alt="Sendungsbild".*?src="([^"]+)"', r'(?s)<img alt="Sendungsbild".*?src="([^"]+)"',
webpage, 'thumbnail', fatal=False) webpage, 'thumbnail', fatal=False)
# there are some videos without description
description = ""
description = self._html_search_regex( description = self._html_search_regex(
r'(?s)<p class="teasertext">(.*?)</p>', r'(?s)<p class="teasertext">(.*?)</p>',
webpage, 'description', fatal=False, default=None) webpage, 'description', default=None)
title = self._html_search_regex( title = self._html_search_regex(
r'<span class="headline".*?>(.*?)</span>', webpage, 'title') r'<span class="headline".*?>(.*?)</span>', webpage, 'title')