21

youtube-dl: Free Software Application of the Week - Week of 2017-12-25

Submitted by sudo moderator in freeAsInFreedom (edited )

Update: /u/Jorgesmule has pointed out that youtube-dl can run proprietary Javascript. They recommend using avideo instead.

Last week's thread.

This week's Free Software Application of the Week is youtube-dl, a public domain application that downloads Youtube videos.

Youtube-dl is one of the kings. This is one of those programs that exists to do only one thing, and it does that thing really damn well. Downloading videos from video sharing websites is a very common need; one for which numerous applications and web applications have been developed.

But all of the other ones are shit.

Well, the ones that I've tried, anyways. The major one I'm talking about is DVDVideoSoft's heaping pile of dogshit known as Free Youtube Download. Why is it a heaping pile of dogshit? Well, it's proprietary, but that's not the only reason. It also used to display ads in the program, install unwanted toolbars and adware, and it still does bug you to upgrade to the paid version. Sadly, due to their SEO and marketing, this is the one that most people use. There are some other free online services, but these don't have that many options, and some of them recompress the video.

Youtube-dl doesn't do any of that bullshit. You give it a URL, and it downloads the video. It's as simple as that.

Of course, if you want it to do something extra, it can. For example, if you only want to download the audio, you can pass it the -x option, and it will do that. There are a lot of options like this; probably more than you'll ever need. The ones that I've found to be useful are -F, which lists all of the formats and resolutions you can download the video in; and -f, which lets you specify which format you want to download (usually -f 43 is a good choice, if the default resolution takes too long to download).

In addition, youtube-dl lets you specify a config file. This can be at /etc/youtube-dl.conf for a global config file, or ~/.config/youtube-dl/config for the user-specific one. This is just a list of options that you want applied every time you run youtube-dl. For me, I put down these two:

--proxy socks5://127.0.0.1:9150
-o %(title)s.%(ext)s

The first one routes all of youtube-dl's traffic through Tor Browser. The second one changes the way that youtube-dl writes filenames. If you give youtube-dl this URL: https://www.youtube.com/watch?v=dQw4w9WgXcQ, normally it will save the file as the title of the video, followed by a hyphen and dQw4w9WgXcQ. This second option eliminates that junk from the end of the URL, so that youtube-dl makes the filename the exact same as the title of the video. If this annoyed you before, then try this option out.

It's worth mentioning that youtube-dl works for more video sharing sites than Youtube. Some noteable ones are Vimeo, Dailymotion, and LiveLeak. It can also download from audio websites, such as Soundcloud and Bandcamp. To see every website youtube-dl can download from, run youtube-dl --list-extractors (warning: lots of them are porn websites). It also contains a generic extractor, which can sometimes download a video from a website that doesn't have a specific algorithm programmed just for it.

I think youtube-dl is even more useful than the developers originally intended, because it makes Youtube accessible to those who block javascript, whether that be for privacy reasons or because of nonfree code (or both). It would be easy to say "Just use a different video sharing website," if not for the network effect (everyone already uses Youtube, so it would be hard to move them all to another website). For this reason, youtube-dl is a godsend.

So it's really unfortunate that youtube-dl is as unknown as it currently is. Youtube-dl was created in 2006. The fact that I only learned of its existence a couple of years ago when I started getting into free software shows how little known it is. For something as useful as this, it really deserves better.

One other thing I want to mention is that updates to youtube-dl come in really quickly. Youtube is notorious for changing its UI once every few months, which can sometimes break the previous HTML parsing algorithm to download videos. Whenever this happens, the youtube-dl dev(s) usually send out an update within a week. So, props to them for being so speedy.

That's all that I have to say about it. Hopefully I've made someone's life a little bit easier by introducing them to this program. If you've already used youtube-dl before reading this, then you already know how good it is.


That's all for this week's Free Software Application of the Week. Join me again next Monday, for a review of Inkscape!

Comments

You must log in or register to comment.

6

jorgesumle wrote (edited )

youtube-dl executes proprietary JS...

Why should you use avideo instead of youtube-dl?

AVideo builds on the power of the infamous youtube-dl to ensure that the user's liberty is not sacrificed.

YouTube-DL incorporates JS, SWF, and SDK interpreters in order to deliver some functionality. However, packaging these runs contrary to delivering freedom as a number 1 priority.

It was discovered in 2017 on the Trisquel GNU/Linux fora that youtube-dl included the quite unexpected functionality to run JavaScript. Further investigation by Grace Past revealed this to be a component of DRM on YouTube, meaning the non-free code sourced from YouTube is an unethical means to an unethical end. Thus, in order to provide you with control over your computer, such a sacrifice unfortunately must be made.

Similar reasoning applies to the other cases of interpreters for non-free software packaged with the parent. If any methods of addressing these issues arise that allow them to be attacked without compromising core values, they shall be promptly implemented; however, aside from such a possible workaround, it is avideo's aim to avoid compromising user freedom.

4

cal wrote (edited )

Unfortunately, Grace Past /Soon.to.be.Free has not yet rebased avideo on the current version of youtube-dl, and it fails to download all videos thrown at it.

Could someone help rebase it, or ask Grrace about when she'll rebase it? I've already asked her and looked into what I'd have to do to do it my self, but she has not responded.

3

sudo wrote (edited )

Holy shit, thank you for bringing this to my attention. I'll put up a notice at the top of this review about this.

Edit: So, it looks like the proprietary JS is just to decode a signature that changes daily. If that really is all that it does, then it's not a problem in the way of privacy, but it is for freedom purposes. They could also slip in some little bit of fingerprinting code, and nobody would be any wiser to it.

4

lambda wrote

The very first I ever heard of youtube-dl was due to mpv, the free software video player. By default, it pulls in youtube-dl as a dependency so you can stream videos from sites straight from mpv rather than needing to download them if unnecessary (e.g., watching a video without all the BS javascript and malware).

The frequent updates are great for sites other than youtube, too. This also helps for circumventing draconian copy protection or shitty Flash players that still exist.

2

sudo wrote

Mpv can do that? I've been downloading them from Youtube this whole time. I'll have to try that out, but I don't know if my internet connection is fast enough to stream them. Do you just pass the Youtube URL right into mpv?

3

lambda wrote

Yeah, just use the full URL as an argument. I think VLC supports some video sites, too, but I'm not sure if it uses youtube-dl.

2

NEOalquimista wrote

Very nice (: I think it's worth mentioning that some distros don't push updates to youtube-dl very often. One of them is Ubuntu. So if it's not working properly for you, try to get youtube-dl from another source, such as a PPA. I use this one from webup8.org.

If anyone knows of a Snap package, Flatpak or anything else safer than PPAs, I'll be glad. Perhaps Python's "pip" is okay?