diff options
Diffstat (limited to '')
-rw-r--r-- | yt_dlp/extractor/odnoklassniki.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/yt_dlp/extractor/odnoklassniki.py b/yt_dlp/extractor/odnoklassniki.py index 1be45d8..d27d1c3 100644 --- a/yt_dlp/extractor/odnoklassniki.py +++ b/yt_dlp/extractor/odnoklassniki.py @@ -1,12 +1,7 @@ import urllib.parse from .common import InfoExtractor -from ..compat import ( - compat_etree_fromstring, - compat_parse_qs, - compat_urllib_parse_unquote, - compat_urllib_parse_urlparse, -) +from ..compat import compat_etree_fromstring from ..networking import HEADRequest from ..utils import ( ExtractorError, @@ -257,8 +252,8 @@ class OdnoklassnikiIE(InfoExtractor): raise e def _extract_desktop(self, url): - start_time = int_or_none(compat_parse_qs( - compat_urllib_parse_urlparse(url).query).get('fromTime', [None])[0]) + start_time = int_or_none(urllib.parse.parse_qs( + urllib.parse.urlparse(url).query).get('fromTime', [None])[0]) url, smuggled = unsmuggle_url(url, {}) video_id, is_embed = self._match_valid_url(url).group('id', 'embed') @@ -281,7 +276,7 @@ class OdnoklassnikiIE(InfoExtractor): player = self._parse_json( unescapeHTML(self._search_regex( - r'data-options=(?P<quote>["\'])(?P<player>{.+?%s.+?})(?P=quote)' % video_id, + rf'data-options=(?P<quote>["\'])(?P<player>{{.+?{video_id}.+?}})(?P=quote)', webpage, 'player', group='player')), video_id) @@ -300,7 +295,7 @@ class OdnoklassnikiIE(InfoExtractor): if st_location: data['st.location'] = st_location metadata = self._download_json( - compat_urllib_parse_unquote(flashvars['metadataUrl']), + urllib.parse.unquote(flashvars['metadataUrl']), video_id, 'Downloading metadata JSON', data=urlencode_postdata(data)) @@ -434,7 +429,7 @@ class OdnoklassnikiIE(InfoExtractor): video_id = self._match_id(url) webpage = self._download_webpage( - 'http://m.ok.ru/video/%s' % video_id, video_id, + f'http://m.ok.ru/video/{video_id}', video_id, note='Downloading mobile webpage') error = self._search_regex( @@ -460,5 +455,5 @@ class OdnoklassnikiIE(InfoExtractor): 'format_id': 'mobile', 'url': redirect_url, 'ext': 'mp4', - }] + }], } |