mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-07 07:51:26 +01:00
Compare commits
4 Commits
a3473edb7f
...
5c799fb394
Author | SHA1 | Date | |
---|---|---|---|
|
5c799fb394 | ||
|
a14ebf31f5 | ||
|
d9550cfca3 | ||
|
1e4d438a06 |
|
@ -6,13 +6,12 @@ from ..utils import (
|
||||||
js_to_json,
|
js_to_json,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..utils.traversal import traverse_obj
|
from ..utils.traversal import traverse_obj
|
||||||
|
|
||||||
|
|
||||||
class NTVDeIE(InfoExtractor):
|
class NTVDeIE(InfoExtractor):
|
||||||
IE_NAME = 'n-tv.de'
|
IE_NAME = 'n-tv.de'
|
||||||
_VALID_URL = r'https?://(?:www\.)?n-tv\.de/mediathek/videos/[^/?#]+/[^/?#]+-article(?P<id>.+)\.html'
|
_VALID_URL = r'https?://(?:www\.)?n-tv\.de/mediathek/(?:videos|magazine)/[^/?#]+/[^/?#]+-article(?P<id>[^/?#]+)\.html'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://www.n-tv.de/mediathek/videos/panorama/Schnee-und-Glaette-fuehren-zu-zahlreichen-Unfaellen-und-Staus-article14438086.html',
|
'url': 'http://www.n-tv.de/mediathek/videos/panorama/Schnee-und-Glaette-fuehren-zu-zahlreichen-Unfaellen-und-Staus-article14438086.html',
|
||||||
|
@ -28,6 +27,20 @@ class NTVDeIE(InfoExtractor):
|
||||||
'timestamp': 1422892797,
|
'timestamp': 1422892797,
|
||||||
'upload_date': '20150202',
|
'upload_date': '20150202',
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.n-tv.de/mediathek/magazine/auslandsreport/Juedische-Siedler-wollten-Rache-die-wollten-nur-toeten-article24523089.html',
|
||||||
|
'md5': 'c5c6014c014ccc3359470e1d34472bfd',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '24523089',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'thumbnail': r're:^https?://.*\.jpg$',
|
||||||
|
'title': 'Jüdische Siedler "wollten Rache, die wollten nur töten"',
|
||||||
|
'alt_title': 'Israelische Gewalt fern von Gaza',
|
||||||
|
'description': 'Vier Tage nach dem Massaker der Hamas greifen jüdische Siedler das Haus einer palästinensischen Familie im Westjordanland an. Die Überlebenden berichten, sie waren unbewaffnet, die Angreifer seien nur auf "Rache und Töten" aus gewesen. Als die Toten beerdigt werden sollen, eröffnen die Siedler erneut das Feuer.',
|
||||||
|
'duration': 326,
|
||||||
|
'timestamp': 1699688294,
|
||||||
|
'upload_date': '20231111',
|
||||||
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
@ -35,25 +48,24 @@ class NTVDeIE(InfoExtractor):
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
info = self._search_json(
|
info = self._search_json(
|
||||||
r'article:\s*', webpage, 'info', video_id, transform_source=js_to_json)
|
r'article:', webpage, 'info', video_id, transform_source=js_to_json)
|
||||||
|
|
||||||
player_data = self._search_json(
|
vdata = self._search_json(
|
||||||
r'\$\(\s*"#playerwrapper"\s*\)\s*\.data\(\s*"player",\s*',
|
r'\$\(\s*"#playerwrapper"\s*\)\s*\.data\(\s*"player",',
|
||||||
webpage, 'player data', video_id,
|
webpage, 'player data', video_id,
|
||||||
transform_source=lambda s: js_to_json(re.sub(r'ivw:[^},]+', '', s)))
|
transform_source=lambda s: js_to_json(re.sub(r'ivw:[^},]+', '', s)))['setup']['source']
|
||||||
vdata = traverse_obj(player_data, ('setup', 'source')) or {}
|
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
if vdata.get('progressive'):
|
if vdata.get('progressive'):
|
||||||
formats.append({
|
formats.append({
|
||||||
'format_id': 'mp4-0',
|
'format_id': 'http',
|
||||||
'url': vdata['progressive'],
|
'url': vdata['progressive'],
|
||||||
})
|
})
|
||||||
if vdata.get('hls'):
|
if vdata.get('hls'):
|
||||||
formats.extend(self._extract_m3u8_formats(
|
formats.extend(self._extract_m3u8_formats(
|
||||||
vdata['hls'], video_id, 'mp4', m3u8_id='hls', fatal=False))
|
vdata['hls'], video_id, 'mp4', m3u8_id='hls', fatal=False))
|
||||||
if vdata.get('dash'):
|
if vdata.get('dash'):
|
||||||
formats.extend(self._extract_mpd_formats(vdata['dash'], video_id, fatal=False))
|
formats.extend(self._extract_mpd_formats(vdata['dash'], video_id, fatal=False, mpd_id='dash'))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user