1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-20 01:42:50 +01:00

[extractor/crunchyroll:beta] Extract timestamp and fix tests (#4535)

Closes #4533
Authored by: tejing1
This commit is contained in:
Jeff Huffman 2022-08-02 17:18:40 -04:00 committed by GitHub
parent 7356a44443
commit b99ba3df09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,6 +28,7 @@
join_nonempty, join_nonempty,
lowercase_escape, lowercase_escape,
merge_dicts, merge_dicts,
parse_iso8601,
qualities, qualities,
remove_end, remove_end,
sanitized_Request, sanitized_Request,
@ -761,43 +762,23 @@ class CrunchyrollBetaIE(CrunchyrollBetaBaseIE):
_TESTS = [{ _TESTS = [{
'url': 'https://beta.crunchyroll.com/watch/GY2P1Q98Y/to-the-future', 'url': 'https://beta.crunchyroll.com/watch/GY2P1Q98Y/to-the-future',
'info_dict': { 'info_dict': {
'id': '696363', 'id': 'GY2P1Q98Y',
'ext': 'mp4', 'ext': 'mp4',
'timestamp': 1459610100, 'duration': 1380.241,
'timestamp': 1459632600,
'description': 'md5:a022fbec4fbb023d43631032c91ed64b', 'description': 'md5:a022fbec4fbb023d43631032c91ed64b',
'uploader': 'Toei Animation',
'title': 'World Trigger Episode 73 To the Future', 'title': 'World Trigger Episode 73 To the Future',
'upload_date': '20160402', 'upload_date': '20160402',
'episode_number': 73,
'series': 'World Trigger', 'series': 'World Trigger',
'average_rating': 4.9, 'series_id': 'GR757DMKY',
'episode': 'To the Future',
'season': 'World Trigger', 'season': 'World Trigger',
'thumbnail': 'https://img1.ak.crunchyroll.com/i/spire3-tmb/c870dedca1a83137c2d3d144984155ed1459527119_main.jpg', 'season_id': 'GR9P39NJ6',
'season_number': 1, 'season_number': 1,
'episode': 'To the Future',
'episode_number': 73,
'thumbnail': r're:^https://beta.crunchyroll.com/imgsrv/.*\.jpeg$',
}, },
'params': {'skip_download': 'm3u8'}, 'params': {'skip_download': 'm3u8'},
'expected_warnings': ['Unable to download XML']
}, {
'url': 'https://beta.crunchyroll.com/watch/GYK53DMPR/wicked-lord-shingan-reborn',
'info_dict': {
'id': '648781',
'ext': 'mp4',
'episode_number': 1,
'timestamp': 1389173400,
'series': 'Love, Chunibyo & Other Delusions - Heart Throb -',
'description': 'md5:5579d1a0355cc618558ba23d27067a62',
'uploader': 'TBS',
'episode': 'Wicked Lord Shingan... Reborn',
'average_rating': 4.9,
'season': 'Love, Chunibyo & Other Delusions - Heart Throb -',
'thumbnail': 'https://img1.ak.crunchyroll.com/i/spire3-tmb/2ba0384e225a5370d5f0ee9496d91ea51389046521_main.jpg',
'title': 'Love, Chunibyo & Other Delusions - Heart Throb - Episode 1 Wicked Lord Shingan... Reborn',
'season_number': 2,
'upload_date': '20140108',
},
'params': {'skip_download': 'm3u8'},
'expected_warnings': ['Unable to download XML']
}, { }, {
'url': 'https://beta.crunchyroll.com/watch/GY2P1Q98Y/', 'url': 'https://beta.crunchyroll.com/watch/GY2P1Q98Y/',
'only_matching': True, 'only_matching': True,
@ -859,6 +840,7 @@ def _real_extract(self, url):
episode_response.get('season_title'), episode_response.get('episode'), episode_response.get('title')), episode_response.get('season_title'), episode_response.get('episode'), episode_response.get('title')),
'description': try_get(episode_response, lambda x: x['description'].replace(r'\r\n', '\n')), 'description': try_get(episode_response, lambda x: x['description'].replace(r'\r\n', '\n')),
'duration': float_or_none(episode_response.get('duration_ms'), 1000), 'duration': float_or_none(episode_response.get('duration_ms'), 1000),
'timestamp': parse_iso8601(episode_response.get('upload_date')),
'series': episode_response.get('series_title'), 'series': episode_response.get('series_title'),
'series_id': episode_response.get('series_id'), 'series_id': episode_response.get('series_id'),
'season': episode_response.get('season_title'), 'season': episode_response.get('season_title'),
@ -887,17 +869,10 @@ class CrunchyrollBetaShowIE(CrunchyrollBetaBaseIE):
_TESTS = [{ _TESTS = [{
'url': 'https://beta.crunchyroll.com/series/GY19NQ2QR/Girl-Friend-BETA', 'url': 'https://beta.crunchyroll.com/series/GY19NQ2QR/Girl-Friend-BETA',
'info_dict': { 'info_dict': {
'id': 'girl-friend-beta', 'id': 'GY19NQ2QR',
'title': 'Girl Friend BETA', 'title': 'Girl Friend BETA',
}, },
'playlist_mincount': 10, 'playlist_mincount': 10,
}, {
'url': 'https://beta.crunchyroll.com/series/GYJQV73V6/love-chunibyo--other-delusions---heart-throb--',
'info_dict': {
'id': 'love-chunibyo-other-delusions-heart-throb-',
'title': 'Love, Chunibyo & Other Delusions - Heart Throb -',
},
'playlist_mincount': 10,
}, { }, {
'url': 'https://beta.crunchyroll.com/it/series/GY19NQ2QR/Girl-Friend-BETA', 'url': 'https://beta.crunchyroll.com/it/series/GY19NQ2QR/Girl-Friend-BETA',
'only_matching': True, 'only_matching': True,