]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/tagesschau.py
3 from .common
import InfoExtractor
14 class TagesschauIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?tagesschau\.de/(?P<path>[^/]+/(?:[^/]+/)*?(?P<id>[^/#?]+?(?:-?[0-9]+)?))(?:~_?[^/#?]+?)?\.html'
18 'url': 'http://www.tagesschau.de/multimedia/video/video-102143.html',
19 'md5': 'ccb9359bf8c4795836e43759f3408a93',
21 'id': 'video-102143-1',
23 'title': 'Regierungsumbildung in Athen: Neue Minister in Griechenland vereidigt',
27 'url': 'http://www.tagesschau.de/multimedia/sendung/ts-5727.html',
28 'md5': '5c15e8f3da049e48829ec9786d835536',
32 'title': 'Ganze Sendung',
37 'url': 'http://www.tagesschau.de/multimedia/audio/audio-29417.html',
38 'md5': '4bff8f23504df56a0d86ed312d654182',
40 'id': 'audio-29417-1',
42 'title': 'EU-Gipfel: Im Verbrennerstreit hat Deutschland maximalen Schaden angerichtet',
45 'url': 'http://www.tagesschau.de/inland/bnd-303.html',
46 'md5': 'f049fa1698d7564e9ca4c3325108f034',
50 'title': 'Das Siegel des Bundesnachrichtendienstes | dpa',
53 'url': 'http://www.tagesschau.de/inland/afd-parteitag-135.html',
55 'id': 'afd-parteitag-135',
58 'playlist_mincount': 15,
60 'url': 'https://www.tagesschau.de/multimedia/audio/audio-29417~player.html',
62 'id': 'audio-29417-1',
64 'title': 'EU-Gipfel: Im Verbrennerstreit hat Deutschland maximalen Schaden angerichtet',
67 'url': 'https://www.tagesschau.de/multimedia/audio/podcast-11km-327.html',
69 'id': 'podcast-11km-327',
71 'title': 'Gewalt in der Kita – Wenn Erzieher:innen schweigen',
72 'upload_date': '20230322',
73 'timestamp': 1679482808,
74 'thumbnail': 'https://www.tagesschau.de/multimedia/audio/podcast-11km-329~_v-original.jpg',
75 'description': 'md5:dad059931fe4b3693e3656e93a249848',
78 'url': 'http://www.tagesschau.de/multimedia/sendung/tsg-3771.html',
79 'only_matching': True,
81 'url': 'http://www.tagesschau.de/multimedia/sendung/tt-3827.html',
82 'only_matching': True,
84 'url': 'http://www.tagesschau.de/multimedia/sendung/nm-3475.html',
85 'only_matching': True,
87 'url': 'http://www.tagesschau.de/multimedia/sendung/weltspiegel-3167.html',
88 'only_matching': True,
90 'url': 'http://www.tagesschau.de/multimedia/tsvorzwanzig-959.html',
91 'only_matching': True,
93 'url': 'http://www.tagesschau.de/multimedia/sendung/bab/bab-3299~_bab-sendung-209.html',
94 'only_matching': True,
96 'url': 'http://www.tagesschau.de/multimedia/video/video-102303~_bab-sendung-211.html',
97 'only_matching': True,
99 'url': 'http://www.tagesschau.de/100sekunden/index.html',
100 'only_matching': True,
102 # playlist article with collapsing sections
103 'url': 'http://www.tagesschau.de/wirtschaft/faq-freihandelszone-eu-usa-101.html',
104 'only_matching': True,
107 def _real_extract(self
, url
):
108 mobj
= self
._match
_valid
_url
(url
)
109 video_id
= mobj
.group('id') or mobj
.group('path')
110 display_id
= video_id
.lstrip('-')
112 webpage
= self
._download
_webpage
(url
, display_id
)
114 title
= self
._html
_search
_regex
(
115 r
'<span[^>]*class="headline"[^>]*>(.+?)</span>',
116 webpage
, 'title', default
=None) or self
._og
_search
_title
(webpage
, fatal
=False)
119 videos
= re
.findall(r
'<div[^>]+>', webpage
)
122 video
= extract_attributes(video
).get('data-config')
125 video
= self
._parse
_json
(video
, video_id
, transform_source
=js_to_json
, fatal
=False)
126 video_formats
= try_get(video
, lambda x
: x
['mc']['_mediaArray'][0]['_mediaStreamArray'])
127 if not video_formats
:
130 for video_format
in video_formats
:
131 media_url
= video_format
.get('_stream') or ''
133 if media_url
.endswith('master.m3u8'):
134 formats
= self
._extract
_m
3u8_formats
(media_url
, video_id
, 'mp4', m3u8_id
='hls')
135 elif media_url
.endswith('.mp3'):
143 'id': '%s-%d' % (display_id
, num
),
144 'title': try_get(video
, lambda x
: x
['mc']['_title']),
145 'duration': int_or_none(try_get(video
, lambda x
: x
['mc']['_duration'])),
150 raise UnsupportedError(url
)
153 return self
.playlist_result(entries
, display_id
, title
)
158 'thumbnail': self
._og
_search
_thumbnail
(webpage
),
159 'formats': entries
[0]['formats'],
160 'timestamp': parse_iso8601(self
._html
_search
_meta
('date', webpage
)),
161 'description': self
._og
_search
_description
(webpage
),
162 'duration': entries
[0]['duration'],