From 0a05711805f168d1c5478c2c7f34403d10d54bb1 Mon Sep 17 00:00:00 2001 From: grqx_wsl <173253225+grqx@users.noreply.github.com> Date: Thu, 31 Oct 2024 23:37:35 +1300 Subject: [PATCH] float_or_none: use partial_application --- yt_dlp/extractor/bahamut.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yt_dlp/extractor/bahamut.py b/yt_dlp/extractor/bahamut.py index 0d7a1952d9..292e126644 100644 --- a/yt_dlp/extractor/bahamut.py +++ b/yt_dlp/extractor/bahamut.py @@ -51,6 +51,7 @@ def _real_extract(self, url): if self._yes_playlist(playlist_id, video_id) and unsmuggled_data.get('extract_playlist') is not False: return self.playlist_result( (self.url_result( + # it may be better to use self.cache for storing device_id smuggle_url(f'https://ani.gamer.com.tw/animeVideo.php?sn={ep["videoSn"]}', { 'extract_playlist': False, 'device_id': device_id, @@ -67,7 +68,7 @@ def _real_extract(self, url): 'thumbnail': 'cover', 'title': 'title', 'timestamp': ('upTime', {unified_timestamp}), - 'duration': ('duration', {float_or_none}, {lambda x: x * 60}), + 'duration': ('duration', {float_or_none(scale=60)}), 'age_limit': ('rating', {lambda x: self.RATING_TO_AGE_LIMIT.get(x)}), }))) @@ -91,6 +92,7 @@ def _real_extract(self, url): raise ExtractorError('Invalid device id!') elif error_code == 1017: self.raise_login_required() + raise ExtractorError(traverse_obj(m3u8_info, ('error', 'message')) or 'Failed to download m3u8 URL') @@ -102,7 +104,5 @@ def _real_extract(self, url): 'Origin': 'https://ani.gamer.com.tw', **self.geo_verification_headers(), }), - 'http_headers': { - 'Origin': 'https://ani.gamer.com.tw', - }, + 'http_headers': {'Origin': 'https://ani.gamer.com.tw'}, }