Write categories/tags to filename #23719

Open
opened 2026-02-21 12:56:21 -05:00 by deekerman · 4 comments
Owner

Originally created by @MrDemous on GitHub (May 15, 2021).

Checklist

  • [x ] I'm reporting a site feature request
  • [x ] I've verified that I'm running youtube-dl version 2021.04.26
  • [x ] I've searched the bugtracker for similar site feature requests including closed ones

Description

Is it possible to make youtube-dl add a video's categories/tags to filename? With an argument like category or tag

For example a syntax like this for this video (NSFW obviously) Example video

%(uploader)s - %(title)s - %(category)s.%(ext)s

Would result in a filename like this

paXionfruit - Red Lipstick Close Up BlowJob. - PaxionFruit - Amateur, Big Dick, Blowjob, Brunette, Cumshot, HD Porn, Teen (18+), Verified Amateurs, Verified Couples.mp4

Originally created by @MrDemous on GitHub (May 15, 2021). ## Checklist - [x ] I'm reporting a site feature request - [x ] I've verified that I'm running youtube-dl version **2021.04.26** - [x ] I've searched the bugtracker for similar site feature requests including closed ones ## Description Is it possible to make youtube-dl add a video's categories/tags to filename? With an argument like `category` or `tag` For example a syntax like this for this video (NSFW obviously) [Example video](https://www.pornhub.com/view_video.php?viewkey=ph5fc3d626b12d2) `%(uploader)s - %(title)s - %(category)s.%(ext)s` Would result in a filename like this `paXionfruit - Red Lipstick Close Up BlowJob. - PaxionFruit - Amateur, Big Dick, Blowjob, Brunette, Cumshot, HD Porn, Teen (18+), Verified Amateurs, Verified Couples.mp4`
Author
Owner

@pukkandan commented on GitHub (May 18, 2021):

There is actually no need to tag this as pornhub (and thus nsfw). Many other extractors including youtube also provides categories information. For example, https://www.youtube.com/watch?v=5Od1VaDL090 has 'categories': ['Education']

@pukkandan commented on GitHub (May 18, 2021): There is actually no need to tag this as pornhub (and thus `nsfw`). Many other extractors including `youtube` also provides `categories` information. For example, `https://www.youtube.com/watch?v=5Od1VaDL090` has `'categories': ['Education']`
Author
Owner

@MrDemous commented on GitHub (May 19, 2021):

I didn't know that, I only tagged it as Pornhub because it was the extractor I was trying to do this on. So is this something that can be added in the future?

@MrDemous commented on GitHub (May 19, 2021): I didn't know that, I only tagged it as Pornhub because it was the extractor I was trying to do this on. So is this something that can be added in the future?
Author
Owner

@pukkandan commented on GitHub (May 20, 2021):

@MrDemous I am not a maintainer of youtube-dl. So I can't say if this will ever be implemented. But, you should get what you want if you just remove and not isinstance(v, (list, tuple, dict)) from github.com/ytdl-org/youtube-dl@dfbbe2902f/youtube_dl/YoutubeDL.py (L661)

$ youtube-dl --get-filename 5Od1VaDL090 -o "%(title)s %(categories)s.%(ext)s"
Разбираю и объясняю пример хорошего и плохого кода ['Education'].webm
@pukkandan commented on GitHub (May 20, 2021): @MrDemous I am not a maintainer of youtube-dl. So I can't say if this will ever be implemented. But, you should get what you want if you just remove ` and not isinstance(v, (list, tuple, dict))` from https://github.com/ytdl-org/youtube-dl/blob/dfbbe2902fc67f0f93ee47a8077c148055c67a9b/youtube_dl/YoutubeDL.py#L661 ``` $ youtube-dl --get-filename 5Od1VaDL090 -o "%(title)s %(categories)s.%(ext)s" Разбираю и объясняю пример хорошего и плохого кода ['Education'].webm ```
Author
Owner

@MrDemous commented on GitHub (May 20, 2021):

I have no idea how to do that but I ended up switching to your fork which has this implemented in it. Thanks for the help and your great work @pukkandan

@MrDemous commented on GitHub (May 20, 2021): I have no idea how to do that but I ended up switching to your fork which has this implemented in it. Thanks for the help and your great work @pukkandan
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#23719
No description provided.