-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
How can I export the downloaded file name to a txt file? #27192
Comments
You can use the flags youtube-dl --simulate --get-title "https://www.youtube.com/watch?v=YOUTUBE" In Linux shells, you can redirect the youtube-dl --simulate --get-title "https://www.youtube.com/watch?v=YOUTUBE" > output.txt If this solved your problem, be sure to close the issue, so it doesn't waste the developers' time. |
Title is not the same as "downloaded filename". So, trying to do it based on the title is not going to work. What I do is to run the youtube-dl run with "script" - that gets you all the terminal chatter into a file. Then you grep that file for the word "Destination" and do the appropriate parsing on that line. |
Ahh, I see. I read "How can I export [download] the file name to a txt file" instead. Sorry! |
Who knows? You could be right. Obviously, neither of us actually knows what OP wants. I took it as: I've just done something like: youtube-dl "ytsearch: some string to search for" and I got a file downloaded. I want to know the name of that file. The point is that the actual filename (assuming no -o option given) is based on the title, but has a bunch of other stuff in it - including the extension (e.g., .mp4). So, just knowing the title isn't enough to know the full filename. I think you've got to either parse the output of the youtube-dl run (as I indicated above) or you have to query the filesystem for files created "recently" (like in the last few minutes). This later method is, of course, a heuristic (read: some guess work involved). Note also that I'm guessing that the real point in wanting to know the filename is to then feed that filename into a player (e.g., VLC). Of course, what this all shows is that the easiest way to do it is to use the "-o" option to hard-code the filename. But of course, that might not be what OP wants at all. |
thanks you every one |
If you want to download AND log the file name, use If you want to get the filename without downloading the video, use |
i think you got enough answers here(how to get title, filename, final filename). |
No description provided.
The text was updated successfully, but these errors were encountered: