aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Huffman <tejing@tejing.com>2022-08-02 17:18:40 -0400
committerGitHub <noreply@github.com>2022-08-03 02:48:40 +0530
commitb99ba3df096cd9c2973f7cf978c58ccfb3fa2200 (patch)
treeb1f6804d87a31fc75b8ba355497d1a0d8cbd9a50
parent7356a44443995d83c59b915186b6a719769eab60 (diff)
downloadhypervideo-pre-b99ba3df096cd9c2973f7cf978c58ccfb3fa2200.tar.lz
hypervideo-pre-b99ba3df096cd9c2973f7cf978c58ccfb3fa2200.tar.xz
hypervideo-pre-b99ba3df096cd9c2973f7cf978c58ccfb3fa2200.zip
[extractor/crunchyroll:beta] Extract timestamp and fix tests (#4535)
Closes #4533 Authored by: tejing1
-rw-r--r--yt_dlp/extractor/crunchyroll.py47
1 files changed, 11 insertions, 36 deletions
diff --git a/yt_dlp/extractor/crunchyroll.py b/yt_dlp/extractor/crunchyroll.py
index 6fd74989e..bacdb8515 100644
--- a/yt_dlp/extractor/crunchyroll.py
+++ b/yt_dlp/extractor/crunchyroll.py
@@ -28,6 +28,7 @@ from ..utils import (
join_nonempty,
lowercase_escape,
merge_dicts,
+ parse_iso8601,
qualities,
remove_end,
sanitized_Request,
@@ -761,43 +762,23 @@ class CrunchyrollBetaIE(CrunchyrollBetaBaseIE):
_TESTS = [{
'url': 'https://beta.crunchyroll.com/watch/GY2P1Q98Y/to-the-future',
'info_dict': {
- 'id': '696363',
+ 'id': 'GY2P1Q98Y',
'ext': 'mp4',
- 'timestamp': 1459610100,
+ 'duration': 1380.241,
+ 'timestamp': 1459632600,
'description': 'md5:a022fbec4fbb023d43631032c91ed64b',
- 'uploader': 'Toei Animation',
'title': 'World Trigger Episode 73 – To the Future',
'upload_date': '20160402',
- 'episode_number': 73,
'series': 'World Trigger',
- 'average_rating': 4.9,
- 'episode': 'To the Future',
+ 'series_id': 'GR757DMKY',
'season': 'World Trigger',
- 'thumbnail': 'https://img1.ak.crunchyroll.com/i/spire3-tmb/c870dedca1a83137c2d3d144984155ed1459527119_main.jpg',
+ 'season_id': 'GR9P39NJ6',
'season_number': 1,
+ 'episode': 'To the Future',
+ 'episode_number': 73,
+ 'thumbnail': r're:^https://beta.crunchyroll.com/imgsrv/.*\.jpeg$',
},
'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/',
'only_matching': True,
@@ -859,6 +840,7 @@ class CrunchyrollBetaIE(CrunchyrollBetaBaseIE):
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')),
'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_id': episode_response.get('series_id'),
'season': episode_response.get('season_title'),
@@ -887,18 +869,11 @@ class CrunchyrollBetaShowIE(CrunchyrollBetaBaseIE):
_TESTS = [{
'url': 'https://beta.crunchyroll.com/series/GY19NQ2QR/Girl-Friend-BETA',
'info_dict': {
- 'id': 'girl-friend-beta',
+ 'id': 'GY19NQ2QR',
'title': 'Girl Friend BETA',
},
'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',
'only_matching': True,
}]