Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let youtube-dl handle filename (as option) #395

Closed
kattjevfel opened this issue Aug 24, 2019 · 5 comments
Closed

Let youtube-dl handle filename (as option) #395

kattjevfel opened this issue Aug 24, 2019 · 5 comments

Comments

@kattjevfel
Copy link
Contributor

When downloading videos from twitter via gallery-dl, it will get the same type of filename as images, as in: X08zuH9Yrxnh5I1Z.mp4 instead of Foxes - https -_t.co_hcu0b37uzZ-1165001339098804224.mp4, assuming one has set "{filename}.{extension}" for filename.
This is useful for pictures (to me at least), but not for videos. (as the filename videos is quite.. useless.)

So I'm requesting there to be an option to leave all naming of files to youtube-dl, maybe setting downloader.ytdl.naming to true or something along those lines.

@wankio
Copy link
Contributor

wankio commented Aug 24, 2019

using gallery-dl -K [twitter video links] too see if there have any pattern for that

@kattjevfel
Copy link
Contributor Author

I'm not sure I understand what you mean? I want the full URL to simply be passed along to youtube-dl, having it deal with it as it normally does. The example above was what youtube-dl names it as.

What I've been doing to work around this is using the -g option and cutting off the ytdl: prefix and just made youtube-dl read through a list.

#!/bin/sh
list=$("mktemp")
gallery-dl -g "$1" | grep ytdl | sed 's/ytdl://' > "$list"
youtube-dl --ignore-errors --batch-file "$list"
rm "$list"

@mikf
Copy link
Owner

mikf commented Aug 24, 2019

I think he means you might be able to get gallery-dl itself (with its filename option) to create the same, or at least similar, filenames compared to what youtube-dl does. The only thing missing is the t.co/... URL but otherwise you could use "{username} - {URL}-{tweet_id}.{extension}" and you'd get the same filename as with youtube-dl.

Edit: btw you can use --filter "not extension" to ignore images and only see videos, at least for Twitter.

@mikf
Copy link
Owner

mikf commented Aug 24, 2019

Added an downloader.ytdl.outtmpl option that let's you specify an youtube-dl output template string for filenames, or "default" for whatever the current default is. I don't think that I've tested this enough, so there might still some issues here and there. A known one is with skip=enumerate, but there is nothing that can be done about that.

outtmpl is the internal name youtube-dl uses for its output template. Seemed fitting and better than naming, but I'm always open for suggestions when it comes to naming things.

@kattjevfel
Copy link
Contributor Author

Outstanding, I really didn't expect such fast action on my silly issue, but this works perfectly!
Tried it out with a really complicated filename and it's all working fine.

 » gallery-dl https://twitter.com/gijumo_teto/status/1159308119324803074
/mnt/jupiter/gallery-dl/twitter/gijumo_teto/ギジュテト🐵 - 家から出たくなくなる動画👀🦊 もう帰ってきてお家でお昼ご飯-1159308119324803074.mp4

...


twitter/gijumo_teto » youtube-dl https://twitter.com/gijumo_teto/status/1159308119324803074
[twitter] 1159308119324803074: Downloading webpage
[twitter:card] 1159308119324803074: Downloading webpage
[twitter:card] 1159308119324803074: Downloading guest token
[twitter:card] 1159308119324803074: Downloading JSON metadata
[twitter:card] 1159308119324803074: Downloading m3u8 information
[download] ギジュテト🐵 - 家から出たくなくなる動画👀🦊 もう帰ってきてお家でお昼ご飯-1159308119324803074.mp4 has already been downloaded

@mikf mikf added the ytdl label Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants