mirror of https://github.com/yt-dlp/yt-dlp.git
[ie/weverse] Support extraction without auth (#7924)
Authored by: seproDev
This commit is contained in:
parent
56b3dc0335
commit
c2d8ee0000
|
@ -70,9 +70,7 @@ class WeverseBaseIE(InfoExtractor):
|
||||||
return
|
return
|
||||||
|
|
||||||
token = try_call(lambda: self._get_cookies('https://weverse.io/')['we2_access_token'].value)
|
token = try_call(lambda: self._get_cookies('https://weverse.io/')['we2_access_token'].value)
|
||||||
if not token:
|
if token:
|
||||||
self.raise_login_required()
|
|
||||||
|
|
||||||
WeverseBaseIE._API_HEADERS['Authorization'] = f'Bearer {token}'
|
WeverseBaseIE._API_HEADERS['Authorization'] = f'Bearer {token}'
|
||||||
|
|
||||||
def _call_api(self, ep, video_id, data=None, note='Downloading API JSON'):
|
def _call_api(self, ep, video_id, data=None, note='Downloading API JSON'):
|
||||||
|
@ -101,11 +99,14 @@ class WeverseBaseIE(InfoExtractor):
|
||||||
self.raise_login_required(
|
self.raise_login_required(
|
||||||
'Session token has expired. Log in again or refresh cookies in browser')
|
'Session token has expired. Log in again or refresh cookies in browser')
|
||||||
elif isinstance(e.cause, HTTPError) and e.cause.status == 403:
|
elif isinstance(e.cause, HTTPError) and e.cause.status == 403:
|
||||||
|
if 'Authorization' in self._API_HEADERS:
|
||||||
raise ExtractorError('Your account does not have access to this content', expected=True)
|
raise ExtractorError('Your account does not have access to this content', expected=True)
|
||||||
|
self.raise_login_required()
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def _call_post_api(self, video_id):
|
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):
|
def _get_community_id(self, channel):
|
||||||
return str(self._call_api(
|
return str(self._call_api(
|
||||||
|
|
Loading…
Reference in New Issue