ytdl-sub/src/ytdl_sub/prebuilt_presets/helpers/throttle_protection.yaml
Ross Patterson f88b27ffec
[DOCS] Various clarifications (#1289)
* docs(preset): Config file top presets vs base

* docs(throttle): resolution/quality throttle asset

I also added the "wait a few hours and try again" hint, sorry I didn't think of this
when reviewing your PR. While doing that I also reformatted the `%concat(...)` arguments
to be more readable to me. Particularly to keep clear what punctuation is about argument
separation as opposed to punctuation meant to be included in the resulting string. Not a
strong preference if you don't like it.

* docs(various): Minor typo and formatting fixes

* docs(preset): Fix presets vs preset in config file

From [feedback](https://github.com/jmbannon/ytdl-sub/pull/1289#discussion_r2289960678).

* test(throttle): Match modified assertion text

If it were my test, I'd only make assertions on the spirit of error message text
necessary to confirm it's the right error message and not another.

* docs(throttle): More likely override value

From [feedback](https://github.com/jmbannon/ytdl-sub/pull/1289#discussion_r2289976156).
2025-08-22 07:17:32 -07:00

72 lines
2.6 KiB
YAML

presets:
_throttle_protection:
throttle_protection:
enable: >-
{
%print(
%if(
enable_throttle_protection,
"Throttle protection is enabled. Disable using the override variable `enable_throttle_protection: False`",
"Throttle protection is disabled. Use at your own risk!"
),
enable_throttle_protection
)
}
sleep_per_request_s:
# yt-dlp processes eath request synchronously, so it's intrinsic delay between
# requests already represent a maximum close to real app/client behavior in the
# field. Add a small additional margin matching the example values from yt-dlp
# to be conservative:
max: 0.75
# Not used at time of writing, but choose a value that would mimic real
# app/client behavior in the field. The next request is usually sent right away
# if processing the previous request is done asynchronously:
min: 0.0
sleep_per_download_s:
min: 13.8
max: 28.4
sleep_per_subscription_s:
min: 16.3
max: 26.1
overrides:
enable_throttle_protection: True
##### Resolution Assert
enable_resolution_assert: True
resolution_assert_height_gte: 361
resolution_assert_print: >-
{
%print(
%if(
enable_resolution_assert,
"Resolution assert is enabled, will fail on low-quality video downloads and presume throttle. Disable using the override variable `enable_resolution_assert: False`",
"Resolution assert is disabled. Use at your own risk!"
),
enable_resolution_assert
)
}
resolution_readable: "{width}x{height}"
# height is not a guaranteed populated variable, do not assert if it's missing (which defaults to 0)
resolution_assert: >-
{
%if(
%and(
enable_resolution_assert,
%ne( height, 0 )
),
%assert(
%gte( height, resolution_assert_height_gte ),
%concat(
"Entry ",
title,
" downloaded at a low resolution (",
resolution_readable,
"), you've probably been throttled. ",
"Stopping further downloads, wait a few hours and try again. ",
"Disable using the override variable `enable_resolution_assert: False`."
)
),
"false is no-op"
)
}