Commit graph

362 commits

Author SHA1 Message Date
Nojyto
658f5ef3e1
[BUGFIX] Fix "File name too long" error when a title is used as a folder name (#1479)
Some checks failed
ytld-sub CI (Linux) / test-lint (push) Has been cancelled
ytld-sub CI (Linux) / test-unit (push) Has been cancelled
ytld-sub CI (Windows) / test-unit (push) Has been cancelled
ytld-sub CI (Windows) / test-integration (push) Has been cancelled
ytld-sub CI (Windows) / test-integration-prebuilt-presets (push) Has been cancelled
ytld-sub CI (Windows) / test-e2e (push) Has been cancelled
ytld-sub CI (Linux) / test-integration (push) Has been cancelled
ytld-sub CI (Linux) / test-integration-prebuilt-presets (push) Has been cancelled
ytld-sub CI (Linux) / test-e2e (push) Has been cancelled
ytld-sub Docker GUI Build / version (push) Has been cancelled
ytld-sub Docker GUI Build / build (3.12) (push) Has been cancelled
ytld-sub Docker Ubuntu Build / version (push) Has been cancelled
ytld-sub Docker Ubuntu Build / build (3.12) (push) Has been cancelled
ytld-sub Docker Build / version (push) Has been cancelled
ytld-sub Docker Build / build (3.12) (push) Has been cancelled
ytld-sub Release / version (push) Has been cancelled
ytld-sub CI (Linux) / codecov-upload (push) Has been cancelled
ytld-sub Docker GUI Build / package-arm64 (push) Has been cancelled
ytld-sub Docker GUI Build / package-amd64 (push) Has been cancelled
ytld-sub Docker GUI Build / deploy (push) Has been cancelled
ytld-sub Docker Ubuntu Build / package-arm64 (push) Has been cancelled
ytld-sub Docker Ubuntu Build / package-amd64 (push) Has been cancelled
ytld-sub Docker Ubuntu Build / deploy (push) Has been cancelled
ytld-sub Docker Build / package-arm64 (push) Has been cancelled
ytld-sub Docker Build / package-amd64 (push) Has been cancelled
ytld-sub Docker Build / deploy (push) Has been cancelled
ytld-sub Release / build-linux (push) Has been cancelled
ytld-sub Release / build-windows (push) Has been cancelled
ytld-sub Release / github-release (push) Has been cancelled
ytld-sub Release / pypi-publish (push) Has been cancelled
Some presets put the video title into a folder name (not just the file name). The code only shortened the file name, never the folder name. So a title with multi-byte characters (like bold/fancy Unicode, which take 4 bytes each) could make the folder name go over the OS 255-byte limit and crash with OSError: [Errno 36] File name too long.

This fix shortens every folder in the path too, not just the file name, while keeping the file extension. output_directory is left alone so real folders aren't touched.

Added a test with a title made of 4-byte bold Unicode characters.

Relates to #1092, #1189

-- Thanks @Nojyto for the contribution!
2026-06-23 09:05:10 -07:00
Jesse Bannon
b195f37412
[DEV] Disable soundcloud e2e test in CI (#1448) 2026-05-10 08:59:32 -07:00
Jesse Bannon
970c74ba45
[FEATURE] inspect subcommand (#1407)
Subscription file syntax is designed to minimize boiler-plate when authoring new subscriptions.
You can now unpack any subscription using the ``inspect`` sub-command to see its boiler-plate *preset format*.

```
ytdl-sub inspect --config /path/to/config.yaml --match "BBC News" /path/to/subscriptions.yaml
```

This can be utilized for numerous purposes including:

* Ensuring your custom preset is getting applied correctly.
* Figuring out which variables set things like file names, metadata, etc.
* Understanding how subscription syntax translates to preset representation.

The default ``--level`` of inspect will fill in defined variables. Using ``--level original`` will present the subscription's raw layout with no fill.
2026-04-13 10:10:58 -07:00
Jesse Bannon
1156e0070a
[DEV] Make inspect resolution more human readable (#1451)
Removes a lot of the boilerplate output around `concat` and `sanitize`.
2026-03-13 16:27:56 -07:00
Jesse Bannon
57fd6901e4
[DEV] Linter: Use ruff over black and isort (#1445)
Will eventually replace pylint with ruff
2026-03-09 11:39:01 -07:00
Jesse Bannon
a758a8870d
[DOCS] Overhaul configuration file getting started guide (#1172)
Updates the configuration file's docs to be cleaner. Removes sphinx autodocs entirely in favor of our custom-built one.
2026-03-09 10:18:50 -07:00
Jesse Bannon
ced547b14a
[FEATURE] Arg to shuffle subscriptions (#1263)
Closes https://github.com/jmbannon/ytdl-sub/issues/1234

Adds `--shuffle` support which shuffles the order of subscriptions when downloading.
2026-02-02 10:23:08 -08:00
Jesse Bannon
c163f9766a
[BACKEND] Configurable resolution level when validating variables (#1415)
Expands variable validation to also include support for partial resolution.

In short, this will partially execute script code until it hits unresolved runtime variables, and store that as the new script representation. This functionality will allow for the upcoming `inspect` command, which will show users their script code in action without having to dry-run.
2026-02-02 09:50:52 -08:00
Jesse Bannon
d6eda27371
[BACKEND] Less string casting behind the scenes (#1425)
Simplifies internal scripts by not casting things to String when unnecessary.
2026-01-27 10:15:32 -08:00
Jesse Bannon
a097c6a476
[BACKEND][v2] More flexible formatter post_process (#1424)
Makes the underlying formatting process better handle native (non-string) types in a more flexible way. 2nd attempt since the last one got reverted due to breaking changes.
2026-01-25 22:35:51 -08:00
Jesse Bannon
97ecae79db
[DEV] More tests around passed-in ytdl-options (#1423) 2026-01-25 09:55:26 -08:00
Jesse Bannon
c1431c8d55
Revert "[BACKEND] More flexible formatter post_process (#1421)" (#1422)
This reverts commit 60cdbad8c7.

Caused a breaking change to ytdl_options
2026-01-24 00:22:18 -08:00
Jesse Bannon
60cdbad8c7
[BACKEND] More flexible formatter post_process (#1421)
Makes the underlying formatting process better handle native (non-string) types in a more flexible way.
2026-01-23 16:36:17 -08:00
Jesse Bannon
97df4dac1d
[BACKEND] Preserve dict formatter value (#1416)
Do not modify the original definition of dict validators.
2026-01-16 13:51:33 -08:00
Jesse Bannon
942c983f60
[BACKEND] Sorted video tags (#1417)
For reproducibility in tests.
2026-01-16 13:42:22 -08:00
Jesse Bannon
530d2f7666
[BACKEND] Partial resolve support for Scripts (#1410)
Adds the mechanism to partially resolve an entire script (aka every underlying variable in ytdl-sub). This will be used in the upcoming `inspect` sub-command where it will dump a subscription's raw contents at multiple levels of resolution.

Potentially useful to optimize script execution as well.
2026-01-12 17:34:34 -08:00
Jesse Bannon
41a5bf60aa
[BACKEND] Remove cast and legacy_bracket_safety usage (#1414)
Removes unused casts and calls to the legacy_bracket_safety function.
2026-01-11 15:47:50 -08:00
Jesse Bannon
6b99c31e45
[BACKEND] Simplify script quote generation (#1409)
Internal script -> string generation used triple-quotes redundantly. Try to use them less to make it more human-readable.
2026-01-06 12:58:37 -08:00
Jesse Bannon
b2056bec5d
[BACKEND] Array support for URLs (#1406)
Allows for the `download` plugin to take in a script-based array of URLs. Prebuilt presets are now greatly reduced in size by constructing urls as an array versus 100+ separate URL variables.

Eventually, we can completely remove the limit of the number of URLs in a subscription.
2025-12-31 15:24:44 -08:00
Jesse Bannon
c46de048ca
[FEATURE] %range function (#1405)
Add `%range` function, equivalent to Python's `range`.
2025-12-31 09:06:08 -08:00
Jesse Bannon
869fc0b836
[BUGFIX] Fix custom function lambda cycle detection (#1404)
Cycles detection did not take into account custom functions' variable usage. This is now fixed.
2025-12-31 08:22:26 -08:00
Jesse Bannon
7ac525f875
[BUGFIX] Fix custom function lambda variable dependency issue, part 2 (#1403)
Part two of https://github.com/jmbannon/ytdl-sub/pull/1402 which actually completes the fix.
2025-12-30 23:46:07 -08:00
Jesse Bannon
d373935fff
[BUGFIX] Fix custom function lambda variable dependency issue (#1402)
There was a bug that did not properly check variable dependency when using lambda functions. It could still work depending on order of definitions. This fix should make it work no matter the order.
2025-12-30 19:53:15 -08:00
Jesse Bannon
1abe2a44f5
[BACKEND] Refactor validation, preparation for subscription dissect (#1398)
Completely rewrite how subscription validation is performed. Optimizes it quite a bit while also adding backend support for the upcoming `dissect` sub-command, where you can resolve any subscription into its 'raw' form for easier debugging when making scripting changes.
2025-12-30 17:03:59 -08:00
Jesse Bannon
0f96d8e24e
[BACKEND] Disallow override names conflicting with plugin names (#1399)
Disallow override variable names conflicting with plugin names.

May cause backward incompatible issues from `date_range` being an old override variable name for the `Only Recent` preset. Update this variable name to `only_recent_date_range` to resolve. More info in https://ytdl-sub.readthedocs.io/en/latest/deprecation_notices.html
2025-12-26 15:30:37 -08:00
Jesse Bannon
a5ae69550e
[BACKEND] Validate write permissions on working directory and output directory (#1395)
Closes https://github.com/jmbannon/ytdl-sub/issues/1394
Should help debug user issues like https://github.com/jmbannon/ytdl-sub/issues/1148

Checks permissions on the following:
- working directory
- output directory
- cookiefile (if specified)

And will fail immediately with a verbose message.
2025-12-06 15:54:41 -08:00
Jesse Bannon
8d5d2be6a7
[FEATURE] TV Show Collection multi-url, s00 support (#1391)
Closes https://github.com/jmbannon/ytdl-sub/issues/1251, https://github.com/jmbannon/ytdl-sub/issues/1290
Required for https://github.com/jmbannon/ytdl-sub/issues/1383

Adds both s00 support and multi-url support per season, up to 11 URLs currently. This can and should be extended, but with a more principled approach instead of the current method: AI generating boiler-plate YAML 🙂 

```
   Plex TV Show Collection:
     = Music:
       "~Beyond the Guitar":
         s00_name: "Specials"
         s00_url:
           - "https://www.youtube.com/watch?v=vXzguOdulAI"
           - "https://www.youtube.com/watch?v=IGwYDvaGAz0"
         s01_name: "Videos"
         s01_url:
           - "https://www.youtube.com/c/BeyondTheGuitar"
           - "https://www.youtube.com/@BeyondTheGuitarAcademy"
         s02_name: "Covers"
         s02_url: "https://www.youtube.com/playlist?list=PLE62gWlWZk5NWVAVuf0Lm9jdv_-_KXs0W"
```
2025-11-28 10:14:18 -08:00
Jesse Bannon
19f47cd914
[BACKEND] Optimize script interpreter (#1390)
Makes scripting runtime much faster.
2025-11-27 18:43:27 -08:00
Colin Davis
63753c5649
[RFC] Add preserve_mtime config (#1382)
Closes https://github.com/jmbannon/ytdl-sub/issues/386

Adds the ability to preserve mtime via Output Options. Usage:

```
output_options:
  preserve_mtime: True
```

Thanks @e1ven for the contribution!
2025-11-17 22:42:13 -08:00
Jesse Bannon
ed55f3a3f7
[FEATURE] cli-to-sub argument to convert yt-dlp args to ytdl-sub (#1376)
Example usage:
```
$ ytdl-sub cli-to-sub -S vcodec:h264,res:480,acodec:m4a
ytdl_options:
  format_sort:
  - vcodec:h264
  - res:480
  - acodec:m4a
```
2025-11-06 21:05:18 -08:00
Jesse Bannon
f62b47888f
[FEATURE] Ability to modify webpage_url (#1356)
Closes https://github.com/jmbannon/ytdl-sub/issues/1353

Provides a way to modify webpage_url before actual entry downloads. 
Use-case: remove `#__youtubedl_smuggle` parameter in the URL
2025-10-11 17:21:13 -07:00
Jesse Bannon
45c155c039
[FEATURE] resolution_assert_ignore_titles to ignore specific low-resolution videos (#1336)
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"
```
2025-09-13 11:32:54 -07:00
Jesse Bannon
2e67a57bc9
[BACKEND] Make resolution print debug-level (#1326)
```
Resolution assert is enabled, will fail on low-quality video downloads and presume throttle. Disable using the override variable `enable_resolution_assert: False
```
Spams during the initialization phase. Ideally, we should only print this once the subscription has begun downloading. Perhaps via a `print` plugin? Either way, set this to debug log level.
2025-09-01 14:33:46 -07:00
Jesse Bannon
df8b4a1df8
[FEATURE] Override variable support for throttle protection ranges (#1315)
Adds support for setting throttle_protection range values using static override variables. `sleep_per_download_s` has additional support for entry variables since it's used per entry.

We can now experiment with scaling this value based on entry attributes, such as duration. Example:

```
throttle_protection:
  sleep_per_download_s:
    min: >-
      {
        %mul(5.5, %pow( duration, 0.4 ))
      }
    max: >-
      {
        %mul(6.5, %pow( duration, 0.6 ))
      }
```
2025-08-28 23:55:57 -07:00
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
Jesse Bannon
288f106878
[FEATURE] Resolution assert built into throttle protection (#1288)
Closes https://github.com/jmbannon/ytdl-sub/issues/1241

YouTube is upping their throttling by serving 360p videos. Most likely to give us and genAI scraping a bad time on purpose.

Resolution assertion will be enabled by default. It will:

- Require > 360 height (pixels)
- Can configure the width by setting `resolution_assert_height_gte: 1080` to require 1080p, or any desired value
- Can disable resolution assert by setting `enable_resolution_assert: False`
2025-08-19 17:42:56 -07:00
Ross Patterson
e1f81e5274
[DOCS] Add Architecture section and Quick Start (#1287)
* docs(config): Clarify preset ordering priority

Refs #1276

* docs(architecture): WIP Narrative how it works

Much of this is repetition of the reference docs and some of the changes here should
also be applied here. The goal is to repeat here the parts of the reference docs that
may hang up a user when reading "Getting Started" without sending them off to get lost
in the weeds of the reference docs.

Note that this references a `Quick Start` document which is just an empty placeholder
and is to be written in a subsequent change.

Fixes #1279

* docs(terms): Glossary redundant with architecture

Now that the introduction includes an architectural overview, that section introduces
new users to necessary concepts and associated terminology and makes the terminology
section redundant in that part of the docs.

* docs(quick): Add a rote quick start guide

This is what I came up with when I tried to write instructions requiring as little
understanding as possible. Doing so really did reinforce my impression that this just
shouldn't be done, that significant understanding is required for *any* use of ytdl-sub
and even offering a quick start may be irresponsible. I'm still on the fence, thoughts?

That said, I also think I got some good explanations out of this and a better
understanding of what the next bits of the Getting Started should be. This Quick Start
is currently redundant with other parts of the Getting Started pages. I suspect that
I'll end up repeating and/or reorganizing parts of this Quick Start into the next bits
of the Getting Started. To that end I might argue that this change is a WIP and that
merging should wait. But I could also argue that this is an incremental improvement and
can be merged before that other work. Your call.

* docs(start): Various rST/Sphinx markup issues
2025-08-19 00:38:39 -07:00
Jesse Bannon
00e9ceaf3d
[FEATURE] Filter Duration prebuilt preset (#1259)
Adds the prebuilt preset ``Filter Duration``, which can include/exclude media based on its duration.

Supports the following override variables:

* ``filter_duration_min_s``
* ``filter_duration_max_s``

Usage:

```
      Plex TV Show by Date | Filter Duration:

        = Documentaries:
          "~NOVA PBS":
            url: "https://www.youtube.com/@novapbs"
            filter_duration_min_s: 120  # Only download videos at least 2m long

        = Sports:
          "~Maple Leafs Highlights":
            url: "https://www.youtube.com/@NHL"
            filter_duration_max_s: 180  # Only get highlight videos less than 3m long
```
2025-07-04 13:41:54 -07:00
Jesse Bannon
6c180c9478
[BACKEND] Enable throttle protection by default (#1257)
To protect new users, all prebuilt preset (excluding Soundcloud and Bandcamp) will include throttle protection by default.


> How do I disable?

Set the override variable `enable_throttle_protection: False`.
This can be done on a per-subscription basis and/or in the top __preset__ section to apply to all presets:

```
__preset__:
  overrides:
    enable_throttle_protection: False
```

> What if I already use throttle protection?

Your settings will override whatever values are set in the defaults.

Closes:
- https://github.com/jmbannon/ytdl-sub/issues/1121
- https://github.com/jmbannon/ytdl-sub/issues/1186
2025-07-03 00:34:37 -07:00
Jesse Bannon
fc2da4d525
[FEATURE] square_thumbnail plugin (#1244)
Adds the ability to make thumbnails square, both file and embedded. Usage:

```
my_preset:
  square_thumbnail: True
```

Will soon enable this by default for all music-based presets with a toggle to disable.
Huge thanks to @Kentaro1043 for crafting the ffmpeg command for this!

Closes https://github.com/jmbannon/ytdl-sub/issues/383
2025-06-18 22:37:06 -07:00
Jesse Bannon
a68d5e4539
[FEATURE] Emby prebuilt presets (#1232)
Gives Emby first class support by creating prebuilt presets for each variant, including
- `Emby TV Show by Date`
- `Emby TV Show Collection`
- `Emby Music Videos`

Emby is identical to Jellyfin except in TV Show Collection, where it requires a `season.nfo`. A new plugin `StaticNfoTags` has been created to create those.

Huge thanks to @Kamaroth92 for the initial code for this feature!
2025-06-01 09:56:48 -07:00
Jesse Bannon
0bd97dbe96
[FEATURE] release_date support for date_range (#1231)
Adds the ability to toggle whether to use `upload_date` or `release_date` in the date_range plugin, which is used to cull older videos.

```
date_range:
  type: "upload_date"
```

If using the Only Recent preset, it will be automatically applied based on whether your season/episode ordering uses release date or upload date.

Closes https://github.com/jmbannon/ytdl-sub/issues/1182
2025-06-01 09:28:42 -07:00
Jesse Bannon
66fd7cf41c
[FEATURE] Add scripting print functions (#1230)
Add the ability to print custom messages in override scripts. Adds the functions
- `print`
- `print_if_true`
- `print_if_false`

Will be used to make under-the-hood preset things more verbose.
2025-05-31 12:15:57 -07:00
Jesse Bannon
36e23839f3
[FEATURE] Ability to change season and episode ordering via variables, support for release_date (#1220)
Adds the ability to change season and episode ordering using override variables, like so:

```
       "~Kids Toys Play":
          url: "https://www.youtube.com/@KidsToysPlayChannel"
          tv_show_by_date_season_ordering: "upload-year-month"
          tv_show_by_date_episode_ordering: "upload-day"
```

In addition, adds support for release-date based episode ordering (and culling if using Only Recent).
More info here: https://ytdl-sub.readthedocs.io/en/latest/prebuilt_presets/tv_shows.html

Closes https://github.com/jmbannon/ytdl-sub/issues/1182
2025-05-31 10:26:42 -07:00
Jesse Bannon
bc15fe09bd
[FEATURE] Throttle protection per request (#1229)
Allows adding a sleep inbetween every request during metadata scrape.

```
throttle_protection:
  sleep_per_request_s:
    min: 4
    max: 6
```

Closes https://github.com/jmbannon/ytdl-sub/issues/1222
2025-05-31 09:41:14 -07:00
Jesse Bannon
987b1cd028
[FEATURE] Ability to customize date used for deleting old files (#1221)
Implements https://github.com/jmbannon/ytdl-sub/issues/1182

Adds the ability to change the `keep_files_date_eval` (traditionally upload_date_standardized) to any date, so long as its in the form of YYYY-MM-DD.

Will be able to use this to have episodes get deleted based on their release_date or epoch_date, instead of their upload_date.
2025-05-31 08:52:15 -07:00
Jesse Bannon
a4293398b7
[FEATURE] Add join and strip string functions to scripting (#1218) 2025-05-04 18:19:32 -07:00
Jesse Bannon
d5e8157b6c
[FEATURE] Add ability to suppress colors via CLI arg (#1215)
Not all terminals/logs displayed colors correctly. Adds the ability to suppress any color via `--suppress-colors` cli arg.
Thanks @drewski3420 for the contribution 🎉
2025-05-03 19:56:46 -07:00
Jesse Bannon
0c0f05e4d0
[DEV] Get windows testing in better state (#1214) 2025-05-03 19:40:28 -07:00
Jesse Bannon
19d28e9baa
[FEATURE] Throw more actionable error if users supply the wrong type of url for TV show presets (#1210)
Don't let users supply `url` for TV Show Collection presets, or `s01_url` for TV Show by Date presets.
2025-04-17 22:14:37 -07:00