Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail a task on 429 errors #849

Open
tcely opened this issue Mar 15, 2025 · 0 comments · May be fixed by #852
Open

Fail a task on 429 errors #849

tcely opened this issue Mar 15, 2025 · 0 comments · May be fixed by #852

Comments

@tcely
Copy link
Contributor

tcely commented Mar 15, 2025

From class YoutubeIE(YoutubeBaseInfoExtractor):

https://github.com/yt-dlp/yt-dlp/blob/e67d786c7cc87bd449d22e0ddef08306891c1173/yt_dlp/extractor/youtube/_video.py#L3381-L3397

    def _download_player_responses(self, url, smuggled_data, video_id, webpage_url):
        webpage = None
        if 'webpage' not in self._configuration_arg('player_skip'):
            query = {'bpctr': '9999999999', 'has_verified': '1'}
            pp = self._configuration_arg('player_params', [None], casesense=True)[0]
            if pp:
                query['pp'] = pp
            webpage = self._download_webpage_with_retries(webpage_url, video_id, query=query)


        master_ytcfg = self.extract_ytcfg(video_id, webpage) or self._get_default_ytcfg()


        player_responses, player_url = self._extract_player_responses(
            self._get_requested_clients(url, smuggled_data),
            video_id, webpage, master_ytcfg, smuggled_data)


        return webpage, master_ytcfg, player_responses, player_url

The following call needs to be patched with additional arguments to not retry HTTP error 429.

https://github.com/yt-dlp/yt-dlp/blob/e67d786c7cc87bd449d22e0ddef08306891c1173/yt_dlp/extractor/youtube/_video.py#L3388

webpage = self._download_webpage_with_retries(webpage_url, video_id, query=query)

https://github.com/yt-dlp/yt-dlp/blob/e67d786c7cc87bd449d22e0ddef08306891c1173/yt_dlp/extractor/youtube/_base.py#L751-L762

    def _download_webpage_with_retries(self, *args, retry_fatal=False, retry_on_status=None, **kwargs):
        for retry in self.RetryManager(fatal=retry_fatal):
            try:
                return self._download_webpage(*args, **kwargs)
            except ExtractorError as e:
                if isinstance(e.cause, network_exceptions):
                    if not isinstance(e.cause, HTTPError) or e.cause.status not in (retry_on_status or (403, 429)):
                        retry.error = e
                        continue
                self._error_or_warning(e, fatal=retry_fatal)
                break
            webpage = self._download_webpage_with_retries(webpage_url, video_id, retry_fatal=True, query=query)
@github-project-automation github-project-automation bot moved this to Untriaged in Status Mar 15, 2025
@tcely tcely moved this from Untriaged to Todo in Status Mar 15, 2025
@tcely tcely moved this from Todo to In Progress in Status Mar 16, 2025
@tcely tcely linked a pull request Mar 16, 2025 that will close this issue
@tcely tcely moved this from In Progress to Ready in Status Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready
Development

Successfully merging a pull request may close this issue.

1 participant