mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-06-21 10:14:33 +00:00
[ie/tviplayer] Fix extractor (#16527)
Closes #13132 Authored by: FranciscoPombal
This commit is contained in:
parent
2b27a203f7
commit
9ae7df9a22
@ -1,5 +1,6 @@
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import traverse_obj
|
from ..utils import int_or_none, js_to_json
|
||||||
|
from ..utils.traversal import traverse_obj
|
||||||
|
|
||||||
|
|
||||||
class TVIPlayerIE(InfoExtractor):
|
class TVIPlayerIE(InfoExtractor):
|
||||||
@ -11,21 +12,10 @@ class TVIPlayerIE(InfoExtractor):
|
|||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'duration': 4167,
|
'duration': 4167,
|
||||||
'title': 'Jornal das 8 - 26 de dezembro de 2021',
|
'title': 'Jornal das 8 - 26 de dezembro de 2021',
|
||||||
'thumbnail': 'https://www.iol.pt/multimedia/oratvi/multimedia/imagem/id/61c8ee630cf2cc58e7d98d9f/',
|
'thumbnail': 'https://img.iol.pt/image/id/61c8ee630cf2cc58e7d98d9f/',
|
||||||
'season_number': 8,
|
'season_number': 8,
|
||||||
'season': 'Season 8',
|
'season': 'Season 8',
|
||||||
},
|
},
|
||||||
}, {
|
|
||||||
'url': 'https://tviplayer.iol.pt/programa/isabel/62b471090cf26256cd2a8594/video/62be445f0cf2ea4f0a5218e5',
|
|
||||||
'info_dict': {
|
|
||||||
'id': '62be445f0cf2ea4f0a5218e5',
|
|
||||||
'ext': 'mp4',
|
|
||||||
'duration': 3255,
|
|
||||||
'season': 'Season 1',
|
|
||||||
'title': 'Isabel - Episódio 1',
|
|
||||||
'thumbnail': 'https://www.iol.pt/multimedia/oratvi/multimedia/imagem/id/62beac200cf2f9a86eab856b/',
|
|
||||||
'season_number': 1,
|
|
||||||
},
|
|
||||||
}, {
|
}, {
|
||||||
# no /programa/
|
# no /programa/
|
||||||
'url': 'https://tviplayer.iol.pt/video/62c4131c0cf2f9a86eac06bb',
|
'url': 'https://tviplayer.iol.pt/video/62c4131c0cf2f9a86eac06bb',
|
||||||
@ -33,10 +23,8 @@ class TVIPlayerIE(InfoExtractor):
|
|||||||
'id': '62c4131c0cf2f9a86eac06bb',
|
'id': '62c4131c0cf2f9a86eac06bb',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'David e Mickael Carreira respondem: «Qual é o próximo a ser pai?»',
|
'title': 'David e Mickael Carreira respondem: «Qual é o próximo a ser pai?»',
|
||||||
'thumbnail': 'https://www.iol.pt/multimedia/oratvi/multimedia/imagem/id/62c416490cf2ea367d4433fd/',
|
'thumbnail': 'https://img.iol.pt/image/id/62c416490cf2ea367d4433fd/',
|
||||||
'season': 'Season 2',
|
|
||||||
'duration': 148,
|
'duration': 148,
|
||||||
'season_number': 2,
|
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
# episodio url
|
# episodio url
|
||||||
@ -46,9 +34,11 @@ class TVIPlayerIE(InfoExtractor):
|
|||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'season': 'Season 1',
|
'season': 'Season 1',
|
||||||
'title': 'Quem denunciou Pedro?',
|
'title': 'Quem denunciou Pedro?',
|
||||||
'thumbnail': 'https://www.iol.pt/multimedia/oratvi/multimedia/imagem/id/62eda30b0cf2ea367d48973b/',
|
'thumbnail': 'https://img.iol.pt/image/id/62eda30b0cf2ea367d48973b/',
|
||||||
'duration': 1250,
|
'duration': 1250,
|
||||||
'season_number': 1,
|
'season_number': 1,
|
||||||
|
'episode_number': 187,
|
||||||
|
'episode': 'Episode 187',
|
||||||
},
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
@ -62,7 +52,8 @@ class TVIPlayerIE(InfoExtractor):
|
|||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
json_data = self._search_json(
|
json_data = self._search_json(
|
||||||
r'<script>\s*jsonData\s*=', webpage, 'json_data', video_id)
|
r'\sopts\s*=\s*\{\s*video\s*:\s*\[', webpage, 'JSON data', video_id,
|
||||||
|
transform_source=js_to_json)
|
||||||
|
|
||||||
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
|
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
|
||||||
f'{json_data["videoUrl"]}?wmsAuthSign={self.wms_auth_sign_token}',
|
f'{json_data["videoUrl"]}?wmsAuthSign={self.wms_auth_sign_token}',
|
||||||
@ -71,8 +62,11 @@ class TVIPlayerIE(InfoExtractor):
|
|||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': json_data.get('title') or self._og_search_title(webpage),
|
'title': json_data.get('title') or self._og_search_title(webpage),
|
||||||
'thumbnail': json_data.get('cover') or self._og_search_thumbnail(webpage),
|
'thumbnail': json_data.get('cover') or self._og_search_thumbnail(webpage),
|
||||||
'duration': json_data.get('duration'),
|
'duration': int_or_none(json_data.get('duration')),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'subtitles': subtitles,
|
'subtitles': subtitles,
|
||||||
'season_number': traverse_obj(json_data, ('program', 'seasonNum')),
|
'season_number': traverse_obj(
|
||||||
|
self._yield_json_ld(webpage, video_id, default=None),
|
||||||
|
(lambda _, v: v['@type'] == 'TVEpisode', 'seasonNumber', {int_or_none}, any)),
|
||||||
|
'episode_number': int_or_none(json_data.get('episodeNum')),
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user