Hacker News new | past | comments | ask | show | jobs | submit login
YouTube-dl: Open-source YouTube downloader (rg3.github.io)
989 points by h43k3r on April 8, 2016 | hide | past | favorite | 321 comments



The tragedy of this software (and many like it) is that despite working exactly as advertised, easily and with a lot of features, because it's a quiet open source project without any SEO rigging it will never appear in page 1 of any searches by laymen trying to download videos ("save youtube to hard drive", "download youtube videos" et al).

The amount of crapware I've had to remove from family member's PCs just because they wanted to save a video is ridiculous.


I treat youtube-dl like Fight Club. I am glad it isn't on the top of searches since I am afraid sites would start trying to stop it from working harder.


They already do. That's why it updates pretty much every time I do a homebrew update.


I should have said. They would try harder.


I don't know what parent is talking about, this script it's already very popular. I found it years ago and it wasn't difficult to find on google. Something worth mentioning is that the script works with dozens and dozens of video sites (or just sites with regular video content). Almost any video you throw at it gets downloaded. When something breaks it's usually fixed within days. It's a great piece of work.


I hope you haven't voted this article then. Let's keep it secret ;)


Exactly!

SHHH - dont talk about ytdl...

obv if the masses start talking about things like this, then sites like YT will go on the attack. WE DO NOT WANT THIS.


My Maslow's middle layer immediately filled up when I read this. Thanks for making my Monday better.


I think most video download sites use youtube-dl on the backend so they should already be doing that.


I found this neat project that adds a GUI to YouTube-dl. It looks like an easy program for non-technical people to use.

https://github.com/MrS0m30n3/youtube-dl-gui


guycook's lament is about the findability of the project for laypeople, not about its interface. The interface is not an issue when laypeople can't find the project in the first place.


Well the reason it has a bad ranking is because it isn't accessible to lay people. People might click the link and say "how do I install pip? Whats a PATH variable?" (or even "What's a command line?") and click back to the search page. Google counts that as a vote against that site, hence the bad ranking.


I never knew this occurred, how do they do this if I open links in a new tab? Maybe if the website uses Google Analytics they might take this into account, but if they didn't have any other software from Google? I'm quite intrigued. Thanks for that post!


I think just clicking the link and then clicking a different link counts against the first link. It probably doesn't matter if you actually use the back button or not.

I don't know how they account for people clicking multiple links in new tabs. My guess is they reorder links sometimes so that users that click multiple links cancel each other out. They just try to maximize the probability you will click on a link and not come back to the search page.


Well, I guess I cause a LOT of bad rankings for sites. I tend to just open a lot of results in different tabs, then go through them one by one.


Yeah, me too. My typical pattern when doing a search is to quickly middle-click the first three or four promising-looking results and look through those, and if that wasn't enough, go back for more.


I generally do the same thing, rarely do I get a hit with the first link.


Me too, but I don't click on links that look obviously bad. I open the half-dozen or so most promising links.


They might also look at the timestamp between the clicks. If they're all together they might realize it's just someone opening multiple tabs at once. If they're a few minutes apart that may mean something else.


They could also tell that you didn't leave the SERP between clicks.


Do you have any reference to confirm that google does this? I really doubt it would be a useful heuristic, as just because someone opens another search result does not mean the first one was not valuable.

Not saying they don't, but it seems unlikely and I'd be curious to know if this can be confirmed.


When Marissa Mayer was working on Google User Experience she mentioned that Google did this : https://youtu.be/LT1UFZSbcxE?t=3462


another good gui is this web-based one: http://www.alltubedownload.net/


The pafy python add-in library is good too, although it is command-line it's really easy and well-documented.

http://pythonhosted.org/Pafy/


Oh, nice find ! There's even a windows version.

edit: with an installer ! And the application updates youtube-dl to the last version. Very nice.


I had to resolve a dependency before the installation worked (wxPython) on OSX. Worked via `brew install wxpython`


You dont need a gui at all gor youtube-dl. Its sufficiently explicit.


I don't think it's a tragedy because if it was very popular and easy to use YouTube would likely block it. It's directly competing with their own YouTube Red. Also look at popular Linux distros like Ubuntu. As soon as they reach mass market they lose what made them special to begin with and start experimenting with advertising and so on.


> Also look at popular Linux distros like Ubuntu. As soon as they reach mass market they lose what made them special to begin with and start experimenting with advertising and so on.

Well, ubuntu is a company. It was always their intention to become profitable at some point, even if they were willing to operate at a loss to build their market.

I very much doubt debian would go the same way if it got the same level of publicity, for example. But then, as the GP said, it's unlikely to happen because they're a community project without a marketing budget.


> Well, ubuntu is a company.

A minor nitpick: Canonical is a company, Ubuntu is their (main) product.


What made Ubuntu special was making Linux and other free software easier to use. But when it became too easy they started to take away the "free" part by adding intrusive "features". It's was never a given that as a company they would try to make money that way.


Is it really possible to block youtube-dl? All it does is the same thing Youtube's own HMTL5 player does, except that it saves the video instead of playing it back.


They can change their site around enough to make it not worth the effort to maintain the tool. But it's always a cat-and-mouse game.


It isn't quite possible to block youtube-dl but not other ways of accessing YouTube. However, if you're downloading a lot of videos from one IP address, Google will blobk your IP from accessing YouTube. I know this because it happened to me after I ran a service to allow people to make gifs from YouTube videos, and the way I got them was with youtube-dl. After a while (about two years) they blacklisted my IP.


Once every two years isn't a bad failure rate. Easy to get another one.


Certain videos will download without audio then I update youtube-dl and that usually fixes it.


Youtube could always switch to using EME. Then they get to lock down all unauthorized players. Serve some low res videos un-DRMed to continue allowing embedding.


Yes. It's called a cease and desist.


From https://www.quora.com/Is-downloading-YouTube-videos-legal/an...

Downloading from YouTube is in most cases not illegal - it could be considered time-shifting for personal consumption, in some cases fair use, both of which are legal in US. In some cases though - like downloading the movies that are paid or videos with limited distributions and not available in the States, could be considered copyright infringement.

What downloading does though is break YouTube's Terms of Service. Even though some courts already stated explicitly that breaking Terms of Service is not illegal, doing so might still get you in trouble in civil court, as you are breaking an agreement between yourself and the company services of which you are using.

If you would be using YouTube APIs for your product, they would probably suspend your access if they wouldn't like your product, so something to consider.

Is it ok to download the videos for offline viewing? Your choice - might not be illegal, but not 'ok' from YouTube's point of view.

Doesn't youtube lose out on advertising revenue this way? Yes - that's is precisely the reason for the rule :)

The big unknown here is that the issue has not been presented in US courts yet, at least as far as I know, so there is no precedent.

Hope it helps.

--------------

Also check http://www.pcadvisor.co.uk/how-to/internet/is-it-legal-downl...

--------------

Also check http://lifehacker.com/5901773/breaking-a-terms-of-service-is...


Unless his attorneys are going to go up against YouTube's attorneys and drag this through to the Supreme Court (that is, unless he has a few million dollars sitting around earmarked for his lawyer), it can and will be stopped by a cease and desist. If YouTube sued him, they'd probably get an injunction preventing him from distributing youtube-dl until the case was resolved.

Even if it were litigated all the way up to SCOTUS, there is no guarantee that the Supremes would see a video downloading device the same way they see a video recording device (and the ruling that stated home recording was fair use, Sony Corp. of America v. Universal City Studios, Inc (colloquially, the "Betamax case"), was itself a controversial 5-4 ruling) instead of the way they see a peer-to-peer distribution network like Napster.

There are many spurious C&Ds sent to people for violations of the CFAA based upon a site's Terms of Use each year; big companies squashing competitors they dislike, or even non-competitors that embarrass the company by providing a service that they've as yet been unable to figure out, etc. The argument that violation of the Terms of Use constitutes unauthorized access under the CFAA has prevailed in court multiple times, and even if it hadn't, once a C&D is received, the authorization is at that point certainly revoked and thus, continued access equates to a violation of the CFAA.

There are copyright and trademark issues here too, even if you can prevail on the CFAA issues (not likely). Judges have ruled that downloading a webpage into RAM in order to extract non-copyrightable data is copyright infringement, because the momentary existence of the entire page in RAM is an unauthorized copy.

Various counterarguments that shift the blame to the consumer, e.g., "we don't actually talk to YouTube's server, we just take a URL that the customer submits via the extension and convert it to another URL, and that doesn't involve accessing YouTube's servers", usually fail (though logically extension developers shouldn't be any more liable than browser developers for their customers' use). One could be considered a conspirator or an accessory to CFAA violations.

So, yes, it could and would be stopped by a C&D unless Richard Branson or some other megamillionaire is secretly bankrolling youtube-dl, and even then, its chances of surviving the legal battle unscathed are pretty slim.

Similar considerations apply to something like PriceZombie, which Amazon just shut down because it doesn't like what the data reveals. The legal situation here is a seriously understated social problem.

You may read this and say it sounds like web crawlers like Google are illegal. Well, yes, they are. The difference is that Google was able to hit critical mass before such a devastating lawsuit was brought, and now they're effectively too big to sue out of existence. If you are making an internet company or product, you have to hope this happens to you before you make someone mad and get sued to death.


