summaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/go.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
commit137f07c27a88b07df57df5b2cdebebe3c7722bac (patch)
tree4ebdcbea6b540f69c40ba0be6ac766008030d149 /yt_dlp/extractor/go.py
parentAdding debian version 2024.05.27-1. (diff)
downloadyt-dlp-137f07c27a88b07df57df5b2cdebebe3c7722bac.tar.xz
yt-dlp-137f07c27a88b07df57df5b2cdebebe3c7722bac.zip
Merging upstream version 2024.07.01.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'yt_dlp/extractor/go.py')
-rw-r--r--yt_dlp/extractor/go.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/yt_dlp/extractor/go.py b/yt_dlp/extractor/go.py
index fba98d7..83c1979 100644
--- a/yt_dlp/extractor/go.py
+++ b/yt_dlp/extractor/go.py
@@ -1,11 +1,11 @@
import re
from .adobepass import AdobePassIE
-from ..compat import compat_str
from ..utils import (
ExtractorError,
determine_ext,
int_or_none,
+ join_nonempty,
parse_age_limit,
remove_end,
remove_start,
@@ -50,14 +50,14 @@ class GoIE(AdobePassIE):
_VALID_URL = r'''(?x)
https?://
(?P<sub_domain>
- (?:%s\.)?go|fxnow\.fxnetworks|
+ (?:{}\.)?go|fxnow\.fxnetworks|
(?:www\.)?(?:abc|freeform|disneynow)
)\.com/
(?:
(?:[^/]+/)*(?P<id>[Vv][Dd][Kk][Aa]\w+)|
(?:[^/]+/)*(?P<display_id>[^/?\#]+)
)
- ''' % r'\.|'.join(list(_SITE_INFO.keys()))
+ '''.format(r'\.|'.join(list(_SITE_INFO.keys())))
_TESTS = [{
'url': 'http://abc.go.com/shows/designated-survivor/video/most-recent/VDKA3807643',
'info_dict': {
@@ -94,7 +94,7 @@ class GoIE(AdobePassIE):
'series': 'Shadowhunters',
'episode_number': 1,
'timestamp': 1483387200,
- 'ext': 'mp4'
+ 'ext': 'mp4',
},
'params': {
'geo_bypass_ip_block': '3.244.239.0/24',
@@ -168,7 +168,7 @@ class GoIE(AdobePassIE):
def _extract_videos(self, brand, video_id='-1', show_id='-1'):
display_id = video_id if video_id != '-1' else show_id
return self._download_json(
- 'http://api.contents.watchabc.go.com/vp2/ws/contents/3000/videos/%s/001/-1/%s/-1/%s/-1/-1.json' % (brand, show_id, video_id),
+ f'http://api.contents.watchabc.go.com/vp2/ws/contents/3000/videos/{brand}/001/-1/{show_id}/-1/{video_id}/-1/-1.json',
display_id)['video']
def _real_extract(self, url):
@@ -191,7 +191,7 @@ class GoIE(AdobePassIE):
video_id = try_get(
layout,
(lambda x: x['videoid'], lambda x: x['video']['id']),
- compat_str)
+ str)
if not video_id:
video_id = self._search_regex(
(
@@ -201,7 +201,7 @@ class GoIE(AdobePassIE):
# page.analytics.videoIdCode
r'\bvideoIdCode["\']\s*:\s*["\']((?:vdka|VDKA)\w+)',
# https://abc.com/shows/the-rookie/episode-guide/season-02/03-the-bet
- r'\b(?:video)?id["\']\s*:\s*["\'](VDKA\w+)'
+ r'\b(?:video)?id["\']\s*:\s*["\'](VDKA\w+)',
), webpage, 'video id', default=video_id)
if not site_info:
brand = self._search_regex(
@@ -266,7 +266,7 @@ class GoIE(AdobePassIE):
self.raise_geo_restricted(
error['message'], countries=['US'])
error_message = ', '.join([error['message'] for error in errors])
- raise ExtractorError('%s said: %s' % (self.IE_NAME, error_message), expected=True)
+ raise ExtractorError(f'{self.IE_NAME} said: {error_message}', expected=True)
asset_url += '?' + entitlement['uplynkData']['sessionKey']
fmts, subs = self._extract_m3u8_formats_and_subtitles(
asset_url, video_id, 'mp4', m3u8_id=format_id or 'hls', fatal=False)
@@ -280,7 +280,7 @@ class GoIE(AdobePassIE):
}
if re.search(r'(?:/mp4/source/|_source\.mp4)', asset_url):
f.update({
- 'format_id': ('%s-' % format_id if format_id else '') + 'SOURCE',
+ 'format_id': (f'{format_id}-' if format_id else '') + 'SOURCE',
'quality': 1,
})
else:
@@ -288,7 +288,7 @@ class GoIE(AdobePassIE):
if mobj:
height = int(mobj.group(2))
f.update({
- 'format_id': ('%s-' % format_id if format_id else '') + '%dP' % height,
+ 'format_id': join_nonempty(format_id, f'{height}P'),
'width': int(mobj.group(1)),
'height': height,
})