Browse Source

[ie/chzzk] Extract with API v3 (#10363)

Authored by: hui1601
Dong Heon Hee 8 months ago
parent
commit
4862a29854
1 changed files with 35 additions and 2 deletions
  1. 35 2
      yt_dlp/extractor/chzzk.py

+ 35 - 2
yt_dlp/extractor/chzzk.py

@@ -36,7 +36,7 @@ class CHZZKLiveIE(InfoExtractor):
     def _real_extract(self, url):
         channel_id = self._match_id(url)
         live_detail = self._download_json(
-            f'https://api.chzzk.naver.com/service/v2/channels/{channel_id}/live-detail', channel_id,
+            f'https://api.chzzk.naver.com/service/v3/channels/{channel_id}/live-detail', channel_id,
             note='Downloading channel info', errnote='Unable to download channel info')['content']
 
         if live_detail.get('status') == 'CLOSE':
@@ -106,12 +106,45 @@ class CHZZKVideoIE(InfoExtractor):
             'upload_date': '20231219',
             'view_count': int,
         },
+        'skip': 'Replay video is expired',
+    }, {
+        # Manually uploaded video
+        'url': 'https://chzzk.naver.com/video/1980',
+        'info_dict': {
+            'id': '1980',
+            'ext': 'mp4',
+            'title': '※시청주의※한번보면 잊기 힘든 영상',
+            'channel': '라디유radiyu',
+            'channel_id': '68f895c59a1043bc5019b5e08c83a5c5',
+            'channel_is_verified': False,
+            'thumbnail': r're:^https?://.*\.jpg$',
+            'duration': 95,
+            'timestamp': 1703102631.722,
+            'upload_date': '20231220',
+            'view_count': int,
+        },
+    }, {
+        # Partner channel replay video
+        'url': 'https://chzzk.naver.com/video/2458',
+        'info_dict': {
+            'id': '2458',
+            'ext': 'mp4',
+            'title': '첫 방송',
+            'channel': '강지',
+            'channel_id': 'b5ed5db484d04faf4d150aedd362f34b',
+            'channel_is_verified': True,
+            'thumbnail': r're:^https?://.*\.jpg$',
+            'duration': 4433,
+            'timestamp': 1703307460.214,
+            'upload_date': '20231223',
+            'view_count': int,
+        },
     }]
 
     def _real_extract(self, url):
         video_id = self._match_id(url)
         video_meta = self._download_json(
-            f'https://api.chzzk.naver.com/service/v2/videos/{video_id}', video_id,
+            f'https://api.chzzk.naver.com/service/v3/videos/{video_id}', video_id,
             note='Downloading video info', errnote='Unable to download video info')['content']
         formats, subtitles = self._extract_mpd_formats_and_subtitles(
             f'https://apis.naver.com/neonplayer/vodplay/v1/playback/{video_meta["videoId"]}', video_id,