I've started to become more and more disgruntled with search engines in general. Yeah, if I want to find something obvious, I'll find it.

But what about mildly obscure software like this? This is something I would completely use, but have no way to find it. There's so many tools out there which are totally awesome, but wilting away because you can't find it in the search engines.

As much as I love technology, it still seems the best stuff is usually found through the old tried and true methodologies. Word of mouth, conferences, or from friends or other developers.


Your family members would use a command line app ?


If they knew about it, sure. All it would take is a 3 step (after initial download) instructional with some screenshots:

1. Open Explorer where you downloaded youtube-dl

2. Shift+Right click -> Open command window here

3. Type 'youtube-dl <space>' and paste url[0], then enter

As I said it really is a discoverability problem, one that the organiser of the world's information is neither incentivised nor really expected to address.

[0] ok, this is a pain pre Win 10, but ^V is supported now


I happen to be on a fresh copy of Windows 7 right now, so I'm going to try it. I expect to encounter at least several steps where a nontechnical user would be totally lost or frustrated.

1. Download Python 2.7 and install. Encountered error where the installer stopped with no indication that it had completed or failed. Tried to install again and it messed up the original installer which was hiding in the background and it failed.

2. Downloaded the YouTube-dl.exe. Running it does nothing. Youtube-dl gives no instructions on how to install.

3. Reading the documentation of youtube-dl, installation instruction is just "place it in their home directory or any other location on their PATH."

4. Google about PATH variables and home directories... I wouldn't expect a nontechnical user to get past this step.

5. Add C:\Python27 to the Path variable.

6. Drop youtube-dl.exe into C:\Python27.

7. Start Powershell. Doubt a nontechnical user would know how to do this, but whatever.

8. Figure out how to format a command to youtube-dl. Reading through the documentation is kind of confusing at first, but I will just copy a command from this HN thread.

9. Paste "youtube-dl --extract-audio --audio-format mp3 dQw4w9WgXcQ" into powershell. As you mentioned yourself, something a nontechnical user would have trouble doing since control-v is disabled.

10. "ERROR: ffprobe or avprobe not found. Please install one." So Google how to install ffprobe.

11. First link links to another page, which has a long 14 step guide asking me to figure out how to install PHP before I even start, so I'm just giving up here, 30 minutes in.

Sadly I didn't even get to the "it's working but I don't know where it's saving the files to" issue.


"We also provide a Windows executable that includes Python."

I read this as not having to install python for it to work.

I think some powershell commands that have required arguments start interactively prompting the user for values for those arguments if they aren't specified on the command line. That would probably work:

1. Download youtube-dl.exe

2. double-click

3. youtube-dl.exe notices the lack of url as argument and prompts:

URL:

4. paste URL and hit enter

5. Progress bar of download (?)


That may be correct, but the download page explicitly says "Remember youtube-dl requires Python version 2.6, 2.7, or 3.2+ to work." and links to python's website. I tried renaming Python.exe and it still worked, so I have no idea what's up with it.


youtube-dl.exe does not need a separate Python installation.


I think you missed the point; the point is: it says it does. Houshalter even quoted it.

Yes, your software's download page is part of the user experience also.


For 9, I would just go with youtube-dl -f 140 (or 141 in some cases). No reason for lossy->lossy conversion.


Hmm I don't see any documentation for that format code.

I chose mp3 because it's the only format my ipod accepts. The formats it downloads by default won't play, even if they might be higher quality.


youtube-dl -F VIDEO_URL will give you a list of formats in YouTube, that you can choose using the -f option. DASH streams contain only video or only audio normally.


It strikes me that with Microsoft working with Canonical to bring an Ubuntu like command line to Windows that it probably includes something like apt. This doesn't completely address your larger point but it probably would make the process easier.


Yes it seems to me that the problem with open source projects on Windows is they all expect the user to figure out their often complicated installation procedure (and then the installation of all their dependencies...)


1. This would occur with a GUI as well.

Can't comment on the rest as we have yet to get Python installed.


> 1. Open Explorer where you downloaded youtube-dl

Already too complicated for my parents. I have shown my mother how to open her downloads folder for over a decade and she still can't do it. Sigh.


[0] ok, this is a pain pre Win 10, but ^V is supported now

Just gotta remember the old "Alt-Space, E, P" shortcut sequence. And Alt-Space, E, K for selecting/copying.


What's wrong with right-click?


Forces you to take your hands off the keyboard.


Shift-Insert, man.


This is about 2 steps longer than most family member capabilities.


Always the same argument, and still wrong. It depends 100% on the desirability of the expected result. I have seen a non-IT guy do an incredibly complex serie of super user operations on his PC just to install CS. He was very motivated. But if you asked him to install Chrome in place of IE he would even understand what it meant.

Same: many people still use peer-to-peer software to download movies, mostly porn. I guess it is better now but for a long time you had to do some port forwarding -- yes, port forwarding -- on your home router to get bearable download speed. Nowadays it still seem very difficult to get the proper non English subtitles for movies, but it is very attractive so people do it despite all the "steps".

So, please, let's stop this "Family memebers are below-two-clicks stupid" mantra. It is false. The truths is: they usually do not care enough for the second click. When they do care enough, typing a command line is very feasible.


OK then you definitely haven't met my family members, who routinely can't log in because they have the caps-lock on.


He is saying that they can't login when the caps-lock is on because they don't care enough. I think he is right. Even old people are able to do complex stuff, but only if they care.


I agree. I think it's important to keep track of who cares about the user's task too. As you say, if the user cares about a task, they'll jump through many hoops to get it done. Especially when money is involved (e.g. finding cracked copy of XYZ to avoid paying license fee)

When someone else wants the user to do a task, e.g. a business wants users to install and use its software, then it's definitely better to assume that users will give up at minor annoyances or complications. Again, especially when money is involved; i.e. it should be as easy as possible for people to give you money.


I think this nails it.

They want to learn email? They do.

They want to learn to use FaceBook? They do.

If they really wanted to learn to download YouTube videos (Ideally using youtube-dl), they would.


> I guess it is better now but for a long time you had to do some port forwarding

Nothing has changed for me. Did I miss something ?


Back when I was at LimeWire, circa 2005, we attempted to use UPnP to have LW configure port forwarding for you. Though, maybe some router vendors consider UPnP a security risk these days.


It's a command line tool not very lambda Windows user friendly; that's why it's not very popular maybe


SEO rigging? That's mostly having links from other reputable sources. If this software is good, other good sites will link to it rising it up in the search results.

Lot's of open source projects come up top of the results when you search for stuff because of this fact.


>SEO rigging? That's mostly having links from other reputable sources. If this software is good, other good sites will link to it rising it up in the search results.

This is a myth perpetrated by Google and it's entirely false. The fact is that if you aren't actively engaged in spa--err, SEO--, you will be outgamed and crushed by anyone moderately competent at spa-- err, "internet marketing".

