Upgrade yt_dlp and download script
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
clean_html,
|
||||
ExtractorError,
|
||||
clean_html,
|
||||
format_field,
|
||||
get_element_by_class,
|
||||
int_or_none,
|
||||
@@ -31,7 +31,7 @@ class VidioBaseIE(InfoExtractor):
|
||||
login_page = self._download_webpage(
|
||||
self._LOGIN_URL, None, 'Downloading log in page')
|
||||
|
||||
login_form = self._form_hidden_inputs("login-form", login_page)
|
||||
login_form = self._form_hidden_inputs('login-form', login_page)
|
||||
login_form.update({
|
||||
'user[login]': username,
|
||||
'user[password]': password,
|
||||
@@ -52,7 +52,7 @@ class VidioBaseIE(InfoExtractor):
|
||||
elif reason:
|
||||
subreason = get_element_by_class('onboarding-modal__description-text', login_post) or ''
|
||||
raise ExtractorError(
|
||||
'Unable to log in: %s. %s' % (reason, clean_html(subreason)), expected=True)
|
||||
f'Unable to log in: {reason}. {clean_html(subreason)}', expected=True)
|
||||
raise ExtractorError('Unable to log in')
|
||||
|
||||
def _initialize_pre_login(self):
|
||||
@@ -98,7 +98,7 @@ class VidioIE(VidioBaseIE):
|
||||
}, {
|
||||
# Premier-exclusive video
|
||||
'url': 'https://www.vidio.com/watch/1550718-stand-by-me-doraemon',
|
||||
'only_matching': True
|
||||
'only_matching': True,
|
||||
}, {
|
||||
# embed url from https://enamplus.liputan6.com/read/5033648/video-fakta-temuan-suspek-cacar-monyet-di-jawa-tengah
|
||||
'url': 'https://www.vidio.com/embed/7115874-fakta-temuan-suspek-cacar-monyet-di-jawa-tengah',
|
||||
@@ -135,7 +135,7 @@ class VidioIE(VidioBaseIE):
|
||||
|
||||
if is_premium:
|
||||
sources = self._download_json(
|
||||
'https://www.vidio.com/interactions_stream.json?video_id=%s&type=videos' % video_id,
|
||||
f'https://www.vidio.com/interactions_stream.json?video_id={video_id}&type=videos',
|
||||
display_id, note='Downloading premier API JSON')
|
||||
if not (sources.get('source') or sources.get('source_dash')):
|
||||
self.raise_login_required('This video is only available for registered users with the appropriate subscription')
|
||||
@@ -199,7 +199,7 @@ class VidioPremierIE(VidioBaseIE):
|
||||
def _playlist_entries(self, playlist_url, display_id):
|
||||
index = 1
|
||||
while playlist_url:
|
||||
playlist_json = self._call_api(playlist_url, display_id, 'Downloading API JSON page %s' % index)
|
||||
playlist_json = self._call_api(playlist_url, display_id, f'Downloading API JSON page {index}')
|
||||
for video_json in playlist_json.get('data', []):
|
||||
link = video_json['links']['watchpage']
|
||||
yield self.url_result(link, 'Vidio', video_json['id'])
|
||||
@@ -217,14 +217,14 @@ class VidioPremierIE(VidioBaseIE):
|
||||
self._playlist_entries(playlist_url, playlist_id),
|
||||
playlist_id=playlist_id, playlist_title=idata.get('title'))
|
||||
|
||||
playlist_data = self._call_api('https://api.vidio.com/content_profiles/%s/playlists' % playlist_id, display_id)
|
||||
playlist_data = self._call_api(f'https://api.vidio.com/content_profiles/{playlist_id}/playlists', display_id)
|
||||
|
||||
return self.playlist_from_matches(
|
||||
playlist_data.get('data', []), playlist_id=playlist_id, ie=self.ie_key(),
|
||||
getter=lambda data: smuggle_url(url, {
|
||||
'url': data['relationships']['videos']['links']['related'],
|
||||
'id': data['id'],
|
||||
'title': try_get(data, lambda x: x['attributes']['name'])
|
||||
'title': try_get(data, lambda x: x['attributes']['name']),
|
||||
}))
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ class VidioLiveIE(VidioBaseIE):
|
||||
def _real_extract(self, url):
|
||||
video_id, display_id = self._match_valid_url(url).groups()
|
||||
stream_data = self._call_api(
|
||||
'https://www.vidio.com/api/livestreamings/%s/detail' % video_id, display_id)
|
||||
f'https://www.vidio.com/api/livestreamings/{video_id}/detail', display_id)
|
||||
stream_meta = stream_data['livestreamings'][0]
|
||||
user = stream_data.get('users', [{}])[0]
|
||||
|
||||
@@ -265,14 +265,14 @@ class VidioLiveIE(VidioBaseIE):
|
||||
self.report_drm(video_id)
|
||||
if stream_meta.get('is_premium'):
|
||||
sources = self._download_json(
|
||||
'https://www.vidio.com/interactions_stream.json?video_id=%s&type=livestreamings' % video_id,
|
||||
f'https://www.vidio.com/interactions_stream.json?video_id={video_id}&type=livestreamings',
|
||||
display_id, note='Downloading premier API JSON')
|
||||
if not (sources.get('source') or sources.get('source_dash')):
|
||||
self.raise_login_required('This video is only available for registered users with the appropriate subscription')
|
||||
|
||||
if str_or_none(sources.get('source')):
|
||||
token_json = self._download_json(
|
||||
'https://www.vidio.com/live/%s/tokens' % video_id,
|
||||
f'https://www.vidio.com/live/{video_id}/tokens',
|
||||
display_id, note='Downloading HLS token JSON', data=b'')
|
||||
formats.extend(self._extract_m3u8_formats(
|
||||
sources['source'] + '?' + token_json.get('token', ''), display_id, 'mp4', 'm3u8_native'))
|
||||
@@ -281,7 +281,7 @@ class VidioLiveIE(VidioBaseIE):
|
||||
else:
|
||||
if stream_meta.get('stream_token_url'):
|
||||
token_json = self._download_json(
|
||||
'https://www.vidio.com/live/%s/tokens' % video_id,
|
||||
f'https://www.vidio.com/live/{video_id}/tokens',
|
||||
display_id, note='Downloading HLS token JSON', data=b'')
|
||||
formats.extend(self._extract_m3u8_formats(
|
||||
stream_meta['stream_token_url'] + '?' + token_json.get('token', ''),
|
||||
|
Reference in New Issue
Block a user