mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-05-19 17:35:43 -05:00
float_or_none: use partial_application
This commit is contained in:
parent
6c6d75be16
commit
0a05711805
1 changed files with 4 additions and 4 deletions
|
@ -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:
|
if self._yes_playlist(playlist_id, video_id) and unsmuggled_data.get('extract_playlist') is not False:
|
||||||
return self.playlist_result(
|
return self.playlist_result(
|
||||||
(self.url_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"]}', {
|
smuggle_url(f'https://ani.gamer.com.tw/animeVideo.php?sn={ep["videoSn"]}', {
|
||||||
'extract_playlist': False,
|
'extract_playlist': False,
|
||||||
'device_id': device_id,
|
'device_id': device_id,
|
||||||
|
@ -67,7 +68,7 @@ def _real_extract(self, url):
|
||||||
'thumbnail': 'cover',
|
'thumbnail': 'cover',
|
||||||
'title': 'title',
|
'title': 'title',
|
||||||
'timestamp': ('upTime', {unified_timestamp}),
|
'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)}),
|
'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!')
|
raise ExtractorError('Invalid device id!')
|
||||||
elif error_code == 1017:
|
elif error_code == 1017:
|
||||||
self.raise_login_required()
|
self.raise_login_required()
|
||||||
|
|
||||||
raise ExtractorError(traverse_obj(m3u8_info, ('error', 'message'))
|
raise ExtractorError(traverse_obj(m3u8_info, ('error', 'message'))
|
||||||
or 'Failed to download m3u8 URL')
|
or 'Failed to download m3u8 URL')
|
||||||
|
|
||||||
|
@ -102,7 +104,5 @@ def _real_extract(self, url):
|
||||||
'Origin': 'https://ani.gamer.com.tw',
|
'Origin': 'https://ani.gamer.com.tw',
|
||||||
**self.geo_verification_headers(),
|
**self.geo_verification_headers(),
|
||||||
}),
|
}),
|
||||||
'http_headers': {
|
'http_headers': {'Origin': 'https://ani.gamer.com.tw'},
|
||||||
'Origin': 'https://ani.gamer.com.tw',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue