summaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/rcti.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:06:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:06:10 +0000
commit7e21328585afda6d66f98ca476301680eeffac32 (patch)
tree266a4e7b20443f94572748781d71fc0375a15037 /yt_dlp/extractor/rcti.py
parentAdding upstream version 2024.05.27. (diff)
downloadyt-dlp-7e21328585afda6d66f98ca476301680eeffac32.tar.xz
yt-dlp-7e21328585afda6d66f98ca476301680eeffac32.zip
Adding upstream version 2024.07.01.upstream/2024.07.01
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'yt_dlp/extractor/rcti.py')
-rw-r--r--yt_dlp/extractor/rcti.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/yt_dlp/extractor/rcti.py b/yt_dlp/extractor/rcti.py
index 9c382e2..61b73a5 100644
--- a/yt_dlp/extractor/rcti.py
+++ b/yt_dlp/extractor/rcti.py
@@ -154,34 +154,34 @@ class RCTIPlusIE(RCTIPlusBaseIE):
is_upcoming = try_get(video_json, lambda x: x['current_date'] < x['start_date'])
if is_upcoming:
self.raise_no_formats(
- 'This event will start at %s.' % video_json['live_label'] if video_json.get('live_label') else 'This event has not started yet.', expected=True)
+ 'This event will start at {}.'.format(video_json['live_label']) if video_json.get('live_label') else 'This event has not started yet.', expected=True)
if 'akamaized' in video_url:
# For some videos hosted on Akamai's CDN (possibly AES-encrypted ones?), a session needs to at least be made via Conviva's API
conviva_json_data = {
**self._CONVIVA_JSON_TEMPLATE,
'url': video_url,
- 'sst': int(time.time())
+ 'sst': int(time.time()),
}
conviva_json_res = self._download_json(
'https://ff84ae928c3b33064b76dec08f12500465e59a6f.cws.conviva.com/0/wsg', display_id,
'Creating Conviva session', 'Failed to create Conviva session',
- fatal=False, data=json.dumps(conviva_json_data).encode('utf-8'))
+ fatal=False, data=json.dumps(conviva_json_data).encode())
if conviva_json_res and conviva_json_res.get('err') != 'ok':
- self.report_warning('Conviva said: %s' % str(conviva_json_res.get('err')))
+ self.report_warning('Conviva said: {}'.format(str(conviva_json_res.get('err'))))
video_meta, meta_paths = self._call_api(
- 'https://api.rctiplus.com/api/v1/%s/%s' % (video_type, video_id), display_id, 'Downloading video metadata')
+ f'https://api.rctiplus.com/api/v1/{video_type}/{video_id}', display_id, 'Downloading video metadata')
thumbnails, image_path = [], meta_paths.get('image_path', 'https://rstatic.akamaized.net/media/')
if video_meta.get('portrait_image'):
thumbnails.append({
'id': 'portrait_image',
- 'url': '%s%d%s' % (image_path, 2000, video_meta['portrait_image']) # 2000px seems to be the highest resolution that can be given
+ 'url': '{}{}{}'.format(image_path, 2000, video_meta['portrait_image']), # 2000px seems to be the highest resolution that can be given
})
if video_meta.get('landscape_image'):
thumbnails.append({
'id': 'landscape_image',
- 'url': '%s%d%s' % (image_path, 2000, video_meta['landscape_image'])
+ 'url': '{}{}{}'.format(image_path, 2000, video_meta['landscape_image']),
})
try:
formats = self._extract_m3u8_formats(video_url, display_id, 'mp4', headers={'Referer': 'https://www.rctiplus.com/'})
@@ -241,7 +241,7 @@ class RCTIPlusSeriesIE(RCTIPlusBaseIE):
'age_limit': 2,
'tags': 'count:11',
'display_id': 'inews-pagi',
- }
+ },
}]
_AGE_RATINGS = { # Based off https://id.wikipedia.org/wiki/Sistem_rating_konten_televisi with additional ratings
'S-SU': 2,
@@ -255,13 +255,13 @@ class RCTIPlusSeriesIE(RCTIPlusBaseIE):
@classmethod
def suitable(cls, url):
- return False if RCTIPlusIE.suitable(url) else super(RCTIPlusSeriesIE, cls).suitable(url)
+ return False if RCTIPlusIE.suitable(url) else super().suitable(url)
def _entries(self, url, display_id=None, note='Downloading entries JSON', metadata={}):
total_pages = 0
try:
total_pages = self._call_api(
- '%s&length=20&page=0' % url,
+ f'{url}&length=20&page=0',
display_id, note)[1]['pagination']['total_page']
except ExtractorError as e:
if 'not found' in str(e):
@@ -272,8 +272,8 @@ class RCTIPlusSeriesIE(RCTIPlusBaseIE):
for page_num in range(1, total_pages + 1):
episode_list = self._call_api(
- '%s&length=20&page=%s' % (url, page_num),
- display_id, '%s page %s' % (note, page_num))[0] or []
+ f'{url}&length=20&page={page_num}',
+ display_id, f'{note} page {page_num}')[0] or []
for video_json in episode_list:
yield {
@@ -288,7 +288,7 @@ class RCTIPlusSeriesIE(RCTIPlusBaseIE):
'duration': video_json.get('duration'),
'season_number': video_json.get('season'),
'episode_number': video_json.get('episode'),
- **metadata
+ **metadata,
}
def _series_entries(self, series_id, display_id=None, video_type=None, metadata={}):
@@ -348,7 +348,7 @@ class RCTIPlusTVIE(RCTIPlusBaseIE):
},
'params': {
'skip_download': True,
- }
+ },
}, {
# Returned video will always change
'url': 'https://www.rctiplus.com/live-event',
@@ -361,7 +361,7 @@ class RCTIPlusTVIE(RCTIPlusBaseIE):
@classmethod
def suitable(cls, url):
- return False if RCTIPlusIE.suitable(url) else super(RCTIPlusTVIE, cls).suitable(url)
+ return False if RCTIPlusIE.suitable(url) else super().suitable(url)
def _real_extract(self, url):
match = self._match_valid_url(url).groupdict()