]> jfr.im git - yt-dlp.git/commitdiff
[extractor/twitcasting] Fix videos with password (#5894)
authorSam <redacted>
Thu, 29 Dec 2022 11:15:38 +0000 (06:15 -0500)
committerGitHub <redacted>
Thu, 29 Dec 2022 11:15:38 +0000 (11:15 +0000)
Closes #5888
Authored by: bashonly, Spicadox

yt_dlp/extractor/twitcasting.py

index 735cb0bb088397b0207fcbe1063d5c90b9a41047..2548dae047fbd038059e7ba9d41f90313d6d96e3 100644 (file)
@@ -38,7 +38,7 @@ class TwitCastingIE(InfoExtractor):
             'description': 'Twitter Oficial da cantora brasileira Ivete Sangalo.',
             'thumbnail': r're:^https?://.*\.jpg$',
             'upload_date': '20110822',
-            'timestamp': 1314010824,
+            'timestamp': 1313978424,
             'duration': 32,
             'view_count': int,
         },
@@ -52,10 +52,10 @@ class TwitCastingIE(InfoExtractor):
             'ext': 'mp4',
             'title': 'Live playing something #3689740',
             'uploader_id': 'mttbernardini',
-            'description': 'Salve, io sono Matto (ma con la e). Questa è la mia presentazione, in quanto sono letteralmente matto (nel senso di strano), con qualcosa in più.',
+            'description': 'md5:1dc7efa2f1ab932fcd119265cebeec69',
             'thumbnail': r're:^https?://.*\.jpg$',
-            'upload_date': '20120212',
-            'timestamp': 1329028024,
+            'upload_date': '20120211',
+            'timestamp': 1328995624,
             'duration': 681,
             'view_count': int,
         },
@@ -64,15 +64,22 @@ class TwitCastingIE(InfoExtractor):
             'videopassword': 'abc',
         },
     }, {
-        'note': 'archive is split in 2 parts',
         'url': 'https://twitcasting.tv/loft_heaven/movie/685979292',
         'info_dict': {
             'id': '685979292',
             'ext': 'mp4',
-            'title': '南波一海のhear_here “ナタリー望月哲さんに聞く編集と「渋谷系狂騒曲」”',
-            'duration': 6964.599334,
+            'title': '【無料配信】南波一海のhear/here “ナタリー望月哲さんに聞く編集と「渋谷系狂騒曲」”',
+            'uploader_id': 'loft_heaven',
+            'description': 'md5:3a0c7b53019df987ce545c935538bacf',
+            'upload_date': '20210604',
+            'timestamp': 1622802114,
+            'thumbnail': r're:^https?://.*\.jpg$',
+            'duration': 6964,
+            'view_count': int,
+        },
+        'params': {
+            'skip_download': True,
         },
-        'playlist_mincount': 2,
     }]
 
     def _parse_data_movie_playlist(self, dmp, video_id):
@@ -88,15 +95,18 @@ def _parse_data_movie_playlist(self, dmp, video_id):
     def _real_extract(self, url):
         uploader_id, video_id = self._match_valid_url(url).groups()
 
+        webpage, urlh = self._download_webpage_handle(url, video_id)
         video_password = self.get_param('videopassword')
         request_data = None
         if video_password:
             request_data = urlencode_postdata({
                 'password': video_password,
+                **self._hidden_inputs(webpage),
             }, encoding='utf-8')
-        webpage, urlh = self._download_webpage_handle(
-            url, video_id, data=request_data,
-            headers={'Origin': 'https://twitcasting.tv'})
+            webpage, urlh = self._download_webpage_handle(
+                url, video_id, data=request_data,
+                headers={'Origin': 'https://twitcasting.tv'},
+                note='Trying video password')
         if urlh.geturl() != url and request_data:
             webpage = self._download_webpage(
                 urlh.geturl(), video_id, data=request_data,
@@ -122,7 +132,7 @@ def _real_extract(self, url):
         duration = (try_get(video_js_data, lambda x: sum(float_or_none(y.get('duration')) for y in x) / 1000)
                     or parse_duration(clean_html(get_element_by_class('tw-player-duration-time', webpage))))
         view_count = str_to_int(self._search_regex(
-            (r'Total\s*:\s*([\d,]+)\s*Views', r'総視聴者\s*:\s*([\d,]+)\s*</'), webpage, 'views', None))
+            (r'Total\s*:\s*Views\s*([\d,]+)', r'総視聴者\s*:\s*([\d,]+)\s*</'), webpage, 'views', None))
         timestamp = unified_timestamp(self._search_regex(
             r'data-toggle="true"[^>]+datetime="([^"]+)"',
             webpage, 'datetime', None))