Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/triller.py (Python)

Code before:
        }
        for page in itertools.count(1):
            for retry in self.RetryManager():
                try:
                    video_list = self._download_json(
                        f'{self._API_BASE_URL}/api/users/{user_id}/videos',
                        username, note=f'Downloading user video list page {page}',
                        errnote='Unable to download user video list', headers={
                            'Authorization': f'Bearer {self._AUTH_TOKEN}',
                            'Origin': 'https://triller.co',
                        }, query=query)
                except ExtractorError as e:
                    if isinstance(e.cause, json.JSONDecodeError) and e.cause.pos == 0:
                        retry.error = e
                        continue
                    raise
            yield from video_list.get('videos', [])
            if not video_list.get('videos'):
                break
            before_time = traverse_obj(video_list, ('videos', -1, 'timestamp'))
            if not before_time:
                break
            query = {
                'before_time': before_time,
                'limit': limit,
            }

    def _entries(self, videos, user_info):
        for video in videos:
            yield {
                **self._parse_video_info(video, user_info),
                'extractor_key': TrillerIE.ie_key(),
                'extractor': 'Triller',
            }

    def _real_extract(self, url):
        username = self._match_id(url)
        if not self._IS_LOGGED_IN:
            self._create_guest()

        user_info = self._download_json(
            f'{self._API_BASE_URL}/api/users/by_username/{username}',
            username, note='Downloading user info',
            errnote='Failed to download user info', headers={
                'Authorization': f'Bearer {self._AUTH_TOKEN}',
                'Origin': 'https://triller.co',
            }).get('user')
        if not user_info:
            raise ExtractorError('Unable to extract user info')

        if user_info.get('private') and not user_info.get('followed_by_me'):

Review comment (suggestion):
```suggestion
            query['before_time'] = traverse_obj(video_list, ('videos', -1, 'timestamp'))
            if not query['before_time']:
                break
```

Code after:
            if not video_list.get('videos'):
                break
            yield from video_list['videos']
            query['before_time'] = traverse_obj(video_list, ('videos', -1, 'timestamp'))
            if not query['before_time']:
                break

    def _entries(self, videos, username, user_info):
        for video in videos:
            yield self._parse_video_info(video, username, user_info)

    def _real_extract(self, url):
        username = self._match_id(url)
        user_info = self._check_user_info(self._download_json(
            f'{self._API_BASE_URL}/api/users/by_username/{username}',
            username, note='Downloading user info',
            errnote='Failed to download user info', headers={
                'Authorization': f'Bearer {self._AUTH_TOKEN}',
                'Origin': 'https://triller.co',
            }).get('user', {}))

        user_id = str_or_none(user_info.get('user_id'))
        videos = self._extract_video_list(username, user_id)
        thumbnail = user_info.get('avatar_url')

        return self.playlist_result(
            self._entries(videos, username, user_info), user_id, username, thumbnail=thumbnail)