diff options
| author | MinePlayersPE <mineplayerspealt@gmail.com> | 2021-12-28 09:38:23 +0700 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-28 08:08:23 +0530 | 
| commit | e540c56f397b839b826b430a0034e651027ad07c (patch) | |
| tree | db607a517346ab17c115997662e9b8f6704c57ac | |
| parent | 45d86abeb4959723860848dea5f47969dfe56c11 (diff) | |
| download | hypervideo-pre-e540c56f397b839b826b430a0034e651027ad07c.tar.lz hypervideo-pre-e540c56f397b839b826b430a0034e651027ad07c.tar.xz hypervideo-pre-e540c56f397b839b826b430a0034e651027ad07c.zip | |
[TikTok] Fallback to feed API endpoint (#2142)
Authored by: MinePlayersPE
Workaround for #2133
| -rw-r--r-- | yt_dlp/extractor/tiktok.py | 16 | 
1 files changed, 12 insertions, 4 deletions
| diff --git a/yt_dlp/extractor/tiktok.py b/yt_dlp/extractor/tiktok.py index 0cd82b560..c34235e96 100644 --- a/yt_dlp/extractor/tiktok.py +++ b/yt_dlp/extractor/tiktok.py @@ -348,10 +348,18 @@ class TikTokIE(TikTokBaseIE):      }]      def _extract_aweme_app(self, aweme_id): -        aweme_detail = self._call_api('aweme/detail', {'aweme_id': aweme_id}, aweme_id, -                                      note='Downloading video details', errnote='Unable to download video details').get('aweme_detail') -        if not aweme_detail: -            raise ExtractorError('Video not available', video_id=aweme_id) +        try: +            aweme_detail = self._call_api('aweme/detail', {'aweme_id': aweme_id}, aweme_id, +                                          note='Downloading video details', errnote='Unable to download video details').get('aweme_detail') +            if not aweme_detail: +                raise ExtractorError('Video not available', video_id=aweme_id) +        except ExtractorError as e: +            self.report_warning(f'{e}; Retrying with feed workaround') +            feed_list = self._call_api('feed', {'aweme_id': aweme_id}, aweme_id, +                                       note='Downloading video feed', errnote='Unable to download video feed').get('aweme_list') or [] +            aweme_detail = next(aweme for aweme in feed_list if str(aweme.get('aweme_id')) == aweme_id) +            if not aweme_detail: +                raise ExtractorError('Unable to find video in feed', video_id=aweme_id)          return self._parse_aweme_video_app(aweme_detail)      def _real_extract(self, url): | 
