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.28k stars 9.94k forks source link

[Pornhub] Write categories/tags to filename #29047

Open MrDemous opened 3 years ago

MrDemous commented 3 years ago

Checklist

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

pukkandan commented 3 years ago

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']

MrDemous commented 3 years ago

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?

pukkandan commented 3 years ago

@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
MrDemous commented 3 years ago

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