More parameters for templates? #1498

Closed
opened 2026-02-20 23:30:14 -05:00 by deekerman · 3 comments
Owner

Originally created by @cyberpunkbln on GitHub (Dec 10, 2013).

Hello,

only a short issue. I have problems by downloads from southpark.de. The German Seasons 12 - 16 don't have the season and episode number and his from youtube-dl discovered pathname, so i must take the url without the named seasons.

rtmpe -cp75298.edgefcs.net_ondemand_mtviestor!_intlod_southpark_video_Deutsche_Season_12_1213_acts_sp_1213_act1_DEU_1280x720_1200.mp4

Its not pretty and a mass renamer solve some ugly names in path but it will be crazy if i can give the templates more options.

When i put all episodes in a batch-file like southpark.txt:

http://www.southpark.de/alle-episoden/s14e01/
http://www.southpark.de/alle-episoden/s14e05/
http://www.southpark.de/alle-episoden/s14e06/
http://www.southpark.de/alle-episoden/s14e13/

The Server from southpark made an rewrite of the urls and then youtube-dl use the resolved rewritten name of the path. Bit it will be great when i can use this original or resolved path in the template, like this:

%(batch-path)s => http://www.southpark.de/alle-episoden/s14e13/
%(batch-pathdir)s => /alle-episoden/s14e13/
%(batch-pathlastdir)s => s14e13

So i can use this plus the Title for prettyer naming the downloaded files:).

Only a suggestion. But it will make the southpark downloads a litte bit easier.

Thx
Greetings

Originally created by @cyberpunkbln on GitHub (Dec 10, 2013). Hello, only a short issue. I have problems by downloads from southpark.de. The German Seasons 12 - 16 don't have the season and episode number and his from youtube-dl discovered pathname, so i must take the url without the named seasons. rtmpe -_cp75298.edgefcs.net_ondemand_mtviestor_!_intlod_southpark_video_Deutsche_Season_12_1213_acts_sp_1213_act1_DEU_1280x720_1200.mp4 Its not pretty and a mass renamer solve some ugly names in path but it will be crazy if i can give the templates more options. When i put all episodes in a batch-file like southpark.txt: http://www.southpark.de/alle-episoden/s14e01/ http://www.southpark.de/alle-episoden/s14e05/ http://www.southpark.de/alle-episoden/s14e06/ http://www.southpark.de/alle-episoden/s14e13/ The Server from southpark made an rewrite of the urls and then youtube-dl use the resolved rewritten name of the path. Bit it will be great when i can use this original or resolved path in the template, like this: %(batch-path)s => http://www.southpark.de/alle-episoden/s14e13/ %(batch-pathdir)s => /alle-episoden/s14e13/ %(batch-pathlastdir)s => s14e13 So i can use this plus the Title for prettyer naming the downloaded files:). Only a suggestion. But it will make the southpark downloads a litte bit easier. Thx Greetings
Author
Owner

@jaimeMF commented on GitHub (Dec 10, 2013):

For the first field requested you can use %(webpage_url)s, for example %(webpage_url)s-%(id)s.%(ext)s downloads to http -_www.southpark.de_alle-episoden_s14e01-292ca41c-ed01-11e0-aca6-0026b9414f30.mp4 (some of the characters are replaced to avoid problems with the filesystem).
The other ones seems too complicated and specific and someone will eventually ask for other variations (like firstdir or {n}dir)

@jaimeMF commented on GitHub (Dec 10, 2013): For the first field requested you can use `%(webpage_url)s`, for example `%(webpage_url)s-%(id)s.%(ext)s` downloads to `http -_www.southpark.de_alle-episoden_s14e01-292ca41c-ed01-11e0-aca6-0026b9414f30.mp4` (some of the characters are replaced to avoid problems with the filesystem). The other ones seems too complicated and specific and someone will eventually ask for other variations (like `firstdir` or `{n}dir`)
Author
Owner

@sirinath commented on GitHub (Dec 16, 2013):

Yes. nth dir is the sensible option. You get any dir you want.

@sirinath commented on GitHub (Dec 16, 2013): Yes. nth dir is the sensible option. You get any dir you want.
Author
Owner

@phihag commented on GitHub (Dec 16, 2013):

Complicated templating like {n}dir is definitely out of scope for youtube-dl. If you really need it (and I highly doubt that), write either a shell script or embed youtube-dl. Since youtube-dl 2013.12.17.1, you can use the new webpage_url_basename field, like this:

$ youtube-dl -o '%(webpage_url_basename)s_%(title)s.%(ext)s' http://www.southpark.de/alle-episoden/s14e01/ --get-filename
s14e01_South Park Intro HD.mp4
s14e01_South Park - Sexual Healing - Act 1.mp4
s14e01_South Park - Sexual Healing - Act 2.mp4
s14e01_South Park - Sexual Healing - Act 3.mp4
@phihag commented on GitHub (Dec 16, 2013): Complicated templating like `{n}dir` is definitely out of scope for youtube-dl. If you really need it (and I highly doubt that), write either a shell script or embed youtube-dl. Since youtube-dl 2013.12.17.1, you can use the new `webpage_url_basename` field, like this: ``` $ youtube-dl -o '%(webpage_url_basename)s_%(title)s.%(ext)s' http://www.southpark.de/alle-episoden/s14e01/ --get-filename s14e01_South Park Intro HD.mp4 s14e01_South Park - Sexual Healing - Act 1.mp4 s14e01_South Park - Sexual Healing - Act 2.mp4 s14e01_South Park - Sexual Healing - Act 3.mp4 ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#1498
No description provided.