diff --git a/yt_dlp/extractor/niconico.py b/yt_dlp/extractor/niconico.py index c0a7fb66c6..881ad2c4da 100644 --- a/yt_dlp/extractor/niconico.py +++ b/yt_dlp/extractor/niconico.py @@ -103,226 +103,145 @@ class NiconicoIE(NiconicoBaseIE): _VALID_URL = r'https?://(?:(?:embed|sp|www)\.)?nicovideo\.jp/watch/(?P(?:[a-z]{2})?\d+)' _TESTS = [{ - 'url': 'https://www.nicovideo.jp/watch/1173108780', + 'url': 'http://www.nicovideo.jp/watch/sm22312215', 'info_dict': { - 'id': 'sm9', + 'id': 'sm22312215', 'ext': 'mp4', - 'title': '新・豪血寺一族 -煩悩解放 - レッツゴー!陰陽師', - 'availability': 'public', - 'channel': '中の', - 'channel_id': '4', + '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, 'comment_count': int, - 'description': 'md5:b7f6d3e6c29552cc19fdea6a4b7dc194', - 'display_id': '1173108780', - 'duration': 320, 'genres': ['未設定'], - 'like_count': int, - 'tags': list, - 'thumbnail': r're:https?://.+', - 'timestamp': 1173108780, - 'upload_date': '20070305', - 'uploader': '中の', - 'uploader_id': '4', - 'view_count': int, + 'tags': [], }, 'params': {'skip_download': 'm3u8'}, + 'skip': True, }, { - 'url': 'https://www.nicovideo.jp/watch/sm8628149', + # File downloaded with and without credentials are different, so omit + # the md5 field + 'url': 'http://www.nicovideo.jp/watch/nm14296458', 'info_dict': { - 'id': 'sm8628149', + 'id': 'nm14296458', 'ext': 'mp4', - 'title': '【東方】Bad Apple!!\u3000PV【影絵】', - 'availability': 'public', - 'channel': 'あにら', - 'channel_id': '10731211', + '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, - 'description': 'md5:1999669158cb77a45bab123c4fafe1d7', - 'display_id': 'sm8628149', - 'duration': 219, - 'genres': ['ゲーム'], - 'like_count': int, - 'tags': list, - 'thumbnail': r're:https?://.+', - 'timestamp': 1256580802, - 'upload_date': '20091026', - 'uploader': 'あにら', - 'uploader_id': '10731211', 'view_count': int, - }, - 'params': {'skip_download': 'm3u8'}, - }, { - 'url': 'https://www.nicovideo.jp/watch/nm3601701', - 'info_dict': { - 'id': 'nm3601701', - 'ext': 'mp4', - 'title': '【UP主が見たい】Bad Apple!!\u3000PV【誰か描いてくれ】', - 'availability': 'public', - 'channel': 'Μμ', - 'channel_id': '2883832', - 'comment_count': int, - 'description': 'md5:a85ac50a7eb34d5d0ab38b4bfbde5636', - 'display_id': 'nm3601701', - 'duration': 216, - 'genres': ['ゲーム'], - 'like_count': int, - 'tags': list, - 'thumbnail': r're:https?://.+', - 'timestamp': 1212935292, - 'upload_date': '20080608', - 'uploader': 'Μμ', - 'uploader_id': '2883832', - 'view_count': int, - }, - 'params': {'skip_download': 'm3u8'}, - }, { - 'url': 'https://www.nicovideo.jp/watch/nl1872567', - 'info_dict': { - 'id': 'nl1872567', - 'ext': 'mp4', - 'title': '【12/25放送分】『生対談!!ひろゆきと戀塚のニコニコを作った人 』前半', - 'availability': 'public', - 'channel': 'nicolive', - 'channel_id': '394', - 'comment_count': int, - 'description': 'md5:79fc3a54cfdc93ecc2b883285149e548', - 'display_id': 'nl1872567', - 'duration': 586, - 'genres': ['エンターテイメント'], - 'like_count': int, - 'tags': 'count:10', - 'thumbnail': r're:https?://.+', - 'timestamp': 1198637246, - 'upload_date': '20071226', - 'uploader': 'nicolive', - 'uploader_id': '394', - 'view_count': int, - }, - 'params': {'skip_download': 'm3u8'}, - }, { - 'url': 'https://www.nicovideo.jp/watch/so23335421', - 'info_dict': { - 'id': 'so23335421', - 'ext': 'mp4', - 'title': 'ご注文はうさぎですか?\u3000第1羽「ひと目で、尋常でないもふもふだと見抜いたよ」', - 'availability': 'public', - 'channel': 'ご注文はうさぎですか?', - 'channel_id': 'ch2591203', - 'comment_count': int, - 'description': 'md5:912c895c114fa377283d3677b2bf0583', - 'display_id': 'so23335421', - 'duration': 1417, - 'genres': ['アニメ'], - 'like_count': int, - 'tags': 'count:5', - 'thumbnail': r're:https?://.+', - 'timestamp': 1397617200, - 'upload_date': '20140416', - 'uploader': 'ご注文はうさぎですか?', - 'uploader_id': 'ch2591203', - '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?://.+', - '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': 'count:9', - 'thumbnail': r're:https?://.+', - 'timestamp': 1668394800, - 'upload_date': '20221114', - 'uploader': 'ニコニコ超会議チャンネル', - 'uploader_id': 'ch2607134', - 'view_count': int, + 'tags': ['Translation_Request', 'Kagamine_Rin', 'Rin_Original'], }, 'params': {'skip_download': 'm3u8'}, - 'skip': 'Premium members only', + 'skip': True, }, { - 'url': 'https://www.nicovideo.jp/watch/so44807263', + # 'video exists but is marked as "deleted" + # md5 is unstable + 'url': 'http://www.nicovideo.jp/watch/sm10000', 'info_dict': { - 'id': 'so44807263', + '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': '【ゲスト:南早紀】峯田茉優は香里有佐と仲良くなりたい! #44(後半放送)', - 'availability': 'subscriber_only', - 'channel': '峯田茉優は香里有佐と仲良くなりたい', - 'channel_id': 'ch2648022', + '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, + 'comment_count': int, + 'genres': ['ゲーム'], + 'tags': [], + }, + 'params': {'skip_download': 'm3u8'}, + 'skip': True, + }, { + # "New" HTML5 video + 'url': 'http://www.nicovideo.jp/watch/sm31464864', + 'info_dict': { + 'id': 'sm31464864', + '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, + 'comment_count': int, + 'genres': ['アニメ'], + 'tags': [], + }, + 'params': {'skip_download': 'm3u8'}, + 'skip': True, + }, { + # Video without owner + 'url': 'http://www.nicovideo.jp/watch/sm18238488', + 'info_dict': { + 'id': 'sm18238488', + 'ext': 'mp4', + 'title': '【実写版】ミュータントタートルズ', + 'description': 'md5:15df8988e47a86f9e978af2064bf6d8e', + 'timestamp': 1341128008, + 'upload_date': '20120701', + 'thumbnail': r're:https?://.*', + 'duration': 5271, + 'view_count': int, 'comment_count': int, - 'description': 'md5:35a19c1f5f2631b8a5da66ce8958b812', - 'display_id': 'so44807263', - 'duration': 2199, 'genres': ['エンターテイメント'], - 'like_count': int, - 'tags': 'count:6', - 'thumbnail': r're:https?://.+', - 'timestamp': 1743325200, - 'upload_date': '20250330', - 'uploader': '峯田茉優は香里有佐と仲良くなりたい', - 'uploader_id': 'ch2648022', - 'view_count': int, + 'tags': [], }, 'params': {'skip_download': 'm3u8'}, - 'skip': 'Channel members only', + 'skip': True, }, { - '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': 'count:8', - 'thumbnail': r're:https?://.+', - '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', + '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, }] def _extract_formats(self, api_data, video_id):