[ie/picarto] Fix extractors (#10414)

Closes #10413
Authored by: Frankgoji
This commit is contained in:
Franklin Lee 2024-07-13 17:16:18 -07:00 committed by GitHub
parent 150ecc45d9
commit bacd18b7df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,6 +5,7 @@
ExtractorError, ExtractorError,
str_or_none, str_or_none,
traverse_obj, traverse_obj,
update_url,
) )
@ -43,15 +44,16 @@ def _real_extract(self, url):
url url
} }
}''' % (channel_id, channel_id), # noqa: UP031 }''' % (channel_id, channel_id), # noqa: UP031
})['data'] }, headers={'Accept': '*/*', 'Content-Type': 'application/json'})['data']
metadata = data['channel'] metadata = data['channel']
if metadata.get('online') == 0: if metadata.get('online') == 0:
raise ExtractorError('Stream is offline', expected=True) raise ExtractorError('Stream is offline', expected=True)
title = metadata['title'] title = metadata['title']
cdn_data = self._download_json( cdn_data = self._download_json(''.join((
data['getLoadBalancerUrl']['url'] + '/stream/json_' + metadata['stream_name'] + '.js', update_url(data['getLoadBalancerUrl']['url'], scheme='https'),
'/stream/json_', metadata['stream_name'], '.js')),
channel_id, 'Downloading load balancing info') channel_id, 'Downloading load balancing info')
formats = [] formats = []
@ -99,10 +101,10 @@ class PicartoVodIE(InfoExtractor):
}, },
'skip': 'The VOD does not exist', 'skip': 'The VOD does not exist',
}, { }, {
'url': 'https://picarto.tv/ArtofZod/videos/772650', 'url': 'https://picarto.tv/ArtofZod/videos/771008',
'md5': '00067a0889f1f6869cc512e3e79c521b', 'md5': 'abef5322f2700d967720c4c6754b2a34',
'info_dict': { 'info_dict': {
'id': '772650', 'id': '771008',
'ext': 'mp4', 'ext': 'mp4',
'title': 'Art of Zod - Drawing and Painting', 'title': 'Art of Zod - Drawing and Painting',
'thumbnail': r're:^https?://.*\.jpg', 'thumbnail': r're:^https?://.*\.jpg',
@ -131,7 +133,7 @@ def _real_extract(self, url):
}} }}
}} }}
}}''', }}''',
})['data']['video'] }, headers={'Accept': '*/*', 'Content-Type': 'application/json'})['data']['video']
file_name = data['file_name'] file_name = data['file_name']
netloc = urllib.parse.urlparse(data['video_recording_image_url']).netloc netloc = urllib.parse.urlparse(data['video_recording_image_url']).netloc