Repository: yt-dlp
Issue: Instagram Story HTTP Error 429: Too Many Requests
Labels: site-bug

### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting that yt-dlp is broken on a **supported** site
- [X] I've verified that I'm running yt-dlp version **2023.09.24** ([update instructions](https://github.com/yt-dlp/yt-dlp#update)) or later (specify commit)
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [ ] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required

### Region

United Kingdom

### Provide a description that is worded well enough to be understood

I was trying to download an Instagram story, and this error popped up:
`ERROR: [instagram:story] 3203351128836553205: Unable to download webpage: HTTP Error 429: Too Many Requests (caused by <HTTPError 429: Too Many Requests>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U`

Normal Instagram posts download fine, but I think this error is specifically for Instagram stories. I haven't seen this reported yet, plus the error said to please report the issue. Thank you!

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [ ] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['https://www.instagram.com/stories/milk.chae__/3203351128836553205/', '--verbose']
[debug] User config "/Users/x/.config/yt-dlp/config": ['-P', '~/Downloads', '-o', '%(title)s.%(ext)s', '-f', 'bv*+ba/b', '--merge-output-format', 'mp4', '--alias', '--insta', '-o "Instagram %(title)s %(upload_date)s %(id)s.%(ext)s"', '--live-from-start', '--write-subs', '--sub-langs', 'en']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.09.24 [088add956] (pip)
[debug] Python 3.8.12 (CPython x86_64 64bit) - macOS-10.16-x86_64-i386-64bit (OpenSSL 1.1.1l  24 Aug 2021)
[debug] exe versions: ffmpeg 5.1.2 (setts), ffprobe 5.1.2
[debug] Optional libraries: Cryptodome-3.14.1, brotli-1.0.9, certifi-2022.12.07, mutagen-1.45.1, sqlite3-3.37.0, websockets-10.2
[debug] Proxy map: {}
[debug] Loaded 1886 extractors
[instagram:story] Extracting URL: https://www.instagram.com/stories/milk.chae__/3203351128836553205/
[instagram:story] 3203351128836553205: Downloading webpage
ERROR: [instagram:story] 3203351128836553205: Unable to download webpage: HTTP Error 429: Too Many Requests (caused by <HTTPError 429: Too Many Requests>); please report this issue on  https://github.com/yt-dlp/yt-dlp/issues?q= , filling out the appropriate issue template. Confirm you are on the latest version using  yt-dlp -U
  File "/Users/x/opt/miniconda3/lib/python3.8/site-packages/yt_dlp/extractor/common.py", line 715, in extract
    ie_result = self._real_extract(url)
  File "/Users/x/opt/miniconda3/lib/python3.8/site-packages/yt_dlp/extractor/instagram.py", line 702, in _real_extract
    story_info = self._download_webpage(url, story_id)
  File "/Users/x/opt/miniconda3/lib/python3.8/site-packages/yt_dlp/extractor/common.py", line 1118, in _download_webpage
    return self.__download_webpage(url_or_request, video_id, note, errnote, None, fatal, *args, **kwargs)
  File "/Users/x/opt/miniconda3/lib/python3.8/site-packages/yt_dlp/extractor/common.py", line 1069, in download_content
    res = getattr(self, download_handle.__name__)(url_or_request, video_id, **kwargs)
  File "/Users/x/opt/miniconda3/lib/python3.8/site-packages/yt_dlp/extractor/common.py", line 903, in _download_webpage_handle
    urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal, data=data, headers=headers, query=query, expected_status=expected_status)
  File "/Users/x/opt/miniconda3/lib/python3.8/site-packages/yt_dlp/extractor/common.py", line 860, in _request_webpage
    raise ExtractorError(errmsg, cause=err)

  File "/Users/x/opt/miniconda3/lib/python3.8/site-packages/yt_dlp/networking/_urllib.py", line 410, in _send
    res = opener.open(urllib_req, timeout=float(request.extensions.get('timeout') or self.timeout))
  File "/Users/x/opt/miniconda3/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/Users/x/opt/miniconda3/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/Users/x/opt/miniconda3/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/Users/x/opt/miniconda3/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/Users/x/opt/miniconda3/lib/python3.8/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 429: Too Many Requests

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/x/opt/miniconda3/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 4051, in urlopen
    return self._request_director.send(req)
  File "/Users/x/opt/miniconda3/lib/python3.8/site-packages/yt_dlp/networking/common.py", line 114, in send
    response = handler.send(request)
  File "/Users/x/opt/miniconda3/lib/python3.8/site-packages/yt_dlp/networking/_helper.py", line 204, in wrapper
    return func(self, *args, **kwargs)
  File "/Users/x/opt/miniconda3/lib/python3.8/site-packages/yt_dlp/networking/common.py", line 325, in send
    return self._send(request)
  File "/Users/x/opt/miniconda3/lib/python3.8/site-packages/yt_dlp/networking/_urllib.py", line 415, in _send
    raise HTTPError(UrllibResponseAdapter(e.fp), redirect_loop='redirect error' in str(e)) from e
yt_dlp.networking.exceptions.HTTPError: HTTP Error 429: Too Many Requests

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/x/opt/miniconda3/lib/python3.8/site-packages/yt_dlp/extractor/common.py", line 847, in _request_webpage
    return self._downloader.urlopen(self._create_request(url_or_request, data, headers, query))
  File "/Users/x/opt/miniconda3/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 4070, in urlopen
    raise _CompatHTTPError(e) from e
yt_dlp.networking.exceptions._CompatHTTPError: HTTP Error 429: Too Many Requests
```