diff options
author | Jesus <heckyel@riseup.net> | 2023-09-04 01:59:36 +0800 |
---|---|---|
committer | Jesus <heckyel@riseup.net> | 2023-09-04 01:59:36 +0800 |
commit | b3013540b41d1eb77c4803c5fca46f8d75b40fc1 (patch) | |
tree | 97735cb0c49f3a2b0f276e1cd90817833d590d69 /hypervideo_dl/extractor/vrv.py | |
parent | eaeeef9c1d1bedb76fea953c332ef84d53bffe2c (diff) | |
download | hypervideo-b3013540b41d1eb77c4803c5fca46f8d75b40fc1.tar.lz hypervideo-b3013540b41d1eb77c4803c5fca46f8d75b40fc1.tar.xz hypervideo-b3013540b41d1eb77c4803c5fca46f8d75b40fc1.zip |
update from upstream
Diffstat (limited to 'hypervideo_dl/extractor/vrv.py')
-rw-r--r-- | hypervideo_dl/extractor/vrv.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/hypervideo_dl/extractor/vrv.py b/hypervideo_dl/extractor/vrv.py index 89fa7af..523c442 100644 --- a/hypervideo_dl/extractor/vrv.py +++ b/hypervideo_dl/extractor/vrv.py @@ -8,7 +8,8 @@ import time import urllib.parse from .common import InfoExtractor -from ..compat import compat_HTTPError, compat_urllib_parse_urlencode +from ..compat import compat_urllib_parse_urlencode +from ..networking.exceptions import HTTPError from ..utils import ( ExtractorError, float_or_none, @@ -30,7 +31,7 @@ class VRVBaseIE(InfoExtractor): base_url = self._API_DOMAIN + '/core/' + path query = [ ('oauth_consumer_key', self._API_PARAMS['oAuthKey']), - ('oauth_nonce', ''.join([random.choice(string.ascii_letters) for _ in range(32)])), + ('oauth_nonce', ''.join(random.choices(string.ascii_letters, k=32))), ('oauth_signature_method', 'HMAC-SHA1'), ('oauth_timestamp', int(time.time())), ] @@ -54,8 +55,8 @@ class VRVBaseIE(InfoExtractor): '?'.join([base_url, encoded_query]), video_id, note='Downloading %s JSON metadata' % note, headers=headers, data=data) except ExtractorError as e: - if isinstance(e.cause, compat_HTTPError) and e.cause.code == 401: - raise ExtractorError(json.loads(e.cause.read().decode())['message'], expected=True) + if isinstance(e.cause, HTTPError) and e.cause.status == 401: + raise ExtractorError(json.loads(e.cause.response.read().decode())['message'], expected=True) raise def _call_cms(self, path, video_id, note): |