I make a point of replying to this because my established, objectively-superior-in-every-tangible-way company was creamed by a bad copycat that had a pre-existing spam apparatus, despite our one-year head start and, as already stated, every conceivable advantage (we were cheaper, more effective (their stuff basically didn't work at all), and much more attractive (they were using a crappy WordPress template; we had a beautiful custom design created by professional designers)).

I was dumb enough to believe Google's statement that if you're good, you'll gain organic links and your rank will rise. Our SEO strategy was based on writing a lot of blog posts and hoping their relevance and high-quality information would facilitate a rise in the ranks (our competitor had no content at all; just a landing page promoting his bad knockoff product). This strategy had basically no effect. Making good content and/or products and crossing your fingers simply does not work if you have commercial competitors.

>Lots of open source projects come up top of the results when you search for stuff because of this fact.

Technical projects that are either so ubiquitous it wouldn't make any sense for Google to display anything else, so niche that there is no real commercial competition targeting non-technical people, or both. As can be clearly seen with youtube-dl, if it's a keyword that other parties are interested in monetizing, you have to either play the game or lose. The game is not what Google or Matt Cutts say it is (that's disinformation), the game is what actually gets you to a high ranking on Google.


Did you actually approach the media, authorities in the niche, Techcrunch, etc?

Because you can't just rely on 'on site' SEO to succeed. Adding a bunch of content on your own site is good, but what's really needed is to get authorities elsewhere to link to it. So you need to get good at marketing/PR, in the sense of talking to people with popular sites and social media channels.

You can do a ton of stuff on your own site, but it's irrelevant if you're not being linked to or mentioned elsewhere. And one good link from say, the New York Times or BBC or some other popular site is worth a ton more than a thousand spam links from low quality domains.


The niche was extremely specific. It's not something the NY Times or TechCrunch or other big generic media outlets would've reported on.

As for niche authorities, there are only a very small handful of them. I did contact them. One of them never replied and started deleting all references to my project off of their message boards where users had been raving about it. I don't have any official reason why, I can only speculate that they saw some sort of competitive threat in it, though it wasn't competing other than providing a service to the same small niche at the time.

Another niche authority I spoke with pretended that they were interested in running a story about me long enough to get into the beta and get a feel for how it worked, at which point they stopped replying to me, blocked me everywhere that has a block function, and tried to copy the idea themselves. Their copycat was so bad that it was shut down by their host for spam violations within a month. I tried to follow up after the fact here and never got a reply.

I got one or two sites to link to me as a paid sponsorship thing. I don't think they put nofollow on their links, but I'm sure their PageRank was pretty small anyway. My guess would be that most domains in the niche don't have a lot of influence with Google.

In a dysfunctional niche like the one I was involved in, where everyone is hyper-paranoid that any new person on the scene, even if they're not directly competing, could be their death, Google's link authority approach doesn't really work.

I made extensive use of social media through the advertising options on Facebook and Twitter. I also ran AdWords. The results from the first 2 were fine and the results from AdWords were below average. However, all that was proven to be useless when compared with an organized spam campaign, which I was intentionally trying not to run.

I've since accepted that you have to deploy some of these tactics that everyone complains about and pretends are so evil, whilst they do them behind their back. I wish I would've accepted that earlier instead of believing the bullshit that's put out about this.


Wow, that's pretty awful. Out of curiosity, what is this niche? Sounds like one where the major players in the field are messed up beyond belief.

Last time I heard stories like that was about heavily spammed niches, like casinos or pharmacies or SEO itself.

But yeah, if you're in a field where competitors are either ultra paranoid or sleazy, then you'll likely have to resort to 'dirty' tactics.


I don't want to disclose the niche because it's so small that disclosing it will likely allow people to figure out what the project was. It's not something that's conventionally thought of as filled with spammers. I was pretty surprised at the total vacuum of professional behavior when I first got plugged into it.

The larger issue here is that Google's algorithms can't identify quality content without something that it already believes to be quality pointing out to it (and in a very specific way that Google detects as a "natural" link, whatever that means). This causes issues with innovative solutions that aren't immediately accepted within their niche, niches that are small and heavily paranoid, and in which incumbents maintain their positions by offensively seeking to harm and/or silence discussion of anyone they dislike, or other sites that deserve good rankings but are unable to get acclaim from either the NYT or the niche-equivalent. You shouldn't need an entity Google trusts to run a story on you to get good rankings. It'd be great if Google fixed that, but I don't really expect them to do so.

We should just make it known among real entrepreneurs that they shouldn't have reservations about SEO tactics (which are almost all somewhat uncomfortable, at least) and that they are required to compete so that no one else with a good, legit business gets quashed by a spammer because Matt Cutts and Google swears up and down that not only do you not need to do anything but "make good content", but that you'll be hurt if you take artificial steps to enhance your rank. It's BS -- those artificial steps are mandatory to control ranking.


Unfortunately, this is likely going to be a problem till strong AI becomes a thing, since there's no real way to judge content quality automatically without it.

Also, popularity may not be tied to quality, but to some degree, it's tied to what people expect to get when they search. Which is its own problem, since someone like Microsoft or Apple could do anything, yet people would be suspicious if they didn't show up for obvious queries. So it's a balancing act between 'rank the sites that might be better but less obscure', or 'rank the ones people expect to find because they already know about them'.

As for having reservations about SEO tactics... it should depend on exactly what they are. Something that hurts communities or users (like spamming forums or social media) is pretty damn sleazy, and is a quick way to commit business suicide. As is outright or borderline criminal behaviour for rankings.


>Unfortunately, this is likely going to be a problem till strong AI becomes a thing, since there's no real way to judge content quality automatically without it.

While this is true in absolute terms, there are ways to improve that I don't really know of Google doing (not that they aren't, as I don't have information on their internal workings). Google's algorithms seem to consider linking supreme and they don't appear to do any of their own research. I think a research/polling program to get users to rate some content would greatly improve search results. Other signals like the average reading level of the page's text could also be used to surmise the type and quality of content.

Overall, we need more humanity in the search results and less blind belief in the academic theory. This is a lapse in judgment frequently made by academics and mathematicians; they refuse to accept the evidence of failure that lies in front of them (since their theory/model/whatever doesn't say it should exist) until the failure reaches catastrophic, impossible-to-ignore thresholds. We need more humanity in a lot of systems, in my estimation.


>SEO rigging? That's mostly having links from other reputable sources. If this software is good, other good sites will link to it rising it up in the search results

You have tell Google what your site is about, otherwise it's pretty hopeless; you're pretty much well asking Google to guess what terms the site should rank for.

The five-minute-basics this site needs are to create a meaningful title tag (getting "YouTube Downloader" in there would be a great start. With zero research, maybe even "YouTube Downloader - Save Videos for Later"), create a friendly meta description that'll tell people what it's about in the search result pages, and use an H1 where it's currently using a TD with "subtitle" class.

It wouldn't hurt to also have a short bullet-point list of uses cases, just to get related search terms - e.g. "save youtube to my computer" - that the big G can use to direct users to the site.

>Lot's of open source projects come up top of the results when you search for stuff because of this fact.

The problem is so bad, I know lots of people - myself included - who hunt for projects first on Github, and Google a distant second.

Google is capable of some quite incredible things; using mind-reading to find out the important parts of a project or what it relates to, sadly, isn't one of their core strengths.


Google pretty much ignore or place a very very low value on meta description and titles since it's so easy to game. External links, from high ranking reputable sites is where the most value is at since they are hard to game.

Example would be linking to this project page from the wikipedia page for youtube. Also the text used for links is important.

Yes google is a mind reader and it does figure what your page is about. It's actually not that hard using natural language toolkits to process the text on the page and figure it out. See http://www.nltk.org/


    > The problem is so bad, I know lots of people - myself
    > included - who hunt for projects first on Github, and
    > Google a distant second.
Seriously?

I search with `site:github.com` all the time.


DuckDuckGo has !github, !gh, !ghcode, and !gist.

https://duckduckgo.com/bang?q=github


That just takes me to GH search results, though.

My point is I find that I have more success with Google's indexing than Github's own (same with SO; many others).


And don't forget !yt for YouTube search from DuckDuckGo. (!bang will show you almost 8000 bang options)


>Seriously?

>I search with `site:github.com` all the time.

Yup - I find that Google's index isn't always as fresh as Github's, and being able to filter by code vs. repository vs. issues and then by language if necessary is a great help.

Basically, for me, finding open-source projects is a real unsolved problem!


SMPlayer, which I use, includes some sort of yt downloader, not that I ever used it.

As for the SEO - I haven't had any problems in the last years. First or second hit was a working webpage that gave me the downlaod url (not much options though).


> The amount of crapware I've had to remove from family member's PCs...

I think it is time antivirus, Google Chrome, et al recognize those installers as crapware and give a warning before installation (yes, including Java SDK and Skype trying to install toolbars). Currently Google Chrome is giving a malware warning just because you have an .exe in your web page that for them seems malware, and if you work in


> Currently Google Chrome is giving a malware warning just because you have an .exe

So how should one make available for download windows executables?



Is this detection working for msi or zip files?


Yes.


The link an hacker news will definitly help.


I literally taught my younger brother how to pip install --upgrade youtube-dl from cmd.exe and then use it.


To be fair, it it wasn't a crapware YouTube Downloader, it would be something else. As long as "computer intuition" doesn't become more commonplace, we are always going to have this problem despite our best efforts to get rid of crapware on the net.


Spot on!

However I worry that if projects such as this or mps-youtube (console youtube player) get mainstream, they would be effectively shut down in some way...


Yeah, you really need to go through the documentation if you want to download something the way you want. I guess it's more like wget.


Open source projects should use more restrictive license or someone will be able to take this and bundle it with crapware + SEO.


It's not easy because it's an command line.

Not a single family member would touch this here.

It's sad but understandable.


I threw this together for the less savvy

  #!/bin/bash
  clear
  youtube-dl -U
  echo " "
  echo "YouTube Downloader Script"
  echo "A video file will be created in the folder where this script is located"
  echo " "
  echo "Please paste a URL and hit [ENTER]:"
  read URL
  youtube-dl $URL
Edit: youtube-dl -U only works if it was manually installed, so leave that out if you installed from apt or whatever


Equally as meaningless to every average user. People on HN/github/etc generally just don't understand what it means to be a non-technical user.


You can mark it execute on click.

Granted you still need to know how to cut and paste


Can't find the link now but I remember a computer educator in the UK describing how he taught the command-line to a bunch of seniors.

They had been complaining about how difficult it was to follow all the crazy windows popping up everywhere and never knowing which button to click. This is actually a problem for many seniors.

One day he installed Linux on a PC, booted into the console, and told them that this was "story mode". He gave them a list of commands along with mnemonics, and talked about how in "story mode" you always had a list of all the commands you typed so you always knew what you'd been doing.


An adblocker fixed that for my seniors.

Still need to uninstall Chrome from time to time though. Thanks Avast Update.


If you are looking for something to give your family members, almost everyone I know uses the open-source tool jdownloader [0] to download youtube videos.

It's a ponderous java monster but it works great and comes with a huge plugin collection for numerous sites.

The fact that it has a gui makes it really accessibly to non-technical people.

There seems to be talk about AdWare in the installer but I personally never had that problem and you can get around that by downloading the executable .jar.

[0] http://jdownloader.org/home/index?s=lng_en


I know jdownloader. Have been using it in it's early days for 1-click hosters on a separate machine. Don't trust it at all ;)


I don't trust it that much either, but in the end jdownloader gets developed by a company registered in Germany. [0]

If they ever did something really sinister they would be quickly out of business.

[0] http://www.wemakeyourappwork.com

http://www.wemakeyourappwork.com/#contact


Another jdownloader user here. I have similar misgivings about its trustworthiness, but so far I haven't found any concrete reasons to distrust it other than that vague sense of unease. It's just so damn useful though!


> It's not easy because it's an command line.

> Not a single family member would touch this here.

> It's sad but understandable.

I can understand why many people will avoid using commandlines. The part I don't understand is how they're quite comfortable when those commandlines are surrounded by "Forward", "Back", "Stop" and "Reload" buttons; or when they have an "I'm feeling lucky" button underneath.

In the case of this discussion, the typical user flow would be something like:

- Double click browser

- Enter special string of text "youtube.com" in URL box and hit enter

- Enter strings of text into YouTube search box to find videos

- Copy special string "https://youtube.com/watch?v=abcdefg" from URL box

- Enter another special string "google.com" in URL box and hit enter

- Enter strings of text into Google search box and hit enter

- Click SuperDuperVideoDownload link

- Paste special string "https://youtube.com/watch?v=abcdefg" into SuperDuperVideoDownload box and hit enter

Present this user with a CLI like youtube-dl, and they'll complain that they don't like the idea of copy/pasting special strings into boxes.

youtube-dl actually has quite sane defaults too; e.g. "youtube-dl https://......" will Just Work (TM). Switches are only needed for fancier stuff (e.g. "Download highest quality Free format and extract the audio track")


I'm curious. So you think, this may work as an argument? You think that if I tell my parents this, they'll suddenly start using the command line?

Let me tell you how it works now:

I've installed a download addon for them. Because they have no idea and before they install crap, I'll do it for them.

I did not explain anything nor did I tell them that I did install that addon.

They automatically clicked the red "download" icon under every youtube video they watch and it downloads the video.

So short: 1 step.

This is userfriendly and easy.


> You think that if I tell my parents this, they'll suddenly start using the command line?

Probably not, but that doesn't really matter as it was never the intention (if it were, there's probably a better place to write it than Hacker News).

I was offering software developers a perspective which demonstrates that the GUI/CLI distinction is mostly artificial, and that a CLI doesn't automatically mean "hard to use". After all, as others have pointed out, people managed just fine on DOS back in the day (where "managed just fine" == "shouting at machine for not doing things right", just like today).

> This is userfriendly and easy.

I don't like applying the phrase "userfriendly" to a piece of software, as it depends just as much on the user.

For example, I'm a user of youtube-dl, and I find it incredibly userfriendly: when I use it in scripts, I just write "youtube-dl" followed by flags for the appropriate behaviour. In contrast, your solution sounds really unfriendly to me. First my script would need to open a browser, and since the downloader is part of an addon, I wouldn't be able to use PhantomJS like I usually would. Instead, I'd probably have to go off and learn Selenium, assuming that Selenium drivers can use browser addons? If not, I might have to write a custom XUL app (not done that in a while!), and make sure it's compatible with the addon. Does XUL even work on a headless machine (in my case, RaspberryPi with SSH access)?


You are of course right with the part about user-friendliness but you do realize that most of the internet population did not understand what you tried to say with most of the sentences? ;)

So yes, it depends on the users just as well as your target group.

I'm not sure what your assumption that the difference is mostly artificial bases on since just the difference in the physical act is already overwhelming.


You missed a couple steps at the beginning there:

- Select browser icon

- Double click browser icon

- Click into search box

- Type "youtube"

- Disregard suggestions, hit enter

- Click on first thing that says YouTube


Well, there are lots of ways people interact with browsers; that was just an example. Personally I don't type "google.com", "youtube.com" either, I use Conkeror's web shortcuts.

Still, the point is that it's not much different than running a commandline, e.g. something like:

- Click Gnome Do icon

- type "youtube-dl " and paste URL

- Click the "run" suggestion

- Click on Home launcher

- Watch filename until ".f123." bit disappears from the extension


Yes. This exactly. I know many that don't type in url or even search on YouTube. They just click around. One time a family member asked if all the videos after they watched mine(I sent direct link) were mine as well. They apparently watched 5+ videos thinking they were mine but just happened to be displayed in sidebar and other.


>youtube-dl actually has quite sane defaults

not really, if you copy url of a clip in a playlist it will start downloading WHOLE playlist :(


As it was pointed out the first time youtube-dl was on Hacker News, our user base seems to be split regarding that behavior. When you copy a URL from a playlist, the URL includes both the video id and the playlist id.

Some people want to download the whole playlist when passing a URL from one of the videos (because otherwise it's hard to get an URL that contains just the playlist). Some other people just want to download the video they are currently watching.

That's why we have the --no-playlist option, which you can use and even stick in the configuration file. There's also --yes-playlist to override the configuration file if you need to.


Why not drop to a "did you want the playlist, or just this video?" prompt?

Side-benefit: force care to be taken to be explicit if used in a script.

Personally, without reading any docs the first thing I did was paste in just a video ID (i.e. not the entire URL) so it seems natural to me that including both would be ambiguous.


> Why not drop to a "did you want the playlist, or just this video?" prompt?

Introducing breaking changes like this are no longer an option once your program has more than 5 users.

In addition, well-behaved command line programs aren't supposed to gratuitously prompt for input anyway.


It's debatable whether that should be the default or not; compare it to, say, printing diagnostic info by default and requiring a special `--download` option.

One thing I always change from the default behaviour is video quality: by default it wastes a ton of bandwidth and disk space getting "HD" versions. I can understand why that's the default, but I don't particularly care about resolution, as it's a pretty negligible contributor to quality compared to the actual content of the video.


I think that's an amazing feature. It does the same thing for Soundcloud playlists.


> youtube-dl actually has quite sane defaults too; e.g. "youtube-dl https://......" will Just Work (TM).

Are you sure that this is true? Starting many updates ago, but continuing into the present (I just updated to 2016.04.06 to be sure), I encountered a weird situation where

    $ ./youtube-dl https://www.youtube.com/watch?v=wbKJt1NQtZE
fails but

    $ ./youtube-dl wbKJt1NQtZE
works. I have no problem with the second working, but don't understand why the first fails. It seems to be fine for other video services; only YouTube requires this URL-processing step.


    $ youtube-dl https://www.youtube.com/watch?v=wbKJt1NQtZE
    [youtube] wbKJt1NQtZE: Downloading webpage
    [youtube] wbKJt1NQtZE: Downloading video info webpage
    [youtube] wbKJt1NQtZE: Extracting video information
    [youtube] wbKJt1NQtZE: Downloading MPD manifest
    WARNING: Requested formats are incompatible for merge and will be merged into mkv.
    [download] Destination: True Detective - My Least Favorite Life - Lera Lynn Scene-wbKJt1NQtZE.f136.mp4
    [download]  19.3% of 35.60MiB at  1.51MiB/s ETA 00:18
Seems to work for me. I always double-quote the parameter anyway (I never trust the shell to handle my strings...)

I just tried `youtube-dl wbKJt1NQtZE` and that works too. I didn't know the "v" parameter could be given like that!


In case anyone else hits this (admittedly very specific) problem, nathyong (https://news.ycombinator.com/item?id=11461326 )'s suggestion, and a subsequent USE (http://unix.stackexchange.com/questions/276731/shell-eating-...) question, made it clear that my issue is that I had some time turned on `nullglob`, so `https://www.youtube.com/watch?v=wbKJt1NQtZE ` was being taken as a very strange, certainly non-matching, glob.


Very strange. Perhaps it's some setup- or platform-dependent thing; I will file an issue. Thanks for checking!

EDIT: Very strange; I thought I'd give a try to what seemed a throwaway comment in your post, about quoting the string, and that fixed it. Thanks!

Without the double quotes (which seemed to be unnecessary for you), I still get:

    $ youtube-dl https://www.youtube.com/watch?v=wbKJt1NQtZE
    Usage: youtube-dl [OPTIONS] URL [URL...]

    youtube-dl: error: You must provide at least one URL.
    Type youtube-dl --help to see a list of all options.
I guess that some alias is grabbing some part of the URL string.


It's possible your shell has some kind of regular expression magic enabled that is eating the '?' and the '=' characters:

  $ echo youtube-dl https://www.youtube.com/watch\?v\=wbKJt1NQtZE
  youtube-dl https://www.youtube.com/watch?v=wbKJt1NQtZE
  
  $ echo youtube-dl https://www.youtube.com/watch?v=wbKJt1NQtZE
  zsh: no matches found: https://www.youtube.com/watch?v=wbKJt1NQtZE


Interesting! It seems that my `echo` is eating any substrings involving `?`.

    $ bash --version
    GNU bash, version 4.3.42(1)-release (x86_64-apple-darwin13.4.0)
    Copyright (C) 2013 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

    This is free software; you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    $ echo a ? = =?
    a =


> I can understand why many people will avoid using commandlines. The part I don't understand is how they're quite comfortable when those commandlines are surrounded by "Forward", "Back", "Stop" and "Reload" buttons; or when they have an "I'm feeling lucky" button underneath.

Are you sure you apprehend the differences between the look and feel of a browser and that of a command line?


So then someone should create a dynamic hybrid console-browser.

Take, Chrome, flip it such that the input bar is on the bottom, and allow it to display console output as HTML.

Or, hell, keep it the way it is and just run the console HTML downward; why maintain the current terminal layout at all...


Depends on the family. My mom taught me DOS.


Well...

My mom did teach me DOS, and programming, and a lot of other things – but these days she doesn't have that kind of patience anymore. If things don't work right away, out the window they go. For a lot of people the patience with technology decreases as they age.


Absolutely. I'm also an example of that. 15 years ago it was difficult to see my PC tower closed and without the entrails exposed, I was always trying strange Linux distributions and stuff like BSD or BeOS, and I configured everything I could in OSs and programs.

Now, if my hardware fails I just call tech support, I mostly use Windows, I almost never spend more than 5 minutes configuring anything, and any program I need to compile from sources is basically a no-no except if it's something I really need or can't avoid. In fact I'm so lazy that I tend not to install games that aren't on Steam, after being spoiled by Steam anything harder than double clicking to install game in each of my PCs seems like too much work to me.

In other aspects I don't think I'm so different from 15 years ago, this laziness with technology may be the aspect where I think age has manifested the most!


Not to be morbid, but at some point in my mid-late 20's I considered how many Sunday afternoons I have left in my life. The thought made me a lot less likely to want to spend them dealing with xorg.conf or fiddling with drivers. Though for me, the solution has been to use plain-vanilla desktop Ubuntu on a laptop that ships with it (XPS 13).


It has nothing to do with lazyness for me. When I was young I wasn't getting money for tinkering with hardware, neither for programming. Nowdays I get lots of money for programming...guess which of the 2 I'm doing more


For me it's about time. When I was a kid / teenager I had tons of free time for experimenting, and I didn't really care much for school. Now that I'm employed, I feel like those 8 hours are in fact the whole day. So I have less patience for things that are only tangential to the goal I'm trying to achieve.


This is true, while my mom never taught me too much she still did plenty in DOS. My dad on the other hand... He has an iPhone but would be happy with a flip phone, he uses the exact same amount of functionality that both phones carry, only difference being he has to touch his screen.


Off topic but just want to say, Apple knows there are many people like this, and the 16GB models are designed for them. I tire of seeing whines about 16GB being not enough. We the tech people are siloed in our own bubble and we often can't comprehend the existence of such people, unless they are our family members/close friends.


Well I don't mind him having a modernized phone, at least he gets a GPS. Not sure if he's ever used it, he probably could, he just likes to be simple I guess. As for the 16GB my only peeve against Apple (I'm an Android user though) is no availability to add in an SD card, even if it can't be used as "permanent" storage SD cards hold their value for being portable and transferable. It wont affect me as much though since I'm an Android user.

I'm inclined to agree with you though, except hard drive space is a lot cheaper these days, for about $10 I can have a 32 GB USB 3.0 thumb drive. Eventually the cheaper iPhone options should just carry a minimal 32GB if they decide to stop overcharging for more space. Videos and images are only going to increase in file size over the years to account for 4K adaptability, granted that might take quite a while.


My parents bought me my C64. I'll always be thankful for that and therefore will remain calm helping them out in this mad digital world they don't understand at all.


I also want to thank my parents for buying me C64, my first computer, especially during the time when my family wasn't doing so well financially; I can't ever be upset about giving tech support to my parents.

It reminds me of a C64 TV ad of a student who had to drop out of college because he didn't have computer skills to be competitive (https://www.youtube.com/watch?v=jDcZeGbElnM). Somehow, it all seems relevant now, as C64 gave me a start on programming.


I prefer cli 1000 times over an overly badly designed gui anytime


Sure, but that's not the point, the point is most people are intimidated by a command line and don't want to have to learn it to accomplish the thing they're trying to do


Especially if you don't use it elsewhere or the task does not justify learning it. Like here.


Good! The top slots belong to those services which don't require you to download anything but the video to your computer. In this day and age, is there really any excuse for making anything beyond a web app, or in rare cases, a browser app?

If I want to do a one off task, I'm not going to download any software for it, when I know there is an alternative that can be used entirely on the browser.

There are plenty of addons for major browsers that do this. Those belong on page 1, not this. Most users don't give a shit about FOSS.


Nostalgia time. Even though I'm not actively involved anymore, youtube-dl has been the first OSS project I seriously contributed to, and strangers still thank me at conferences for it.

I owe a lot to the maintainers (hey, phihag!) for tolerating and trusting a much younger version of me :)

I still remember the emotion of getting this merged: https://github.com/rg3/youtube-dl/pull/342

It's also one of the most impressive community efforts I've seen, with just about anyone contributing support for new sites and fixing broken ones: https://github.com/rg3/youtube-dl/graphs/contributors (notice how the GH interface is limited to 100 contributors, and #100 still has 3 commits in the tree)


Thank you for your work on youtube-dl!


Some of the things that make this the 'ultimate':

- Supports hundreds of services, not just youtube [0]

- Allows you to extract audio in multiple formats

- Download entire playlists (and general batch support)

- Configure video/audio quality

- Extract/build metadata

- Cross platform

[0] https://rg3.github.io/youtube-dl/supportedsites.html


-Python integration I used it to write a small program for my Raspi. Send a playlist link (Youtube or other) via WhatsApp or Email. Download, copy to according folder. Have it available on my Multimedia System and OwnCloud for my friends.


I have a backburner project: stream a Twitter search for 'youtube', extract the most talked-about videos, then download and create movie barcodes[0] for them.

[0] With my script: http://timbennett.github.io/movie-barcodes/


I have a similar setup: A script downloads my Remember The Milk tasks (.rss), parses them for YouTube and Vimeo links and downloads the videos to my Synology NAS and places a dot-file in the same directory to signal the script during the next iteration the video has been downloaded already.


How did you get the WhatsApp integration?


I was just researching this, as I want to write a small CLI script to play videos on my Chromecast (e.g. "castchrome https://www.youtube.com/watch?v=_05mIC3BIBc" and the TV will start playing). That way, I can outsource the hard work of discovering the URL to youtube-dl, and all I have to do is send it to the Chromecast.


That sounds pretty interesting, care to share the code?


I use youtube-dl all the time on youtube when I'm browsing the web from elinks. I never realized that it supported other sites. It can log into crunchyroll using the data in my netrc file to download the 1080p video and subtitles! This is amazing, goodbye flash!


Also: - Works with videos integrated in pages from any website

No need to first jump on Youtube/Vimeo/... for the source URL of the video.


One thing I couldn't figure out how to do recently: Download only a certain time range in a video. Of course, I could have downloaded the whole thing and then used standard video tools to extract it afterward, but the video was very large so this would have been impractical. Do you know of a way to do this, by any chance?


Half of these things can be done with FFMpeg.


.. or just use a bookmarklet from keepvid.com, alltubedownload.net and myriad of other sites. I really have no clue who would put up with a CLI solution. Perhaps only people who run a tiling WM or something.


- Illegal


The legality of recording a video stream you can watch on your PC is very dependent of your country. I think it should be legal as long as you keep your recording for your personal usage.


I agree, and the ethics also depend on what you're doing with the video. IANAL so I can't comment on legality.

I download some conference videos from YouTube to watch on my train journey. I can't stream them because reception on the train isn't good enough. It's the only place I can find the videos (they're not available for sale) and I don't share them with anybody afterwards.

I don't consider that to be unethical, and I don't imagine the police are going to hunt me down.


That's not illegal.

It's a bit worrying how many people run to defend corporation profits by default.


>> "It's a bit worrying how many people run to defend corporation profits by default."

Not the OP but I don't think it has anything to do with corporation profits. If I spend money creating a video, put it on Youtube, and try to recoup costs through ads you're bypassing that by downloading the video with this tool.


> and try to recoup costs through ads you're bypassing that by downloading the video with this tool.

99% of the people and organizations in YouTube never recoup costs. For almost all this is wishful thinking.


It doesn't matter if they do or do not. They will recoup something and that's better than nothing.


So in that regard using youtube-dl is like using an ad blocker.


Yeah? Is Wireshark illegal too? Because I could get the same data by taking a pcap.

The bits are on my computer. I get that I can't just go redistributing it (legally), and that youtube probably doesn't _like_ it, but if it's illegal (and honestly, maybe it is in the US given how ridiculous copyright and licensing law is there) that's ridiculous.


Using Wireshark is sort of illegal in Germany.


Can you elaborate?


https://www.schneier.com/blog/archives/2007/08/new_german_ha...

Germany introduced a poorly-worded cybercrime law that basically made all network tools illegal (including nmap, wi-spy), but also disassemblers, on the basis that they "could be used in digital crime".

It's similar to making cars illegal because of a traffic fatality.


He's wrong. Using hacking tools for attacks is illegal. Using Wireshark for network analysis is fine.

It's more about the intent than about what software you use.


Well, being an "inferior race" was also sort of illegal in Germany back in the day too. Hopefully we progress over time.


Not illegal perhaps but violates the TOS


Unless your legislation explicitly grants you that right in a way that cannot be overriden by ToS.


how enforceable is the TOS ?

once something is published on the internet then it is assumed it can be viewed / copied / downloaded / etc.

see https://en.wikipedia.org/wiki/Web_scraping , the legal issues part.


Copyright is different and enforceable - see what RIAA did to some downloaders.


How is this illegal?


Perhaps (or at least a TOS violation). But then again, who cares.


I've been using it for years now and it's great. Not only for Youtube videos, but also for a lot of other video hosters, up to and including TV stations such as the German ZDF or the French Arte.

To fully use its features you should install ffmpeg though. Youtube-dl will automatically use it if it's in the PATH, and then can download Youtube videos with higher frame rates and resolutions (they store video and audio in separate files, and ffmpeg is used to mux both together). ffmpeg is also required to download from some streaming video hosters.

For me it's essentially:

  youtube-dl -F '<url>'
to get the list of available video and audio formats, followed by

  youtube-dl -f <video format>+<audio format> '<url>'
and then wait for the download to complete. And

  youtube-dl -U
to self-update youtube-dl (because it gets updated just about every day).


-f also supports some symbolic names, which is very handy because it allows you to easily get the best possible quality without having to check the formats every time:

    -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]'
this is what I'm using in my case (on youtube).

Posting this here, because it's not obvious from the docs that this works.


FWIW

> Since the end of April 2015 and version 2015.04.26 youtube-dl uses -f bestvideo+bestaudio/best as default format selection […] If ffmpeg or avconv are installed this results in downloading bestvideo and bestaudio separately and muxing them together into a single file giving the best overall quality available. Otherwise it falls back to best and results in downloading the best available quality served as a single file. best is also needed for videos that don't come from YouTube because they don't provide the audio and video in two different files.


bestvideo+bestaudio has been flip-flopping ver time and releases between mp4 and webm though. As I'm mostly using this for consumption on an iPad, I prefer mp4, so I'm happy to have found a way to get the best possible mp4 version without having to go format hunting.


I'm pretty sure the '-f best' setting is the default for updated versions of ytdl, so no real need for that.


Unless you always want to download the best mp4, not webm (or vice versa).


> Not only for Youtube videos, but also for a lot of other video hosters

Oh ye, the list's pretty comprehensive actually [1].

[1]: https://github.com/rg3/youtube-dl/tree/master/youtube_dl/ext...


$ youtube-dl -U It looks like you installed youtube-dl with a package manager, pip, setup.py or a tarball. Please use that to update.

TIL: https://rg3.github.io/youtube-dl/download.html


you can also do youtube-dl -f bestvideo+bestaudio '<url>' to skip a step, since 90% of the time that's what I want anyways.


That's been the default since April 2015,so `youtube-dl url...` is sufficient to get either the best single-file video (if no ffmpeg installed or non-youtube video) or to get both the best video and the best audio remuxed.


I like this command to extract audio from youtube videos:

    youtube-dl --extract-audio --audio-format mp3 <url>


If your music player supports OGG, you can also use youtube-dl -f FORMAT VIDEO_URL and give a numeric format that corresponds to a DASH webm audio-only stream, with vorbis audio (e.g. format 171 these days). The container is webm but it can be trivially changed to OGG with ffmpeg, which you can call via --exec automatically.

Edit: I mentioned that because you don't lose any quality reencoding.


That's my main use of youtube-dl for years now. I'm extracting audio from old french movies available on youtube, work a small sound extract with audacity and then post the result on soudcloud[1].

[1] A bit of self-promotion here, if you are interested this is my soundcloud playlist https://soundcloud.com/melicerte/sets/extraits-de-vieux-film...


That is a really cool playlist.


Why?


Why not!


I'm not against it or anything, I'm just wondering if it is a personal interest or if there is some niche usage I am unaware of.


I like to keep it in original audio format (usually AAC) instead of mp3, because with mp3 conversion, there is also some loss of quality due to re-compression.


Or you could use -x, which would only download the audio (because there's seperate audio and video streams on youtube).


yes -x is the same as --extract-audio, but I use an alias in my bashrc like this (if you don't use --audio-format mp3, you might not get mp3 (not necessarily a bad thing)):

    alias youtubemp3='youtube-dl --extract-audio --audio-format mp3'


Here's something i've added to my .bashrc that lets me type in simply 'play <some song name>' using youtube-dl and mplayer (I forget where I found this gem, and sorry for weird formatting, won):

  function play {

     youtube-dl --default-search=ytsearch: \
                --youtube-skip-dash-manifest \
                --output="${TMPDIR:-/tmp/}%(title)-s%(id)s.%(ext)s" \
                --restrict-filenames \
                --format="bestaudio[ext!=webm]" \
                --exec=mplayer -vvv "$*"
  }
play rick astley never gonna give you up


FWIW, mpv (a very good fork of mplayer) integrates youtube-dl by default. So you can do `mpv "https://youtube.com/..."`.

In fact, VLC does too.


One very minor annoyance I had was using it with BBC iPlayer. It works, but downloads the video as many dozens of tiny parts to reassemble. Since I use ~/Desktop as my default downloads folder, I created this to keep my desktop uncluttered while it runs:

  ytdl()
  {
    mkdir /tmp/ytdl && cd /tmp/ytdl
    for item in "$@" ; do youtube-dl "$@" ; done ;
    mv /tmp/ytdl/* ~/Desktop/
    rm -rf /tmp/ytdl
    exit
  }
Now I can Ctrl + Alt + T a new Terminal window, type ytdl http://www.bbc.co.uk/iplayer/episode/... (can use multiple links) then minimise the window and move on to other things.



Have you considered opening an issue? Using the current directory as a temp directory seems like something that should be fixed, or at least made configurable.


Excellent use-case! It's not that much faster than just `!yt rick astley never gonna give you up` on DDG, but the advantage is that leaving my dev environment introduces... distractions.


This is very very awesome. I never bothered to read the man pages in enough detail to even know this was possible! A fine job my good man.


This is brilliant! Thank you :) although I renamed it to yplay, since play is already used on my system.


Do you know if this downloads the file to completion, or streams it?


I'm in China and streaming youtube videos is mostly out of the question, due to the very unpredictable and usually too slow nature of connectivity (I gave up on VPN long time ago and use a number of strategically placed cheap virtual servers). Over the years, youtube-dl has been a godsend. I ssh into one of my servers, download the video and then rsync it over to my laptop. Most of the time I don't really need to have the video stored locally - if I was at home I'd just stream it again - but for some niche applications like mine it's next to nothing. The buffering built in to youtube itself too often just stops or throws me into 'an error has occurred'.


Why not use an SSH tunnel as a SOCKS proxy? Would save you a few steps there.


Standard ssh tunnels get torn down or throttled or reset.


Another great thing about youtube-dl is its integration in mpv[1]. On Windows as long as you have both mpv.exe[2] and youtube-dl.exe in the same folder you can use it to play pretty much whatever youtube-dl supports. This should also work on *nix/Mac as well just check your distro's repo's or wherever you look for stuff like that on Mac (can you tell I've not used Mac stuff ever).

I rather like using it for things like twitch streams since I can bypass having to use Flash and get a higher quality renderer in the process (with things like high quality scaling[3] and debanding[4]). And it goes without saying that it's nice for youtube stuff as well because of the aforementioned benefits. Basically it makes stuff look even better than if you watched it the browser, and I like that.

[1] https://mpv.io/

[2] https://mpv.srsfckn.biz/ (official Windows builds)

[3] https://mpv.io/manual/master/#video-output-drivers-opengl mpv supports ewa_lanczossharp (aka jinc) for scaling among others

[4] Also a huge fan of the debanding which can be left on all the time


Mostly OT: A friend of mine posted this article from his local newspaper as an example of how slow news is in his town:

http://www.ottumwacourier.com/news/local_news/what-is-a-gif/...

> What is a GIF?

> OTTUMWA — Chances are if you have been on the Internet lately, you have encountered a GIF...In honor of National Teen Tech Week, the Ottumwa Public Library offered a session on GIF making for local teens Saturday afternoon.

OK, not a traditional article topic for a newspaper, but the library described seems to be very much on the ball, teaching teens how to use youtube-dl to download movies:

> He walked each of the teens through the steps required for making GIFs by using movie trailers found on YouTube. He then had the kids copy the web address and use the program youtube-dl to download the video. OPL also provided flash drives for each person so they could access the program at home.


Don't knock gif, it's still used a lot on image boards[1] and most likely Facebook etc, too. Knowing how to make them can be quite useful for today's teens.

[1] E.g. 4chan, which even has its own boards just for animated gifs: /gif/ (NSFW) and /wsg/ (SFW)


These days it's all about the webms, though. Luckily youtube-dl is even more useful for that.


but manually downloading each image/webm in a thread is not fun. i resort to use httrack and it works wonderfully.


But most content on /wsg/ is webm these days


The Ottumwa Public Library staff are heros.


Note that it is against YouTube's ToS to download videos: https://www.youtube.com/static?template=terms

"You may access Content for your information and personal use solely as intended through the provided functionality of the Service and as permitted under these Terms of Service. You shall not download any Content unless you see a “download” or similar link displayed by YouTube on the Service for that Content."


The ban on "reproduce, distribute, transmit, broadcast, display, sell, license, or otherwise exploit" they can enforce, but if the data is coming from them to you, it's "downloading". Google does not have the right to say, once they allow data they permit into my machine's memory, whether or not I can then flush my memory to my machine's persistent disk store.


I'd have more sympathy if youtube hadn't removed the "preloading" feature on the android app - I was an avid user of this feature for train journeys where I have little signal. Now I'm using downloaders. These sort of violations are always of the company's own making.


From https://www.youtube.com/red: "Enjoy videos without ads–and in the background or offline on mobile devices"


Also from https://www.youtube.com/red: "YouTube Red is not currently available in United Kingdom."


Also "YouTube Red is not currently available in Argentina."


So what do they propose for someone that has a slow internet connection and can't watch streaming videos ?

I have a NUC server at my parents house (they have a fast connection) where I connect remotely and make all my downloads. When I visit them I bring an external HD with me.


So if I never agreed to those terms, I'm in the clear?


You agree to the terms by using the Service - not when making an account.

I think something could be said about how an agreement of that manner is not legally binding so you can ignore it, but IANAL. Just a faint memory something from the legality of TOS and maybe I'm not remembering it right. I place my confidence at 85% for "not legally enforceable".

It has to be brought to your attention and usually that step is when creating an account.

I'm also not sure if "please do not use the Service" is equivalent to "you may not use the Service". It's a request, not a demand. But I'm not sure if that sort of pedantic attitude would slide in court.

Regardless - Google/YouTube aren't enforcing this so I don't think it matters from a legal standpoint - just a moral one.

>By using or visiting the YouTube website or any YouTube products, software, data feeds, and services provided to you on, from, or through the YouTube website (collectively the "Service") you signify your agreement to (1) these terms and conditions (the "Terms of Service"), (2) Google's Privacy Policy, found at http://www.youtube.com/t/privacy and incorporated herein by reference, and (3) YouTube's Community Guidelines, found at http://www.youtube.com/t/community_guidelines and also incorporated herein by reference. If you do not agree to any of these terms, the Google Privacy Policy, or the Community Guidelines, please do not use the Service.


But honestly, who cares?


So?


The work-horse. If the author/maintainers are here, thanks a lot. With an old laptop I need mpv/mplayer to be able to play videos without overheating. youtube-dl is my youtube backend, one of the most used commands on my terminal.


This is a great project. I have been using it for more than 4 years and it has never disappointed me ever. It picks up from the interrupted download, can convert in any format you prefer and get only audio out if you will.

Great work guys! Thanks for creating such an awesome piece of software.


Thanks for your kind words on behalf of the current team.[1]

[1] http://rg3.name/201408141628.html


Note that mpv integrates well with youtube-dl. With an "open with" like addon it's relly handy especially on sites that are still stuck on flash.


youtube-dl is great. It belongs to a class of software, that could not exists without a place like github (or any platform, that makes it easy to contribute). Many developers (here: 403) sharing the burden of keeping the scrapers up-to-date, which would be a dull and mind-numbing task for a single person or small group of people.

Other wonderful projects in this category would be homebrew[1], wiki*, OSM, ...


Nothing but positive experiences with youtube-dl, invaluable piece of software IMO.

For people interested in tools like this, or for people who want to just watch videos without downloading, I would also recommend Livestreamer. I use it to watch Crunchyroll streams, and I avoid all the strange issues that come up with their terrible player. No more skipping to random sections of the episode. https://github.com/chrippa/livestreamer


I actually made a small script to download offline youtube videos using youtube-dl.

https://github.com/corradio/watchlater https://oliviercorradi.wordpress.com/2013/11/19/3/


Download mp3 with the maximum possible quality.

$ youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 --output "%(title)s.%(ext)s" <URL>


Also, a lot of times I'll quickly grab videos from my youtube subs to listen to while I jog: if it's a video then the screen would stay on, so I just grab the audio with `youtube-dl -f 140 <URL>.` This downloads just an m4a that works on my iPhone. It's not ALWAYS format 140 (-F to see them all) but usually.


Huge props to the team working on this.

I once maintained something similar in Ruby (https://github.com/rb2k/viddl-rb), and the amount of changes necessary just to keep a hand full of plugins up-to-date is crazy.


If you use mac, it's available on homebrew. even easier.


I use vlctube https://greasyfork.org/en/scripts/1783-vlctube to not only download youtube videos but to also use vlc as default player, there is a huge performance boost, I no longer hear my cpu fan when playing a youtube video.


It would be nice if there was a "shadow" version of youtube on bittorrent. So instead of using youtube-dl, you could just pull the file from bittorrent. Besides this being faster in most cases, it would also mean that a big part of our cultural heritage is no longer locked inside google's silo.


There's an app called Free Download Manager which has this feature. I suspect it may be using youtube-dl under the hood, since the functionality looks similar (with a GUI, of course). The app allows you to copy/paste youtube urls and it parses the page for available downloads (audio and video). I use it regularly for putting technical talks onto my phone to watch or listen to on my commute.

The app is very easy to use, and one of the few I would recommend to a non-technical person for the features it has.

I know the name makes it sound like spyware, but it's the most lightweight tool I've found for both this and the occasional torrent.

http://www.freedownloadmanager.org/


The only thing that irritates me about youtube-dl is that by default it will try download audio and video tracks separately and then remux them on your computer. While it's a cool feature, I don't think this is what most people want 99% of the time.


That’s because the best quality streams are delivered that way by Google so if you want the higher quality video+audio you have to download them separately and remux them locally.


Don't know why this is being downvoted. VLC can play .part files of many formats, but not if they're seperate streams. I wish there was a way to just download the highest format that will download only one file.


    -f best
It's in the documentation.


no, that's the highest format, not the highest format that will download in one file, as opposed to two which have to be merged, meaning playing .part files is impossible


Are you saying the documentation is wrong? And not once but twice:

    You can also use special names to select particular edge case format:
    
    * best: Select best quality format represented by
            single file with video and audio

 
And again:

> Since the end of April 2015 and version 2015.04.26 youtube-dl uses -f bestvideo+bestaudio/best as default format selection (see #5447, #5456). If ffmpeg or avconv are installed this results in downloading bestvideo and bestaudio separately and muxing them together into a single file giving the best overall quality available. Otherwise it falls back to best and results in downloading the best available quality served as a single file


oh duh, sorry. I thought I read somewhere that best was the default option


Most of the time I've seen this come up in non-technical circles, the person wanted an MP3 to put in their library.


Here is a script I use to download a lot of videos in a queue with it: https://github.com/kissgyorgy/interactive-youtube-dl


User for >4 years. Absolutely love the nifty little tool. But I hated opening up a terminal each time I wanted to initiate a download.

For PopClip[1] users on Mac, I made a little YouTube-dl extension[2] which lets you initiate the download just by selecting the video URL (best when done from browser's address bar) and clicking a button. Been using it as my primary ytdl client for past 5 months now.

[1]: https://pilotmoon.com/popclip/

[2]: https://github.com/k4rtik/popclip-ytdl


This is exactly why I love FOSS. The main functionality is there and every user can customize it to best suit his needs.


I've used this tool a ton of times and it is a standard install on my multimedia fetching VM. I really want to take the time to allow for a Sonarr[0]-for-youtube (and other supported sites) app that uses this on the backend. For example I love CGPGrey but don't want to constantly be downloading new videos (But I do want to watch them through my Plex setup). Some channels have convenient playlists I can download (and keep downloading) but I normally want to change the naming to a convention I specificy.

[0] https://sonarr.tv/


Honest question: why would you want to download a video from YouTube? The main use case I can think of is you want to watch videos offline on a mobile device but don't want to pay for a YouTube Red subscription.


Mostly offline use. It's nice to be able to include them in a presentation. Rarely archiving is useful, especially if you think a video might get taken down. Also sometimes you want to grab a clip, for example if you are including it in a larger video.

I don't do it very often (except for mobile watching without burning quite as much battery) but I see a number of use cases.


In addition to offline use, YouTube videos frequently get taken down due to bogus copyright claims (see: http://www.cartoonbrew.com/law/internet-creators-pressuring-...) or even nuked by their creator (like the "InternetAristocrat" did).

I frequently backup entire channels using youtube-dl just to avoid the chance of that content getting destroyed.


Well, not wanting to pay for a Youtube Red subscription is one possibility, another is that you want to access Youtube using only open source software, and another is to bypass ads.

I actually do pay for Youtube Red, but I like to download my Youtube videos because a) my internet connection is a bit spotty, and b) I like to keep as much as I can open source.


I have shitty internet and there are many times of the day when its hard for me to watch videos without them always buffering. youtube-dl lets me download the videos on the background so I can watch them later at a decent resolution and without all the buffering.

youtube-dl is also helpful for other video serivces. For example, twitch.tv doesn't have as good of a CDN on my country as youtube does so youtube-dl is sometimes the only way for me to watch a twitch.tv VOD at decent quality (even in those days when I can watch youtube videos just fine).


a.) Long car trips across many state lines with poor coverage and/or limited data plans. b.) People who work in offices or live in places that block YouTube, so they just run the script from some kind of VPS.

Honestly, those are the only scenarios I've seen in the wild. It's not like we are still living in the days of Napster.


Also, YouTube red is only available in some countries.


offlberty.com

Sometimes one may be in area of good connectivity, but often not.

This is commonplace in countries with limited internet access.


Recently, I wrote a chrome plugin that saves information of all of the songs I listen to on youtube to amazon since youtube's history API is shit. Theoretically, I could write a nightly job that runs YouTube-dl to turn all of those videos into MP3s. Taking it even further, I could run a nightly SyncMe job on my phone to copy the MP3s locally. A setup like this would be good for people with limited phone bandwidth. Imagine not having to search out MP3s anymore. Is it still considered pirating if a robot does it?


Yeah but how are they gonna detect it. Streaming a video is pretty much indistinguishable from downloading since that's what you actually do. If there's no claimant, there's no judge. I'd say things like that are de facto legal since it cannot be enforced.


Unfortunately, the robot only does what you tell it to do.


I have a sort of atavistic thing against streaming. I download things, and then I watch.

This is a really nifty tool, though I must say that Flashgot on Firefox does the job nicely for me, 99% of the time.


What a funny coincidence - I just discovered and used this a few hours ago. I wanted to rip some YT audio from (mostly) old records that I have that are not on Spotify etc.

I looked at some browser plugins but I wasn't really impressed. This, on the other hand, was a great discovery. Really configurable and well documented.

Assuming you have `ffmpeg` installed just run:

`youtube-dl --extract-audio --audio-format mp3 $URL`

and you're done! I expect my phone will be packed of bizarre prog/jazz before the end of the weekend :D


If your phone supports OGG and you're downloading from YouTube, you can download format 171 (-f 171) and change the container to OGG with ffmpeg. That way you won't lose any quality.


If you want a button built into youtube's webpages in Chrome this will do too. I believe there are other projects that do similar things but many aim at doing much more (mine is solely for the little download button which offers all the video/audio formats that youtube-dl does).

https://github.com/bradlys/monochromatic-panda


I really don't like how others profit from the work of the youtube-dl developers. The developers should build their own client-facing websites and apps.


This is a simple GUI which I made for this script: github.com/yasoob/youtube-dl-gui. I hope you guys would like it :) All bug reports are welcome.


YouTube needs a "download" button; love this code, it works like magic, but for the average user the real answer is that YouTube needs a way to download a video; otherwise, YouTube is just enabling all the 3rd party sites that exploit YouTube making it easy to "hack" a way to download the files, but hard for the average user who ends up getting malware to download the video.


previous discussion : https://news.ycombinator.com/item?id=8647943

I used this (on windows) to easily convert/resize videos i had saved earlier using a file:/// url, but this possibility has been removed since a few months because of the obvious security hole (in a linux context)


Not just YouTube, over 200 websites including daily motion, vimeo and, well were all adults here so I'm just gonna say it,pornhub. Supports authentication. And you can download with any format using -f flag. Also I'm not sure about that, but I thing you can use apt-get to download it as well.


I often use mps-youtube, which I believe is based on youtube-dl and works great to listen to music off youtube from the terminal.

https://github.com/mps-youtube/mps-youtube


I have a docker image to run it on OSX, haven't tested on Windows yet.

https://hub.docker.com/r/ontouchstart/docker-youtube-dl/


It's usable natively on OSX, but Docker isn't.

Surely running youtube-dl inside a docker container inside a virtualbox VM created by boot2docker isn't easier?


brew install youtube-dl


I made something like that over Christmas..it's pretty shit but it works to download youtube videos as mp3 :-/ http://akagetsu.com/youtube/


Is this open source by any chance?


There's a web app[0] that uses youtube-dl to provide non-cli functionality. Does anyone knows if there's similar tool/lib in Go?

[0] http://pullz.in


I did a similar little prototype[0] long time ago, learned couple of interesting things from it, then moved to other protos

[0] http://www.burrrn.com/


Nice, although it crashes when given RTMPE youtube links.


What's an RTMPE link?



Not exactly related to this but I remember someone wrote a script which lets you download any song (by name, artist or some phrase from the song).

It uses youtube api to search the song and then download it using youtube-dl.


Look in this very thread, it does almost what you want: https://news.ycombinator.com/item?id=11453377


Been using it for a while. Great for hacks, downloading 360 VR videos, downloading all videos for a channel.

Was happy to see it here, it's nothing new, just a great tool, great job of surfacing it HN!


Why is this so popular last 24h? I am using it for about a year and never saw this much hype. Is there any new feature or is it just that someone rediscovered it and it went viral?


I built a gui/music downloader using this last year. Called musicBoo in case you want to check it out. Its multiplatform, having problems in deployment though (in java swing)


Initial commit is from 2008. I think title should be updated to reflect the initial year, since this is not a new project. I've been personally using this for many years.


Actually, the project started as far back as 2006 and moved to git in 2008, hence the first commit having that date. I don't remember the exact day I started the project, but on freshcode (formerly freshmeat), the first listed version is 2006.08.08.


thank you. I was careful to word my sentence to not imply that the project was necessarily started in 2008.


Damnit! I hate it when people advertise my favorite software.


I used this years ago to create a Youtube2MP3 site. This tool is great. Nice to see that it's still alive and maintained


Second this. I use it to make mp3 playlists. I don't bother too much with mp3's nowadays, but there is a second good reason to download: it's because YouTube bookmarked videos might disappear suddenly. If you want to make sure they remain accessible, you have to download them.


I'm amazed many people do not know about it, considering it is installed via brew together with mpv, lol.


youtube-dl -f 141 <link>

Gives you decent quality audio file from pretty much any video, you can even feed it a playlist.


fun fact: mpv couples youtube-dl to itself and can view youtube videos simply from the command line.

example:

mpv "https://www.youtube.com/watch?v=a3Ey4YChtEU"

(you need quotes because most shells will try to glob match)


Time to revive an old debate: is downloading video or audio from YouTube for personal use illegal?


I've been using this for years to rip ~256k mp3's off youtube.


i love youtube-dl. i've been interested in doing the same with soundcloud, but i have no idea how to go about learning how their streaming works. any advice for where to start?



I actually have a small node program that downloads your entire Favorites collection by just providing your username as a command line argument if you or anyone's interested


Um, I'd be interested!


Soundcloud is on the list of supported sites for youtube-dl and has worked perfectly for quite a while (unless Soundcloud broke something in the last few months).


I first added Soundcloud support to youtube-dl when I was in college. Good times!


thanks! i must have glossed over that when i first discovered youtube-dl. like countless others before, i found out how to do the one thing i needed to and ignored the rest of the tool's utility.


what idiots. there isn't one complete example of how to use the project with a url from Youtube. Instead we have to decrypt what the hell the documentation means.


    youtube-dl [OPTIONS] URL [URL...]
Any examples would be just noise.


Isn't it against the ToS of Youtube to download videos?


Technically, yes, but what do you think is happening when you watch a video from their site?


Great stuff! I wish I can program stuff like this.


Isn't it illegal to download youtube videos?


Yes and No and may depend on where you live.

Germany has a law that permits downloading for personal use. AFAIK in Germany that would trump YouTube's Terms of Service. ToS are legally binding, for the most part [0]. Though there may be parts that aren't enforceable or wouldn't hold up in the court of law.

YouTube Terms of Service [1] doesn't permit "creating a copy". In practice this is never enforced when the video is used under Fair Use. Otherwise you'd never see any Youtubers reviewing other Youtube videos. While it is against the Terms of Service, I'm not sure if it would actually hold up in court.

[0] https://en.wikipedia.org/wiki/Terms_of_service

[1] https://www.youtube.com/static?template=terms

>Content is provided to you AS IS. You may access Content for your information and personal use solely as intended through the provided functionality of the Service and as permitted under these Terms of Service. You shall not download any Content unless you see a “download” or similar link displayed by YouTube on the Service for that Content. You shall not copy, reproduce, distribute, transmit, broadcast, display, sell, license, or otherwise exploit any Content for any other purposes without the prior written consent of YouTube or the respective licensors of the Content. YouTube and its licensors reserve all rights not expressly granted in and to the Service and the Content.


Any thoughts on livestreamer vs Youtube-dl


So excited to try this out tonight


Works like charm. Only if laymen can be convinced that CLI is far easier than GUI.


Nice simple tool


The best use case for youtube-dl is extracting direct mp4 link and piping it to mplayer

youtube-dl -g url | mplayer


mpv (which calls itself a better mplayer) and vlc both use youtube-dl internally if given a youtube url to play.


> It's a bit worrying how many people run to defend corporation profits by default.

Surely you are keen to make a profit yourself with your unicorn startup idea, dear unique snowflake.


This comment breaks the HN guidelines. Please post civilly and substantively or not at all.

We detached it from https://news.ycombinator.com/item?id=11453077 and marked it off-topic.


I feel like "ultimate" in the title is misleading.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: