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

Code before:
                }).encode())
        except ExtractorError as e:
            if isinstance(e.cause, HTTPError) and e.cause.status == 400:
                raise ExtractorError('Invalid username/password', expected=True)
            raise

        self._refresh_token = auth_data['jwt']['refreshToken']
        self._access_token = auth_data['jwt']['accessToken']
        self.cache.store(self._NETRC_MACHINE, 'token_data', [self._refresh_token, self._access_token])

    def _call_playback_api(self, content_id):
        if self._access_token and self._is_jwt_expired(self._access_token):
            self._refresh_access_token()
        for is_retry in (False, True):
            try:
                return self._download_json_handle(
                    f'https://10.com.au/api/v1/videos/playback/{content_id}/', content_id,
                    note='Downloading video JSON', query={'platform': 'samsung'},
                    headers=filter_dict({
                        'TP-AcceptFeature': 'v1/fw;v1/drm',
                        'Authorization': f'Bearer {self._access_token}' if self._access_token else None,
                    }))
            except ExtractorError as e:
                if not is_retry and isinstance(e.cause, HTTPError) and e.cause.status == 403:
                    if self._access_token:
                        self.report_warning('Access token has expired; refreshing')
                        self._refresh_access_token()
                        continue
                    elif not self._get_login_info()[0]:
                        self.raise_login_required('Login required to access this video', method='password')
                raise

    def _real_extract(self, url):
        content_id = self._match_id(url)
        data = self._download_json(
            f'https://10.com.au/api/v1/videos/{content_id}', content_id)

        video_data, urlh = self._call_playback_api(content_id)
        content_source_id = video_data['dai']['contentSourceId']
        video_id = video_data['dai']['videoId']
        auth_token = urlh.get_header('x-dai-auth')
        if not auth_token:
            raise ExtractorError('Failed to get DAI auth token')

        dai_data = self._download_json(
            f'https://pubads.g.doubleclick.net/ondemand/hls/content/{content_source_id}/vid/{video_id}/streams',
            content_id, note='Downloading DAI JSON',
            data=urlencode_postdata({'auth-token': auth_token}))

        # Ignore subs to avoid ad break cleanup
        formats, _ = self._extract_m3u8_formats_and_subtitles(

Review comment (suggestion):
```suggestion
                        self.to_screen('Access token has expired; refreshing')
```

Code after:
                    'password': password,
                }).encode())
        except ExtractorError as e:
            if isinstance(e.cause, HTTPError) and e.cause.status == 400:
                raise ExtractorError('Invalid username/password', expected=True)
            raise

        self._refresh_token = auth_data['jwt']['refreshToken']
        self._access_token = auth_data['jwt']['accessToken']
        self.cache.store(self._NETRC_MACHINE, self._TOKEN_CACHE_KEY, [self._refresh_token, self._access_token])

    def _call_playback_api(self, content_id):
        if self._access_token and self._is_jwt_expired(self._access_token):
            self._refresh_access_token()
        for is_retry in (False, True):
            try:
                return self._download_json_handle(
                    f'https://10.com.au/api/v1/videos/playback/{content_id}/', content_id,
                    note='Downloading video JSON', query={'platform': 'samsung'},
                    headers=filter_dict({
                        'TP-AcceptFeature': 'v1/fw;v1/drm',
                        'Authorization': f'Bearer {self._access_token}' if self._access_token else None,
                    }))
            except ExtractorError as e:
                if not is_retry and isinstance(e.cause, HTTPError) and e.cause.status == 403:
                    if self._access_token:
                        self.to_screen('Access token has expired; refreshing')
                        self._refresh_access_token()
                        continue
                    elif not self._get_login_info()[0]:
                        self.raise_login_required('Login required to access this video', method='password')
                raise

    def _real_extract(self, url):
        content_id = self._match_id(url)
        data = self._download_json(
            f'https://10.com.au/api/v1/videos/{content_id}', content_id)

        video_data, urlh = self._call_playback_api(content_id)
        content_source_id = video_data['dai']['contentSourceId']
        video_id = video_data['dai']['videoId']
        auth_token = urlh.get_header('x-dai-auth')
        if not auth_token:
            raise ExtractorError('Failed to get DAI auth token')

        dai_data = self._download_json(
            f'https://pubads.g.doubleclick.net/ondemand/hls/content/{content_source_id}/vid/{video_id}/streams',
            content_id, note='Downloading DAI JSON',
            data=urlencode_postdata({'auth-token': auth_token}))

        # Ignore subs to avoid ad break cleanup