Repository: yt-dlp
Issue: Add option for network retries during extraction (for connectivity/DNS issues)
Labels: enhancement,core:networking,core:extractor

### 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 a bug unrelated to a specific site
- [X] I've verified that I'm running yt-dlp version **2023.03.04** ([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)

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

I'm attempting to download dozens of thousands of clips from a Twitch channel, but the sheer volume of small video requests per minute occasionally causes my internet to go down until I cycle the router. Every time this happens and I lose connectivity, I am inundated with hundreds of 11001 errors as a result of the temporary outage, and have to start the whole thing over again when my connection is restored to make sure I don't miss any downloads.

I'd like to have yt-dlp simply retry/wait for the connection to be restored when this happens instead of immediately failing the request and moving onto the next one. I'm already trying to use `--retries infinite`, `--retry-sleep`, and `--socket-timeout` to try to accomplish the behaviour I'm looking for, but none of these seem to be behaving in this scenario the way I would expect.

(I am not sure if this behaviour is by design to accommodate for various reasons that a 11001 error could occur and therefore should be a feature request, but as it seems unexpected to me I'm filing as a bug report.)

This is an example of the error message I get per video when an outage happens (don't have a more verbose example of this):

```
[download] Downloading item 59244 of 59250
[twitch:clips] Extracting URL: https://clips.twitch.tv/CredulousKawaiiLampRlyTho--_Rqz1YWdolNtcmI
[twitch:clips] CredulousKawaiiLampRlyTho--_Rqz1YWdolNtcmI: Downloading clip access token GraphQL
ERROR: [twitch:clips] CredulousKawaiiLampRlyTho--_Rqz1YWdolNtcmI: Unable to download JSON metadata: <urlopen error [Errno 11001] getaddrinfo failed> (caused by URLError(gaierror(11001, 'getaddrinfo failed')))
  File "yt_dlp\extractor\common.py", line 694, in extract
  File "yt_dlp\extractor\twitch.py", line 1113, in _real_extract
  File "yt_dlp\extractor\twitch.py", line 158, in _download_gql
  File "yt_dlp\extractor\twitch.py", line 145, in _download_base_gql
  File "yt_dlp\extractor\common.py", line 1048, in download_content
  File "yt_dlp\extractor\common.py", line 1012, in download_handle
  File "yt_dlp\extractor\common.py", line 882, in _download_webpage_handle
  File "yt_dlp\extractor\common.py", line 839, in _request_webpage

  File "urllib\request.py", line 1354, in do_open
  File "http\client.py", line 1252, in request
  File "http\client.py", line 1298, in _send_request
  File "http\client.py", line 1247, in endheaders
  File "http\client.py", line 1007, in _send_output
  File "http\client.py", line 947, in send
  File "http\client.py", line 1414, in connect
  File "http\client.py", line 918, in connect
  File "socket.py", line 787, in create_connection
  File "socket.py", line 918, in getaddrinfo
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "yt_dlp\extractor\common.py", line 821, in _request_webpage
  File "yt_dlp\YoutubeDL.py", line 3742, in urlopen
  File "urllib\request.py", line 525, in open
  File "urllib\request.py", line 542, in _open
  File "urllib\request.py", line 502, in _call_chain
  File "yt_dlp\utils.py", line 1555, in https_open
  File "urllib\request.py", line 1357, in do_open
urllib.error.URLError: <urlopen error [Errno 11001] getaddrinfo failed>
```

Verbose output of the command I'm running:

### 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: ['-vU', 'https://www.twitch.tv/watchmeforever/clips?range=all', '--datebefore', '20230301', '--retries', 'infinite', '--retry-sleep', 'exp=1:3600', '--socket-timeout', '3600']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.03.04 [392389b7d] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19044-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 5.1.2-full_build-www.gyan.dev (setts), ffprobe 5.1.2-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1786 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Available version: stable@2023.03.04, Current version: stable@2023.03.04
Current Build Hash: 5590c57bd0433ed239a2deaaf92e2ad6f37fe50f53664c821575cafe106a9421
yt-dlp is up to date (stable@2023.03.04)
[TwitchVideosClips] Extracting URL: https://www.twitch.tv/watchmeforever/clips?range=all
[download] Downloading playlist: watchmeforever - Clips Top All
```