ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.88k stars 10k forks source link

Request: upload_year tag in output template #7293

Open LivInTheLookingGlass opened 8 years ago

LivInTheLookingGlass commented 8 years ago

I'm trying to folder my videos by year. It would be very useful if I could do this natively, rather than managing it from my script.

This could be fixed by copying the relevant code for the upload_date tag, and returning the first four characters.

This would result in %(upload_year)s returning year in YYYY format.

LivInTheLookingGlass commented 8 years ago

If someone can direct me to the appropriate areas/methods, I'll make a pull request for it. I can't seem to find where the template processing is done.

amper5and commented 7 years ago

rather late answer, but maybe someone will be helped.

An easy way to display just the first # of characters is by setting the precision component in the string formatting like so:

%(upload_date).#s where # would specify the number of characters to use. Since upload_date has YYYYMMDD format, use %(upload_date).4s to get just the year YYYY.

ps: Now it would be great if someone knows how to use YYMMDD format, since there are no YT videos before the year 2000. I can't figure out how to strip the first 2 characters.

DeftNerd commented 5 years ago

Honestly, %(upload_year)s, %(upload_month)s, and %(upload_day)s would all be welcome so it's easy to generate a filename like ChannelName - 2018-04-15 - Video Title.mp4 which is a standard that many media organizers expect and parse easily.

fireattack commented 5 years ago

Agreed. I'd like to use YYMMDD too.

RandomNinjaAtk commented 5 years ago

Honestly, %(upload_year)s, %(upload_month)s, and %(upload_day)s would all be welcome so it's easy to generate a filename like ChannelName - 2018-04-15 - Video Title.mp4 which is a standard that many media organizers expect and parse easily.

+1, this would be super helpful...