1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-07-08 22:38:33 +00:00

[ie/NHKRadiru] update tests

This commit is contained in:
garret1317 2025-03-23 07:03:29 +00:00
parent 010cee8c65
commit 3291fe02a9

View File

@ -592,94 +592,80 @@ class NhkRadiruIE(InfoExtractor):
IE_DESC = 'NHK らじる (Radiru/Rajiru)' IE_DESC = 'NHK らじる (Radiru/Rajiru)'
_VALID_URL = r'https?://www\.nhk\.or\.jp/radio/(?:player/ondemand|ondemand/detail)\.html\?p=(?P<site>[\da-zA-Z]+)_(?P<corner>[\da-zA-Z]+)(?:_(?P<headline>[\da-zA-Z]+))?' _VALID_URL = r'https?://www\.nhk\.or\.jp/radio/(?:player/ondemand|ondemand/detail)\.html\?p=(?P<site>[\da-zA-Z]+)_(?P<corner>[\da-zA-Z]+)(?:_(?P<headline>[\da-zA-Z]+))?'
_TESTS = [{ _TESTS = [{
'url': 'https://www.nhk.or.jp/radio/player/ondemand.html?p=0449_01_4003239', 'url': 'https://www.nhk.or.jp/radio/player/ondemand.html?p=8Q3V972NM8_01_4178419',
'skip': 'Episode expired on 2024-06-09', 'skip': 'Episode expired on 2025-03-30',
'info_dict': { 'info_dict': {
'title': 'ジャズ・トゥナイト ジャズ「Night and Day」特集', 'title': 'ジャズ・トゥナイト 放送記念日特集 (2) 100年前のジャズを聞こう!',
'id': '0449_01_4003239', 'id': '8Q3V972NM8_01_4178419',
'ext': 'm4a', 'ext': 'm4a',
'uploader': 'NHK FM 東京', 'description': 'md5:35e18396c738987a8ab621ae5dfe354e',
'description': 'md5:ad05f3c3f3f6e99b2e69f9b5e49551dc', 'uploader': 'NHK FM・東京',
'channel': 'NHK FM・東京',
'duration': 7200.0,
'thumbnail': 'https://www.nhk.jp/static/assets/images/radioseries/rs/8Q3V972NM8/8Q3V972NM8-eyecatch_26f2ac4b4f380ab786a43cd35f0902ee.jpg',
'cast': ['大友良英'],
'series': 'ジャズ・トゥナイト', 'series': 'ジャズ・トゥナイト',
'channel': 'NHK FM 東京', 'series_id': '8Q3V972NM8',
'thumbnail': 'https://www.nhk.or.jp/prog/img/449/g449.jpg', 'episode': '放送記念日特集 (2) 100年前のジャズを聞こう!',
'upload_date': '20240601', 'episode_id': '4LR4ZN6JX1',
'series_id': '0449_01', 'timestamp': 1742659203,
'release_date': '20240601', 'upload_date': '20250322',
'timestamp': 1717257600, 'release_timestamp': 1742652003,
'release_timestamp': 1717250400, 'release_date': '20250322',
'categories': ['音楽', 'ジャズ・フュージョン'],
}, },
}, { }, {
# playlist, airs every weekday so it should _hopefully_ be okay forever # playlist, airs every weekday so it should _hopefully_ be okay forever
'url': 'https://www.nhk.or.jp/radio/ondemand/detail.html?p=0458_01', 'url': 'https://www.nhk.or.jp/radio/ondemand/detail.html?p=Z9L1V2M24L_01',
'info_dict': { 'info_dict': {
'id': '0458_01', 'id': 'Z9L1V2M24L_01',
'title': 'ベストオブクラシック', 'title': 'ベストオブクラシック',
'description': '世界中の上質な演奏会をじっくり堪能する本格派クラシック番組。', 'description': '世界中の上質な演奏会をじっくり堪能する本格派クラシック番組。',
'thumbnail': 'https://www.nhk.or.jp/prog/img/458/g458.jpg', 'thumbnail': 'https://www.nhk.jp/static/assets/images/radioseries/rs/Z9L1V2M24L/Z9L1V2M24L-eyecatch_83ed28b4782907998875965fee60a351.jpg',
'series_id': '0458_01', 'series_id': 'Z9L1V2M24L_01',
'uploader': 'NHK FM', 'uploader': 'NHK FM',
'channel': 'NHK FM', 'channel': 'NHK FM',
'series': 'ベストオブクラシック', 'series': 'ベストオブクラシック',
}, },
'playlist_mincount': 3, 'playlist_mincount': 3,
}, {
# one with letters in the id
'url': 'https://www.nhk.or.jp/radio/player/ondemand.html?p=F683_01_3910688',
'note': 'Expires on 2025-03-31',
'info_dict': {
'id': 'F683_01_3910688',
'ext': 'm4a',
'title': '夏目漱石「文鳥」第1回',
'series': '【らじる文庫】夏目漱石「文鳥」全4回',
'series_id': 'F683_01',
'description': '朗読:浅井理アナウンサー',
'thumbnail': 'https://www.nhk.or.jp/radioondemand/json/F683/img/roudoku_05_rod_640.jpg',
'upload_date': '20240106',
'release_date': '20240106',
'uploader': 'NHK R1',
'release_timestamp': 1704511800,
'channel': 'NHK R1',
'timestamp': 1704512700,
},
'expected_warnings': ['Unable to download JSON metadata',
'Failed to get extended metadata. API returned Error 1: Invalid parameters'],
}, { }, {
# news # news
'url': 'https://www.nhk.or.jp/radio/player/ondemand.html?p=F261_01_4012173', 'url': 'https://www.nhk.or.jp/radio/player/ondemand.html?p=F261_01_4178426',
'skip': 'Expires on 2025-03-23',
'info_dict': { 'info_dict': {
'id': 'F261_01_4012173', 'id': 'F261_01_4178426',
'ext': 'm4a', 'ext': 'm4a',
'channel': 'NHKラジオ第1', 'title': '午前時のNHKニュース',
'uploader': 'NHKラジオ第1', 'uploader': 'NHKラジオ第1',
'series': 'NHKラジオニュース', 'channel': 'NHKラジオ第1',
'title': '午前時のNHKニュース',
'thumbnail': 'https://www.nhk.or.jp/radioondemand/json/F261/img/RADIONEWS_640.jpg', 'thumbnail': 'https://www.nhk.or.jp/radioondemand/json/F261/img/RADIONEWS_640.jpg',
'release_timestamp': 1718290800, 'series': 'NHKラジオニュース',
'release_date': '20240613', 'timestamp': 1742684700,
'timestamp': 1718291400, 'upload_date': '20250322',
'upload_date': '20240613', 'release_timestamp': 1742684400,
'release_date': '20250322',
}, },
}, { }, {
# fallback when extended metadata fails # fallback when extended metadata fails
'url': 'https://www.nhk.or.jp/radio/player/ondemand.html?p=2834_01_4009298', 'url': 'https://www.nhk.or.jp/radio/player/ondemand.html?p=J8792PY43V_14_4177121',
'skip': 'Expires on 2024-06-07', 'skip': 'Expires on 2025-04-14',
'info_dict': { 'info_dict': {
'id': '2834_01_4009298', 'id': 'J8792PY43V_14_4177121',
'title': 'まち☆キラ!開成町特集',
'ext': 'm4a', 'ext': 'm4a',
'release_date': '20240531', 'title': '「白い蝶[ちょう]を探してみよう」いきもの☆いろいろ',
'upload_date': '20240531', 'description': '海野 和男(昆虫写真家)',
'series': 'はま☆キラ!', 'uploader': 'NHK R1',
'thumbnail': 'https://www.nhk.or.jp/prog/img/2834/g2834.jpg', 'channel': 'NHK R1',
'channel': 'NHK R1,FM', 'thumbnail': 'https://www.nhk.or.jp/radioondemand/json/J8792PY43V/img/corner/box_26_thumbnail.jpg',
'description': '', 'series': 'マイあさ! いきもの☆いろいろ',
'timestamp': 1717123800, 'series_id': 'J8792PY43V_14',
'uploader': 'NHK R1,FM', 'timestamp': 1741985700,
'release_timestamp': 1717120800, 'upload_date': '20250314',
'series_id': '2834_01', 'release_timestamp': 1741982400,
'release_date': '20250314',
}, },
'expected_warnings': ['Failed to get extended metadata. API returned empty list.'], 'expected_warnings': ['Failed to download extended metadata: HTTP Error 404: Not Found'],
}] }]
_API_URL_TMPL = None _API_URL_TMPL = None