forforapreder
Newbie | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Может кто-нибудь применить этот патч к yt-dlp.exe для tv5monde? На оф. форуме посоветовали, но сам не смогу. This is a patch for yt-dlp (though urllib.parse might be preferred to the compat module): --- old/yt_dlp/extractor/tv5mondeplus.py +++ new/yt_dlp/extractor/tv5mondeplus.py @@ -1,8 +1,10 @@ from .common import InfoExtractor +from ..compat import compat_urllib_parse from ..utils import ( determine_ext, extract_attributes, int_or_none, + mimetype2ext, parse_duration, try_get, ) @@ -63,20 +65,34 @@ video_files = self._parse_json( vpl_data['data-broadcast'], display_id) formats = [] - for video_file in video_files: - v_url = video_file.get('url') - if not v_url: - continue - video_format = video_file.get('format') or determine_ext(v_url) - if video_format == 'm3u8': - formats.extend(self._extract_m3u8_formats( - v_url, display_id, 'mp4', 'm3u8_native', - m3u8_id='hls', fatal=False)) - else: - formats.append({ - 'url': v_url, - 'format_id': video_format, - }) + + def process_video_files(v): + for video_file in v: + v_url = video_file.get('url') + if not v_url: + continue + if video_file.get('type') == 'application/deferred': + video_file = self._download_json( + 'https://api.tv5monde.com/player/asset/%s/resolve' % (compat_urllib_parse.quote(v_url), ), + display_id, note='Downloading asset metadata', fatal=False) or [] + process_video_files(video_file) + continue + video_format = video_file.get('format') or mimetype2ext(video_file.get('type')) or determine_ext(v_url) + if video_format == 'm3u8': + formats.extend(self._extract_m3u8_formats( + v_url, display_id, 'mp4', 'm3u8_native', + m3u8_id='hls', fatal=False)) + elif video_format == 'mpd': + formats.extend(self._extract_mpd_formats( + v_url, display_id, fatal=False)) + else: + formats.append({ + 'url': v_url, + 'format_id': video_format, + }) + + process_video_files(video_files) + self._sort_formats(formats) metadata = self._parse_json( |