mirror of https://github.com/yt-dlp/yt-dlp.git
[ie/triller] Fix unlisted video extraction (#7670)
Authored by: bashonly
This commit is contained in:
parent
86aea0d3a2
commit
39837ae319
|
@ -66,13 +66,6 @@ class TrillerBaseIE(InfoExtractor):
|
||||||
'timestamp': ('timestamp', {unified_timestamp}),
|
'timestamp': ('timestamp', {unified_timestamp}),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
def _check_user_info(self, user_info):
|
|
||||||
if user_info.get('private') and not user_info.get('followed_by_me'):
|
|
||||||
raise ExtractorError('This video is private', expected=True)
|
|
||||||
elif traverse_obj(user_info, 'blocked_by_user', 'blocking_user'):
|
|
||||||
raise ExtractorError('The author of the video is blocked', expected=True)
|
|
||||||
return user_info
|
|
||||||
|
|
||||||
def _parse_video_info(self, video_info, username, user_id, display_id=None):
|
def _parse_video_info(self, video_info, username, user_id, display_id=None):
|
||||||
video_id = str(video_info['id'])
|
video_id = str(video_info['id'])
|
||||||
display_id = display_id or video_info.get('video_uuid')
|
display_id = display_id or video_info.get('video_uuid')
|
||||||
|
@ -231,8 +224,6 @@ class TrillerIE(TrillerBaseIE):
|
||||||
f'{self._API_BASE_URL}/api/videos/{display_id}', display_id,
|
f'{self._API_BASE_URL}/api/videos/{display_id}', display_id,
|
||||||
headers=self._API_HEADERS)['videos'][0]
|
headers=self._API_HEADERS)['videos'][0]
|
||||||
|
|
||||||
self._check_user_info(video_info.get('user') or {})
|
|
||||||
|
|
||||||
return self._parse_video_info(video_info, username, None, display_id)
|
return self._parse_video_info(video_info, username, None, display_id)
|
||||||
|
|
||||||
|
|
||||||
|
@ -287,9 +278,14 @@ class TrillerUserIE(TrillerBaseIE):
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
username = self._match_id(url)
|
username = self._match_id(url)
|
||||||
|
|
||||||
user_info = self._check_user_info(self._download_json(
|
user_info = traverse_obj(self._download_json(
|
||||||
f'{self._API_BASE_URL}/api/users/by_username/{username}',
|
f'{self._API_BASE_URL}/api/users/by_username/{username}',
|
||||||
username, note='Downloading user info', headers=self._API_HEADERS)['user'])
|
username, note='Downloading user info', headers=self._API_HEADERS), ('user', {dict})) or {}
|
||||||
|
|
||||||
|
if user_info.get('private') and user_info.get('followed_by_me') not in (True, 'true'):
|
||||||
|
raise ExtractorError('This user profile is private', expected=True)
|
||||||
|
elif traverse_obj(user_info, (('blocked_by_user', 'blocking_user'), {bool}), get_all=False):
|
||||||
|
raise ExtractorError('The author of the video is blocked', expected=True)
|
||||||
|
|
||||||
user_id = str_or_none(user_info.get('user_id'))
|
user_id = str_or_none(user_info.get('user_id'))
|
||||||
if not user_id:
|
if not user_id:
|
||||||
|
|
Loading…
Reference in New Issue