float_or_none: use partial_application

This commit is contained in:
grqx_wsl 2024-10-31 23:37:35 +13:00
parent 6c6d75be16
commit 0a05711805

View File

@ -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'},
}