Repository: yt-dlp
Issue: Should abort download after many failed download segment
Labels: enhancement,triage,core:downloader

### 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 requesting a feature unrelated to a specific site
- [X] I've looked through the [README](https://github.com/yt-dlp/yt-dlp#readme)
- [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 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

Hello,

Can you make feature abort download after 5 or 10 segment are failed download? it is very useful and saves time. now it just keep downloads to the last segments

### 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
C:\Users\MASTERX>youtube-dl "https://b-g-ca-5.feetcdn.com:2223/v3-hls-playback/d6c811cbe5dfe523626c10287b9fa915e2ae613540cb2983ace14ca2e815b7af361f27d3f3f381f9fa7be2ea85ec0085be1bbd4090abc757557481ccba799f81b4e2041ad4d7c0527f51db956756d9f180e87671bf98b45101b61a45cb4056a7e83ce92f626e989ae3b7512bf400990b07f7fceb6e9138749f57833ead92628cdf6b69511c280f44597b621cd680e42890eb45d267416c9b3197c0640eaa3101/playlist.m3u8" -N 8 -R 3 --fragment-retries 3 -Uv
[debug] Command-line config: ['https://b-g-ca-5.feetcdn.com:2223/v3-hls-playback/d6c811cbe5dfe523626c10287b9fa915e2ae613540cb2983ace14ca2e815b7af361f27d3f3f381f9fa7be2ea85ec0085be1bbd4090abc757557481ccba799f81b4e2041ad4d7c0527f51db956756d9f180e87671bf98b45101b61a45cb4056a7e83ce92f626e989ae3b7512bf400990b07f7fceb6e9138749f57833ead92628cdf6b69511c280f44597b621cd680e42890eb45d267416c9b3197c0640eaa3101/playlist.m3u8', '-N', '8', '-R', '3', '--fragment-retries', '3', '-Uv']
[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.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg N-110072-g073ec3b9da-20230325 (setts), ffprobe N-110072-g073ec3b9da-20230325
[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)
[generic] Extracting URL: https://b-g-ca-5.feetcdn.com:2223/v3-hls-playback/d6c811cbe5dfe523626c10287b9fa915e2ae613540cb2983ace14ca2e815b7af361f27d3f3f381f9fa7be2ea85ec0085be1bbd4090abc757557481ccba799f81b4e2041ad4d7c0527f51db956756d9f180e87671bf98b45101b61a45cb4056a7e83ce92f626e989ae3b7512bf400990b07f7fceb6e9138749f57833ead92628cdf6b69511c280f44597b621cd680e42890eb45d267416c9b3197c0640eaa3101/playlist.m3u8
[generic] playlist: Downloading webpage
[debug] Identified a direct video link
[generic] playlist: Downloading m3u8 information
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] playlist: Downloading 1 format(s): 4500
[debug] Invoking hlsnative downloader on "https://b-g-ca-5.feetcdn.com:2223/v3-hls-playback/d6c811cbe5dfe523626c10287b9fa915e2ae613540cb2983ace14ca2e815b7af361f27d3f3f381f9fa7be2ea85ec0085be1bbd4090abc757557481ccba799f81b4e2041ad4d7c0527f51db956756d9f180e87671bf98b45101b61a45cb4056a7e83ce92f626e989ae3b7512bf400990b07f7fceb6e9138749f57833ead92628cdf6b69511c280f44597b621cd680e42890eb45d267416c9b3197c0640eaa3101/1080/index.m3u8"
[hlsnative] Downloading m3u8 manifest
WARNING: Live HLS streams are not supported by the native downloader. If this is a livestream, please add "--downloader ffmpeg --hls-use-mpegts" to your command
[hlsnative] Total fragments: 661
[download] Destination: playlist [playlist].mp4
[debug] File locking is not supported. Proceeding without locking
WARNING: The download speed shown is only of one thread. This is a known issue
[download] Got error: The read operation timed out. Retrying (1/3)...
[download] Got error: The read operation timed out. Retrying (1/3)...
[download] Got error: The read operation timed out. Retrying (1/3)...
[download] Got error: The read operation timed out. Retrying (1/3)...
[download] Got error: The read operation timed out. Retrying (1/3)...
[download] Got error: The read operation timed out. Retrying (1/3)...
[download] Got error: The read operation timed out. Retrying (1/3)...
[download] Got error: The read operation timed out. Retrying (1/3)...
[download] Got error: The read operation timed out. Retrying (2/3)...
[download] Got error: The read operation timed out. Retrying (2/3)...
[download] Got error: The read operation timed out. Retrying (2/3)...
[download] Got error: The read operation timed out. Retrying (2/3)...
[download] Got error: The read operation timed out. Retrying (2/3)...
[download] Got error: The read operation timed out. Retrying (2/3)...
[download] Got error: The read operation timed out. Retrying (2/3)...
[download] Got error: The read operation timed out. Retrying (2/3)...
[download] Got error: The read operation timed out. Retrying (3/3)...
[download] Got error: The read operation timed out. Retrying (3/3)...
[download] Got error: The read operation timed out. Retrying (3/3)...
[download] Got error: The read operation timed out. Retrying (3/3)...
[download] Got error: The read operation timed out. Retrying (3/3)...
[download] Got error: The read operation timed out. Retrying (3/3)...
[download] Got error: The read operation timed out. Retrying (3/3)...
[download] Got error: The read operation timed out. Retrying (3/3)...
[download] Got error: The read operation timed out. Giving up after 3 retries
  File "threading.py", line 890, in _bootstrap
  File "threading.py", line 932, in _bootstrap_inner
  File "threading.py", line 870, in run
  File "concurrent\futures\thread.py", line 80, in _worker
  File "concurrent\futures\thread.py", line 57, in run
  File "yt_dlp\downloader\fragment.py", line 497, in _download_fragment
  File "yt_dlp\downloader\fragment.py", line 469, in download_fragment
  File "yt_dlp\downloader\fragment.py", line 124, in _download_fragment
  File "yt_dlp\downloader\common.py", line 444, in download
  File "yt_dlp\downloader\http.py", line 374, in real_download
  File "yt_dlp\utils.py", line 6141, in __iter__
  File "yt_dlp\downloader\common.py", line 389, in report_retry
  File "yt_dlp\utils.py", line 6148, in report_retry
  File "yt_dlp\downloader\common.py", line 392, in <lambda>
  File "yt_dlp\YoutubeDL.py", line 1015, in report_error
  File "yt_dlp\YoutubeDL.py", line 944, in trouble

[download] Got error: The read operation timed out. Giving up after 3 retries
  File "threading.py", line 890, in _bootstrap
  File "threading.py", line 932, in _bootstrap_inner
  File "threading.py", line 870, in run
  File "concurrent\futures\thread.py", line 80, in _worker
  File "concurrent\futures\thread.py", line 57, in run
  File "yt_dlp\downloader\fragment.py", line 497, in _download_fragment
  File "yt_dlp\downloader\fragment.py", line 469, in download_fragment
  File "yt_dlp\downloader\fragment.py", line 124, in _download_fragment
  File "yt_dlp\downloader\common.py", line 444, in download
  File "yt_dlp\downloader\http.py", line 374, in real_download
  File "yt_dlp\utils.py", line 6141, in __iter__
  File "yt_dlp\downloader\common.py", line 389, in report_retry
  File "yt_dlp\utils.py", line 6148, in report_retry
  File "yt_dlp\downloader\common.py", line 392, in <lambda>
  File "yt_dlp\YoutubeDL.py", line 1015, in report_error
  File "yt_dlp\YoutubeDL.py", line 944, in trouble

[download] Got error: The read operation timed out. Giving up after 3 retries
  File "threading.py", line 890, in _bootstrap
  File "threading.py", line 932, in _bootstrap_inner
  File "threading.py", line 870, in run
  File "concurrent\futures\thread.py", line 80, in _worker
  File "concurrent\futures\thread.py", line 57, in run
  File "yt_dlp\downloader\fragment.py", line 497, in _download_fragment
  File "yt_dlp\downloader\fragment.py", line 469, in download_fragment
  File "yt_dlp\downloader\fragment.py", line 124, in _download_fragment
  File "yt_dlp\downloader\common.py", line 444, in download
  File "yt_dlp\downloader\http.py", line 374, in real_download
  File "yt_dlp\utils.py", line 6141, in __iter__
  File "yt_dlp\downloader\common.py", line 389, in report_retry
  File "yt_dlp\utils.py", line 6148, in report_retry
  File "yt_dlp\downloader\common.py", line 392, in <lambda>
  File "yt_dlp\YoutubeDL.py", line 1015, in report_error
  File "yt_dlp\YoutubeDL.py", line 944, in trouble

[download] fragment not found; Skipping fragment 1 ...
[download] Got error: The read operation timed out. Giving up after 3 retries
  File "threading.py", line 890, in _bootstrap
  File "threading.py", line 932, in _bootstrap_inner
  File "threading.py", line 870, in run
  File "concurrent\futures\thread.py", line 80, in _worker
  File "concurrent\futures\thread.py", line 57, in run
  File "yt_dlp\downloader\fragment.py", line 497, in _download_fragment
  File "yt_dlp\downloader\fragment.py", line 469, in download_fragment
  File "yt_dlp\downloader\fragment.py", line 124, in _download_fragment
  File "yt_dlp\downloader\common.py", line 444, in download
  File "yt_dlp\downloader\http.py", line 374, in real_download
  File "yt_dlp\utils.py", line 6141, in __iter__
  File "yt_dlp\downloader\common.py", line 389, in report_retry
  File "yt_dlp\utils.py", line 6148, in report_retry
  File "yt_dlp\downloader\common.py", line 392, in <lambda>
  File "yt_dlp\YoutubeDL.py", line 1015, in report_error
  File "yt_dlp\YoutubeDL.py", line 944, in trouble

[download] fragment not found; Skipping fragment 2 ...
[download] Got error: The read operation timed out. Giving up after 3 retries
  File "threading.py", line 890, in _bootstrap
  File "threading.py", line 932, in _bootstrap_inner
  File "threading.py", line 870, in run
  File "concurrent\futures\thread.py", line 80, in _worker
  File "concurrent\futures\thread.py", line 57, in run
  File "yt_dlp\downloader\fragment.py", line 497, in _download_fragment
  File "yt_dlp\downloader\fragment.py", line 469, in download_fragment
  File "yt_dlp\downloader\fragment.py", line 124, in _download_fragment
  File "yt_dlp\downloader\common.py", line 444, in download
  File "yt_dlp\downloader\http.py", line 374, in real_download
  File "yt_dlp\utils.py", line 6141, in __iter__
  File "yt_dlp\downloader\common.py", line 389, in report_retry
  File "yt_dlp\utils.py", line 6148, in report_retry
  File "yt_dlp\downloader\common.py", line 392, in <lambda>
  File "yt_dlp\YoutubeDL.py", line 1015, in report_error
  File "yt_dlp\YoutubeDL.py", line 944, in trouble

[download] fragment not found; Skipping fragment 3 ...
[download] fragment not found; Skipping fragment 4 ...
[download] Got error: The read operation timed out. Giving up after 3 retries
  File "threading.py", line 890, in _bootstrap
  File "threading.py", line 932, in _bootstrap_inner
  File "threading.py", line 870, in run
  File "concurrent\futures\thread.py", line 80, in _worker
  File "concurrent\futures\thread.py", line 57, in run
  File "yt_dlp\downloader\fragment.py", line 497, in _download_fragment
  File "yt_dlp\downloader\fragment.py", line 469, in download_fragment
  File "yt_dlp\downloader\fragment.py", line 124, in _download_fragment
  File "yt_dlp\downloader\common.py", line 444, in download
  File "yt_dlp\downloader\http.py", line 374, in real_download
  File "yt_dlp\utils.py", line 6141, in __iter__
  File "yt_dlp\downloader\common.py", line 389, in report_retry
  File "yt_dlp\utils.py", line 6148, in report_retry
  File "yt_dlp\downloader\common.py", line 392, in <lambda>
  File "yt_dlp\YoutubeDL.py", line 1015, in report_error
  File "yt_dlp\YoutubeDL.py", line 944, in trouble

[download] Got error: The read operation timed out. Giving up after 3 retries
[download] Got error: The read operation timed out. Giving up after 3 retries
  File "threading.py", line 890, in _bootstrap
  File "threading.py", line 932, in _bootstrap_inner
  File "threading.py", line 870, in run
  File "concurrent\futures\thread.py", line 80, in _worker
  File "concurrent\futures\thread.py", line 57, in run
  File "yt_dlp\downloader\fragment.py", line 497, in _download_fragment
  File "yt_dlp\downloader\fragment.py", line 469, in download_fragment
  File "yt_dlp\downloader\fragment.py", line 124, in _download_fragment
  File "yt_dlp\downloader\common.py", line 444, in download
  File "yt_dlp\downloader\http.py", line 374, in real_download
  File "yt_dlp\utils.py", line 6141, in __iter__
  File "yt_dlp\downloader\common.py", line 389, in report_retry
  File "yt_dlp\utils.py", line 6148, in report_retry
  File "yt_dlp\downloader\common.py", line 392, in <lambda>
  File "yt_dlp\YoutubeDL.py", line 1015, in report_error
  File "yt_dlp\YoutubeDL.py", line 944, in trouble

  File "threading.py", line 890, in _bootstrap
  File "threading.py", line 932, in _bootstrap_inner
  File "threading.py", line 870, in run
  File "concurrent\futures\thread.py", line 80, in _worker
  File "concurrent\futures\thread.py", line 57, in run
  File "yt_dlp\downloader\fragment.py", line 497, in _download_fragment
  File "yt_dlp\downloader\fragment.py", line 469, in download_fragment
  File "yt_dlp\downloader\fragment.py", line 124, in _download_fragment
  File "yt_dlp\downloader\common.py", line 444, in download
  File "yt_dlp\downloader\http.py", line 374, in real_download
  File "yt_dlp\utils.py", line 6141, in __iter__
  File "yt_dlp\downloader\common.py", line 389, in report_retry
  File "yt_dlp\utils.py", line 6148, in report_retry
  File "yt_dlp\downloader\common.py", line 392, in <lambda>
  File "yt_dlp\YoutubeDL.py", line 1015, in report_error
  File "yt_dlp\YoutubeDL.py", line 944, in trouble

[download] fragment not found; Skipping fragment 5 ...
[download] fragment not found; Skipping fragment 6 ...
[download] fragment not found; Skipping fragment 7 ...
[download] fragment not found; Skipping fragment 8 ...
[download] Got error: The read operation timed out. Retrying (1/3)...
[download] Got error: The read operation timed out. Retrying (1/3)...
[download] Got error: The read operation timed out. Retrying (1/3)...
[download] Got error: The read operation timed out. Retrying (1/3)...
[download] Got error: The read operation timed out. Retrying (1/3)...
[download] Got error: The read operation timed out. Retrying (1/3)...
[download] Got error: The read operation timed out. Retrying (1/3)...
[download] Got error: The read operation timed out. Retrying (1/3)...
[download] Got error: The read operation timed out. Retrying (2/3)...
[download] Got error: The read operation timed out. Retrying (2/3)...
[download] Got error: The read operation timed out. Retrying (2/3)...
[download] Got error: The read operation timed out. Retrying (2/3)...
[download] Got error: The read operation timed out. Retrying (2/3)...
[download] Got error: The read operation timed out. Retrying (2/3)...
[download] Got error: The read operation timed out. Retrying (2/3)...
[download] Got error: The read operation timed out. Retrying (2/3)...
[download] Got error: The read operation timed out. Retrying (3/3)...
[download] Got error: The read operation timed out. Retrying (3/3)...
[download] Got error: The read operation timed out. Retrying (3/3)...
[download] Got error: The read operation timed out. Retrying (3/3)...
[download] Got error: The read operation timed out. Retrying (3/3)...
[download] Got error: The read operation timed out. Retrying (3/3)...
[download] Got error: The read operation timed out. Retrying (3/3)...
[download] Got error: The read operation timed out. Retrying (3/3)...
```