Closes https://github.com/jmbannon/ytdl-sub/issues/1313 Adds `resolution_assert_ignore_titles` variable to be able to ignore specific videos in a subscription where 360p is suspected to be the only option. Ideally, it would be nice if ytdl-sub could determine whether 360p is actually the only resolution or not automatically, and download if it's true. We need to do more research to determine if this is possible. In the meantime, the above variable should help manually get around this. Usage: ``` # use tilda mode to set override variables to the subscription "~My Subscription": url: "https://youtube.com/@channel" resolution_assert_ignore_titles: - "This 360p Video Title" ```
84 lines
3 KiB
YAML
84 lines
3 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,
|
|
-1
|
|
)
|
|
}
|
|
# list variable that contains partial titles to ignore
|
|
resolution_assert_ignore_titles: "{ [] }"
|
|
resolution_assert_is_ignored: >-
|
|
{
|
|
%print_if_true(
|
|
%concat(title, " has a match in resolution_assert_ignore_titles, skipping resolution assert."),
|
|
%contains_any(title, resolution_assert_ignore_titles)
|
|
)
|
|
}
|
|
|
|
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 ),
|
|
%not(resolution_assert_is_ignored)
|
|
),
|
|
%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"
|
|
)
|
|
}
|