aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsepro <4618135+seproDev@users.noreply.github.com>2023-08-28 23:09:14 +0200
committerGitHub <noreply@github.com>2023-08-28 21:09:14 +0000
commitc2d8ee0000302aba63476b7d5bd8793e57b6c8c6 (patch)
treef1489bc27dfc492af922dbee4a47c732c12788c3
parent56b3dc03354b75be995759d8441d2754c0442b9a (diff)
downloadhypervideo-pre-c2d8ee0000302aba63476b7d5bd8793e57b6c8c6.tar.lz
hypervideo-pre-c2d8ee0000302aba63476b7d5bd8793e57b6c8c6.tar.xz
hypervideo-pre-c2d8ee0000302aba63476b7d5bd8793e57b6c8c6.zip
[ie/weverse] Support extraction without auth (#7924)
Authored by: seproDev
-rw-r--r--yt_dlp/extractor/weverse.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/yt_dlp/extractor/weverse.py b/yt_dlp/extractor/weverse.py
index 9a08b8e43..bbf62856a 100644
--- a/yt_dlp/extractor/weverse.py
+++ b/yt_dlp/extractor/weverse.py
@@ -70,10 +70,8 @@ class WeverseBaseIE(InfoExtractor):
return
token = try_call(lambda: self._get_cookies('https://weverse.io/')['we2_access_token'].value)
- if not token:
- self.raise_login_required()
-
- WeverseBaseIE._API_HEADERS['Authorization'] = f'Bearer {token}'
+ if token:
+ WeverseBaseIE._API_HEADERS['Authorization'] = f'Bearer {token}'
def _call_api(self, ep, video_id, data=None, note='Downloading API JSON'):
# Ref: https://ssl.pstatic.net/static/wevweb/2_3_2_11101725/public/static/js/2488.a09b41ff.chunk.js
@@ -101,11 +99,14 @@ class WeverseBaseIE(InfoExtractor):
self.raise_login_required(
'Session token has expired. Log in again or refresh cookies in browser')
elif isinstance(e.cause, HTTPError) and e.cause.status == 403:
- raise ExtractorError('Your account does not have access to this content', expected=True)
+ if 'Authorization' in self._API_HEADERS:
+ raise ExtractorError('Your account does not have access to this content', expected=True)
+ self.raise_login_required()
raise
def _call_post_api(self, video_id):
- return self._call_api(f'/post/v1.0/post-{video_id}?fieldSet=postV1', video_id)
+ path = '' if 'Authorization' in self._API_HEADERS else '/preview'
+ return self._call_api(f'/post/v1.0/post-{video_id}{path}?fieldSet=postV1', video_id)
def _get_community_id(self, channel):
return str(self._call_api(