Let’s say hypothetically I open yt-dlp in the terminal.
Let’s say hypothetically I launch freetube at the same time.
Let’s say hypothetically I search for an old rock song in Freetube, find it, right click, “get youtube links” and paste it into yt-dlp and get the song…
Question: who adds that bracketed data and what does it mean? I edit it out before I throw it in my playlist but what is it?
The data in the brackets is the ID for the YouTube video, it can be found at the end of the video URL. On the music thread for example if you hover over the video text it will show the ID in the URL at the bottom left of the browser.
It may be added so you can find the Video later by searching for it’s ID.
Not sure what you mean by who adds it, I think YT-DLP adds it as default as far as I’m aware.
I had a quick look and apparently it is used to keep the file name unique as multiple videos could have the same name.
Just FYI, the -o flag in yt-dlp can get rid of that junk and rename the file to your liking. For example, yt-dlp -o ‘%(artist)s-%(title)s.%(ext)s’ “<youtube url>will strip out the youtube ID and save the file with just the artist’s name, hyphen, and song title + ext.
I use a fancier version of this from reddit for dl’ing albums (only ones in the public domain, obviously!): yt-dlp -o ‘%(playlist_index)02d - %(title)s.%(ext)s’ “<playlist url>”. It numbers the tracks correctly and gives the title of each. I find it works well, despite occasional glitches. I just alias yt-dlp -o ‘%(playlist_index)02d - %(title)s.%(ext)s’ to “yt-album” and then use yt-album “<playlist url>"when I want to grab something. You can obviously customize all this in various ways. The man page has the full list of fields, etc.
As far as I know yt-dlp only adds it to keep the name of the video unique. Or maybe so people can find the video again if they didn’t save it through YouTube or Freetube.
The name can be modified and changed by manually setting what the name should be via yt-dlp options. I don’t personally know how to do it as I haven’t tried (I mostly download videos and delete them after) but @drhoopoe has added some information on this.
I noticed it was missing quote at the end too. Anyway, I replaced the parentheses with double quotes, and it downloaded. The resulting file name is, ‘%artists-%titles.%exts’.webm. I guess it will take some tweaking. Another interesting thing is the terminal prompt did not come back. It had a blank cursor like it still working on something although it closed when I clicked the x. It did not ask me if I wanted to close the terminal like it sometimes does when it is still working. Not sure what state it was in.
Don’t just experiment wildly—the parenthess are used. Bash just complained because the opening/closing quotes were typographic quotes (‘…’), not straight apostrophes ('…'). So bash didn’t see it as quoted, suddenly saw the command to open a subshell (artist) and promptly diagnosed a syntax error.
The quoting issue often happens because forum software (or your Mac!) “cleverly” decides it should replace straight quotes and apostrophes with typographical ones. Just remember that for shell commands in almost all cases the simple straight apostrophe ' and quotes " are the correct ones to use.
So @drhoopoe’s command above would actually become: