From ff15951ef2bc7f11f1a2740f012a63881793d3b4 Mon Sep 17 00:00:00 2001 From: doe1080 <98906116+doe1080@users.noreply.github.com> Date: Sat, 2 Aug 2025 14:02:25 +0900 Subject: [PATCH] Update `_TESTS` --- yt_dlp/extractor/niconico.py | 303 ++++++++++++++++++++++------------- 1 file changed, 192 insertions(+), 111 deletions(-) diff --git a/yt_dlp/extractor/niconico.py b/yt_dlp/extractor/niconico.py index 982dfd7a4..82635b506 100644 --- a/yt_dlp/extractor/niconico.py +++ b/yt_dlp/extractor/niconico.py @@ -141,145 +141,226 @@ class NiconicoIE(NiconicoBaseIE): 'subscriber_only': 'Channel members only', } _TESTS = [{ - 'url': 'http://www.nicovideo.jp/watch/sm22312215', + 'url': 'https://www.nicovideo.jp/watch/1173108780', 'info_dict': { - 'id': 'sm22312215', + 'id': 'sm9', 'ext': 'mp4', - 'title': 'Big Buck Bunny', - 'thumbnail': r're:https?://.*', - 'uploader': 'takuya0301', - 'uploader_id': '2698420', - 'upload_date': '20131123', - 'timestamp': int, # timestamp is unstable - 'description': '(c) copyright 2008, Blender Foundation / www.bigbuckbunny.org', - 'duration': 33, - 'view_count': int, + 'title': '新・豪血寺一族 -煩悩解放 - レッツゴー!陰陽師', + 'availability': 'public', + 'channel': '中の', + 'channel_id': '4', 'comment_count': int, + 'description': 'md5:b7f6d3e6c29552cc19fdea6a4b7dc194', + 'display_id': '1173108780', + 'duration': 320, 'genres': ['未設定'], - 'tags': [], + 'like_count': int, + 'tags': list, + 'thumbnail': r're:https?://img\.cdn\.nimg\.jp/s/nicovideo/thumbnails/.+', + 'timestamp': 1173108780, + 'upload_date': '20070305', + 'uploader': '中の', + 'uploader_id': '4', + 'view_count': int, }, 'params': {'skip_download': 'm3u8'}, - 'skip': 'temporarily skip to keep the diff small', }, { - # File downloaded with and without credentials are different, so omit - # the md5 field - 'url': 'http://www.nicovideo.jp/watch/nm14296458', + 'url': 'https://www.nicovideo.jp/watch/sm8628149', 'info_dict': { - 'id': 'nm14296458', + 'id': 'sm8628149', 'ext': 'mp4', - 'title': '【Kagamine Rin】Dance on media【Original】take2!', - 'description': 'md5:9368f2b1f4178de64f2602c2f3d6cbf5', - 'thumbnail': r're:https?://.*', - 'uploader': 'りょうた', - 'uploader_id': '18822557', - 'upload_date': '20110429', - 'timestamp': 1304065916, - 'duration': 208.0, - 'comment_count': int, - 'view_count': int, - 'genres': ['音楽・サウンド'], - 'tags': ['Translation_Request', 'Kagamine_Rin', 'Rin_Original'], - }, - 'params': {'skip_download': 'm3u8'}, - 'skip': 'temporarily skip to keep the diff small', - }, { - # 'video exists but is marked as "deleted" - # md5 is unstable - 'url': 'http://www.nicovideo.jp/watch/sm10000', - 'info_dict': { - 'id': 'sm10000', - 'ext': 'unknown_video', - 'description': 'deleted', - 'title': 'ドラえもんエターナル第3話「決戦第3新東京市」<前編>', - 'thumbnail': r're:https?://.*', - 'upload_date': '20071224', - 'timestamp': int, # timestamp field has different value if logged in - 'duration': 304, - 'view_count': int, - }, - 'skip': 'Requires an account', - }, { - 'url': 'http://www.nicovideo.jp/watch/so22543406', - 'info_dict': { - 'id': '1388129933', - 'ext': 'mp4', - 'title': '【第1回】RADIOアニメロミックス ラブライブ!~のぞえりRadio Garden~', - 'description': 'md5:b27d224bb0ff53d3c8269e9f8b561cf1', - 'thumbnail': r're:https?://.*', - 'timestamp': 1388851200, - 'upload_date': '20140104', - 'uploader': 'アニメロチャンネル', - 'uploader_id': '312', - }, - 'skip': 'The viewing period of the video you were searching for has expired.', - }, { - # video not available via `getflv`; "old" HTML5 video - 'url': 'http://www.nicovideo.jp/watch/sm1151009', - 'info_dict': { - 'id': 'sm1151009', - 'ext': 'mp4', - 'title': 'マスターシステム本体内蔵のスペハリのメインテーマ(PSG版)', - 'description': 'md5:f95a3d259172667b293530cc2e41ebda', - 'thumbnail': r're:https?://.*', - 'duration': 184, - 'timestamp': 1190835883, - 'upload_date': '20070926', - 'uploader': 'denden2', - 'uploader_id': '1392194', - 'view_count': int, + 'title': '【東方】Bad Apple!!\u3000PV【影絵】', + 'availability': 'public', + 'channel': 'あにら', + 'channel_id': '10731211', 'comment_count': int, + 'description': 'md5:1999669158cb77a45bab123c4fafe1d7', + 'display_id': 'sm8628149', + 'duration': 219, 'genres': ['ゲーム'], - 'tags': [], + 'like_count': int, + 'tags': list, + 'thumbnail': r're:https?://img\.cdn\.nimg\.jp/s/nicovideo/thumbnails/.+', + 'timestamp': 1256580802, + 'upload_date': '20091026', + 'uploader': 'あにら', + 'uploader_id': '10731211', + 'view_count': int, }, 'params': {'skip_download': 'm3u8'}, - 'skip': 'temporarily skip to keep the diff small', }, { - # "New" HTML5 video - 'url': 'http://www.nicovideo.jp/watch/sm31464864', + 'url': 'https://www.nicovideo.jp/watch/nm3601701', 'info_dict': { - 'id': 'sm31464864', + 'id': 'nm3601701', 'ext': 'mp4', - 'title': '新作TVアニメ「戦姫絶唱シンフォギアAXZ」PV 最高画質', - 'description': 'md5:e52974af9a96e739196b2c1ca72b5feb', - 'timestamp': 1498481660, - 'upload_date': '20170626', - 'uploader': 'no-namamae', - 'uploader_id': '40826363', - 'thumbnail': r're:https?://.*', - 'duration': 198, - 'view_count': int, + 'title': '【UP主が見たい】Bad Apple!!\u3000PV【誰か描いてくれ】', + 'availability': 'public', + 'channel': 'Μμ', + 'channel_id': '2883832', 'comment_count': int, - 'genres': ['アニメ'], - 'tags': [], + 'description': 'md5:a85ac50a7eb34d5d0ab38b4bfbde5636', + 'display_id': 'nm3601701', + 'duration': 216, + 'genres': ['ゲーム'], + 'like_count': int, + 'tags': list, + 'thumbnail': r're:https?://img\.cdn\.nimg\.jp/s/nicovideo/thumbnails/.+', + 'timestamp': 1212935292, + 'upload_date': '20080608', + 'uploader': 'Μμ', + 'uploader_id': '2883832', + 'view_count': int, }, 'params': {'skip_download': 'm3u8'}, - 'skip': 'temporarily skip to keep the diff small', }, { - # Video without owner - 'url': 'http://www.nicovideo.jp/watch/sm18238488', + 'url': 'https://www.nicovideo.jp/watch/nl1872567', 'info_dict': { - 'id': 'sm18238488', + 'id': 'nl1872567', 'ext': 'mp4', - 'title': '【実写版】ミュータントタートルズ', - 'description': 'md5:15df8988e47a86f9e978af2064bf6d8e', - 'timestamp': 1341128008, - 'upload_date': '20120701', - 'thumbnail': r're:https?://.*', - 'duration': 5271, - 'view_count': int, + 'title': '【12/25放送分】『生対談!!ひろゆきと戀塚のニコニコを作った人 』前半', + 'availability': 'public', + 'channel': 'nicolive', + 'channel_id': '394', 'comment_count': int, + 'description': 'md5:79fc3a54cfdc93ecc2b883285149e548', + 'display_id': 'nl1872567', + 'duration': 586, 'genres': ['エンターテイメント'], - 'tags': [], + 'like_count': int, + 'tags': list, + 'thumbnail': r're:https?://img\.cdn\.nimg\.jp/s/nicovideo/thumbnails/.+', + 'timestamp': 1198637246, + 'upload_date': '20071226', + 'uploader': 'nicolive', + 'uploader_id': '394', + 'view_count': int, }, 'params': {'skip_download': 'm3u8'}, - 'skip': 'temporarily skip to keep the diff small', }, { - 'url': 'http://sp.nicovideo.jp/watch/sm28964488?ss_pos=1&cp_in=wt_tg', - 'only_matching': True, - }, { - 'note': 'a video that is only served as an ENCRYPTED HLS.', 'url': 'https://www.nicovideo.jp/watch/so38016254', - 'only_matching': True, + 'info_dict': { + 'id': 'so38016254', + 'ext': 'mp4', + 'title': '「のんのんびより のんすとっぷ」 PV', + 'availability': 'public', + 'channel': 'のんのんびより のんすとっぷ', + 'channel_id': 'ch2647028', + 'comment_count': int, + 'description': 'md5:6e2ff55b33e3645d59ef010869cde6a2', + 'display_id': 'so38016254', + 'duration': 114, + 'genres': ['アニメ'], + 'like_count': int, + 'tags': list, + 'thumbnail': r're:https?://img\.cdn\.nimg\.jp/s/nicovideo/thumbnails/.+', + 'timestamp': 1609146000, + 'upload_date': '20201228', + 'uploader': 'のんのんびより のんすとっぷ', + 'uploader_id': 'ch2647028', + 'view_count': int, + }, + 'params': {'skip_download': 'm3u8'}, + }, { + # smile official, but marked as user video + 'url': 'https://www.nicovideo.jp/watch/so37602536', + 'info_dict': { + 'id': 'so37602536', + 'ext': 'mp4', + 'title': '田中有紀とゆきだるまと! 限定放送アーカイブ(第12回)', + 'availability': 'subscriber_only', + 'channel': 'あみあみ16', + 'channel_id': '91072761', + 'comment_count': int, + 'description': 'md5:2ee357ec4e76d7804fb59af77107ab67', + 'display_id': 'so37602536', + 'duration': 980, + 'genres': ['エンターテイメント'], + 'like_count': int, + 'tags': 'count:4', + 'thumbnail': r're:https?://img\.cdn\.nimg\.jp/s/nicovideo/thumbnails/.+', + 'timestamp': 1601377200, + 'upload_date': '20200929', + 'uploader': 'あみあみ16', + 'uploader_id': '91072761', + 'view_count': int, + }, + 'params': {'skip_download': 'm3u8'}, + 'skip': 'Channel members only', + }, { + 'url': 'https://www.nicovideo.jp/watch/so41370536', + 'info_dict': { + 'id': 'so41370536', + 'ext': 'mp4', + 'title': 'ZUN【出演者別】超パーティー2022', + 'availability': 'premium_only', + 'channel': 'ニコニコ超会議チャンネル', + 'channel_id': 'ch2607134', + 'comment_count': int, + 'description': 'md5:5692db5ac40d3a374fc5ec182d0249c3', + 'display_id': 'so41370536', + 'duration': 63, + 'genres': ['音楽・サウンド'], + 'like_count': int, + 'tags': list, + 'thumbnail': r're:https?://img\.cdn\.nimg\.jp/s/nicovideo/thumbnails/.+', + 'timestamp': 1668394800, + 'upload_date': '20221114', + 'uploader': 'ニコニコ超会議チャンネル', + 'uploader_id': 'ch2607134', + 'view_count': int, + }, + 'params': {'skip_download': 'm3u8'}, + 'skip': 'Premium members only', + }, { + 'url': 'https://www.nicovideo.jp/watch/so37574174', + 'info_dict': { + 'id': 'so37574174', + 'ext': 'mp4', + 'title': 'ひぐらしのなく頃に 廿回し編\u3000第1回', + 'availability': 'subscriber_only', + 'channel': '「ひぐらしのなく頃に」オフィシャルチャンネル', + 'channel_id': 'ch2646036', + 'comment_count': int, + 'description': 'md5:5296196d51d9c0b7272b73f9a99c236a', + 'display_id': 'so37574174', + 'duration': 1931, + 'genres': ['ラジオ'], + 'like_count': int, + 'tags': list, + 'thumbnail': r're:https?://img\.cdn\.nimg\.jp/s/nicovideo/thumbnails/.+', + 'timestamp': 1601028000, + 'upload_date': '20200925', + 'uploader': '「ひぐらしのなく頃に」オフィシャルチャンネル', + 'uploader_id': 'ch2646036', + 'view_count': int, + }, + 'params': {'skip_download': 'm3u8'}, + 'skip': 'Channel members only', + }, { + 'url': 'https://www.nicovideo.jp/watch/so44060088', + 'info_dict': { + 'id': 'so44060088', + 'ext': 'mp4', + 'title': '松田的超英雄電波。《仮面ライダーガッチャード 放送終了記念特別番組》', + 'availability': 'subscriber_only', + 'channel': 'あみあみチャンネル', + 'channel_id': 'ch2638921', + 'comment_count': int, + 'description': 'md5:9dec5bb9a172b6d20a255ecb64fbd03e', + 'display_id': 'so44060088', + 'duration': 1881, + 'genres': ['ラジオ'], + 'like_count': int, + 'tags': list, + 'thumbnail': r're:https?://img\.cdn\.nimg\.jp/s/nicovideo/thumbnails/.+', + 'timestamp': 1725361200, + 'upload_date': '20240903', + 'uploader': 'あみあみチャンネル', + 'uploader_id': 'ch2638921', + 'view_count': int, + }, + 'params': {'skip_download': 'm3u8'}, + 'skip': 'Channel members only; specified continuous membership period required', }] def _extract_formats(self, api_data, video_id):