I have a similar function in my bashrc, which also relies on youtube-dl (which is amazing, btw, it does a LOT more than YouTube – bandcamp, SoundCloud, etc).
I think the best part of youtube-dl is its support for bulk downloads. Point it at a YouTube account or playlist, a podcast on SoundCloud, or even, if you can live with yourself, an album on Bandcamp, and it will snarf up every piece of media it can find.
Some pro trips: by default it searches YouTube for the argument you give it, but if given a URL, youtube-dl will always use that instead. So `play <bandcamp URL>`, `mp3 <SoundCloud URL>` will work.
If the first result for your search isn't the song you want, I usually append "hq", "hd", or "album version".
Nice! Works fine on windows with gitbash except for the --exec part, I tried to use the "start" command but it doesn't like the single quote around the path, someone has an idea to workaround that?
1. "function" is non-standard useless syntax
2. mpv now knows how to automatically spawn youtube-dl, fetch the URL, and stream it given a YouTube argument.
per (1), these are my dotfiles and I use Bash exclusively, ergo, I use the syntax I consider better (because you can easily search for "function" and not the standard syntax with no keyword).
I also save audio from YT occasionally. I prefer to use this command however (to get the best quality audio):
youtube-dl -f bestaudio[ext=m4a] <youtube ID>
PS: you can replace m4a with mp3 but that will induce trasnscoding and loss of quality. YT's AAC tracks are usually the highest bitrate ones so it's best to leave it as is.
Not quite. Sometimes "bestaudio" downloads webm files because Opus audio tracks report higher average variable bitrate. If you don't want to download video+audio and don't want to transcode or deal with Opus stuff, you need that m4a flag in there. Since nothing supports Opus and you need to transcode and remove video, webm seems like a losing proposition. And higher bit rate is deceptive since AAC is a much better encoder even at a lower bit rate.
That's what I mean: youtube-dl --extract-audio already downloads the best quality audio, which may be Opus (albeit typically via DASH rather than a full webm file), so you only need a line like the one you pasted if you want to specify a specific format such as m4a.
Yea! , and I also wrote a small script to embed album arts for all mp3 files.
The script queries with mp3 file name in google images, picks up the first image, downloads it and embeds in mp3 file automatically.
http://iyask.me/fixalbumart/
I cannot, unfortunately. But it is still up & running after the acquisition (2/3 years ago). Basically it lets people search and download YT videos. Very simple, nothing else.
One smart thing he did was to create a new page every time someone downloaded a video, and at some point he was getting hundreds of thousands of daily visitors (I saw the Analytics charts).
Based on the comments here, it seems this tool is powered by youtube-dl.
youtube-dl is a great tool ( supports multiple websites outside of youtube as well )
The problem is...if you use youtube-dl to rip songs from youtube you are going to be stuck with a not so great quality bitrate.
Based on some quick research, it looks like the top quality audio bitrate you can get currently get from youtube is 126.886 kbps. That's going to really reduce the quality of any song you rip from the site. Most songs are digitally released at 320kbps these days. CD quality is 192kbsp.
Maybe I'm biased because for the music I listen to, the quality makes little difference, but if you want the high bitrate, shouldn't you expect to actually pay for the song?
You see the same sorts of comments on torrent sites, people saying like "this is not actual 320kpbs audio, I analyzed it with [whatever] and it's clearly 128kbps reencoded as 320kbps", which I guess is fine as a PSA, but it does imply a really high expectation from people illegally uploading music for free to be illegally downloaded for free.
This has been an age old question since Mp3s were created. However, I'm going to disagree with you there on saying that CD quality = 192kb. I've heard 192kb files and they sound like complete garbage. If you're looking for true "CD quality" that would be LPCM 44100 Hz 16 bits stereo for a bitrate of 1411 kbps.
It really does depend on the file. However, if we're talking about most 192KB music files, they tend to sound "tinny" or shallow. There's not a lot of depth to the sound as compared to quality you would get from a CD.
It's very easy to tell the difference between 192kbps and FLAC if you have a decent subwoofer and the song ever goes below 30hz. On run-of-the-mill speakers and earbuds, probably not.
It's extremely rare for music to contain anything below 30Hz. Even below 40Hz is rare. The only place you're likely to find such low frequencies is sound effects in movie soundtracks.
Interestingly, a lot of "bass heavy" music focuses on frequencies around 50Hz, not the really deep sub-bass. This makes sense when you consider human hearing. Those higher frequencies sound much louder to us, and they're still low enough to get the tactile feeling.
I've heard this before elsewhere and the response then was that the person was confusing kilobits with kilobytes. 1411kbps/8bits/byte = 176.375Kbps. The closest you can get to that is 192Kbps. There's a big difference there.
From Wikipedia's page on Compact Disc Digital Audio:
Each audio sample is a signed 16-bit two's complement integer, with sample values ranging from −32768 to +32767. The source audio data is divided into frames, containing twelve samples each (six left and right samples, alternating), for a total of 192 bits (24 bytes) of audio data per frame.
That has nothing to do with the bitrate -- the fact that you're getting a different unit on your 192 should be in an indication (bits or bits/frame, as opposed to kilobits/second).
CDs store audio as 16 bit samples, with 44100 samples per second. This gives a bitrate of 16 bits * 44100 Hz = 705600 bits/second (705.6 Kbps). This is per channel, so the total bitrate of the format is 1411.2 kbps, as stated (modulo rounding) by the GP.
EDIT: in fact, the article you link specifically says (a couple sections further down) that the bitrate is 1411.2 kbps.
CD quality is not 192 kbps. 320 is the maximum bit rate that a MP3 can provide, and is the standard for the other lossy formats (such as AAC). These formats compress audio by cutting out difficult to hear frequencies. By contrast, CD quality is considered lossless, because it represents the entire frequency of the sound wave. 320 kbps is less data than a CD.
Whether the jump from a good quality MP3 to a lossless format gives you a higher quality listening experience is up for debate, but 126 kbps is definitely terrible.
Yeah, I'm not a big industry player but I'm not exactly enamored with this kind of thing. One question would be does Youtube-dl still provide compensation to the artists/label/publisher/etc in the same format as a stream? If not, then it's genuinely circumventing the (admittedly limited) tracking and compensation structure YouTube has set up. That...probably won't work out very well in the long run.
Restated: no. Monetization depends on the ads. Using such a tool is equivalent to using an ad blocker. If you're comfortable using an ad blocker, you're not doing much different here.
But then you wouldn't be able to use instantmusic to download the audio for the instantmusic demo video! Why pass up an opportunity to be meta when you can be meta?
This is pretty cool. I usually had to add a little more context to get the correct result though. It would be nice to see the top ten results, maybe with a relevance score.
It would also be great if I could pipe in the search and bypass confirmation, e.g:
Slightly simplified & loops through all the links on the first page :
import re, youtube_dl
from bs4 import BeautifulSoup
from urllib2 import urlopen
from urllib import quote_plus
ydl_opts = {}
soup = BeautifulSoup(urlopen('https://www.youtube.com/results?search_query=' + quote_plus('linkin')).read())
links = soup.find_all('a', href=re.compile(r'watch\?v='), class_='yt-uix-tile-link')
for i, link in enumerate(links):
print i+1, '-', link.text
choice = int(raw_input("Select song index : "))
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download(['http://www.youtube.com/' + links[choice-1].get('href')])
I once tried to identify a piece of instrumental music and tried AudioTag, but it couldn't find anything. It would be useful to have a huge global music database with some recognition algorithms for that. Is there anything like that around?
Thanks. I'm looking for something simple enough that doesn't require any accounts. Looks like Shazam and Soundhound have no Web services and require registration. Midomi has recording widget, but no sample upload (that's somewhat weird).
Echoprint is open, I'll take a look at that. Echonest doesn't seem to have any service on their site (not sure how it's used).
I agree, but I can also see their reasoning. It's much easier to script and abuse an HTTP form than it is to abuse a (presumably more locked down) phone app with access to a closed API.
A nice little tool. I'm a big fan of Youtube-dl as well. I've used it in similar chain-together command line tools to feed songs from Youtube into ffmpeg to slow them down to practice/learn songs. It can also swipe audio from NPR so I can stream to my Sonos system, which is nice, because they tend to make the Bonnaroo and Newport Folk content streaming-only on their portal.
I'm surprised to see this on HN. This should be called "Illegally download any song".
I think the project is extremely cool and you have props from me - but I hate it when people try to skate the simple fact that stuff like this is illegal. ROMs and emulators have shown up on imgur many times as "free" - like as if the publishers have released the rights to the game(s).
I don't know what country you live in - but in the US it's pretty clear on the court's stance on scraping [1]. I'm not saying I agree with it - but that is the legal precedent.
> Although these are early scraping decisions, and the theories of liability are not uniform, it is difficult to ignore a pattern emerging that the courts are prepared to protect proprietary content on commercial sites from uses which are undesirable to the owners of such sites.
Straight from the youtube TOS [2]:
> 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.
It's apparent the RIAA that is also against it [3]. If you ask the RIAA - they will most likely say you did not purchase a legal copy of it - so therefore you shouldn't own a digital copy of it. Thus making it piracy.
It appears my original stance got lost - I'm not saying I agree with it - but these are the cold hard facts.
> I think the burden of proof falls under the one saying youtube-dl is illegal, doesn't?
I kind of figured it would be obvious BUT....
> Two days after YouTube-MP3.org, a site that takes music videos and converts their songs into MP3 files, was blocked from accessing YouTube, the RIAA has asked CNET to remove software from Download.com that performs a similar function. CNET, which is owned by CBS, is the publisher of this news site. [1]
Here is information on youtube-mp3.org [2].
Please do see my other post [3].
I want to make it very clear - I do NOT agree with the rulings and RIAA bullying. If you want to be upset at someone - call your representatives and ask them to start passing laws that are in favor of scraping.
As an aside note - to expand on my original post. Emulators are not illegal by definition (unless they circumvent/bypass encryption - but that's a whole other ball of wax), downloading a free or open source community made ROM for the emulator is not illegal. It is, however, illegal to download a ROM for a copyrighted game. Now, Nintendo isn't going to come after you for playing an old NES game in the privacy of your home - it's still illegal but they aren't going to expend the legal resources and the amount of bad PR to make an example out of you. They may and probably will come after you if you sell or distribute said ROMS.
That's not how it works. What your opinion is or even your lawyer's opinion is just an opinion. Ultimately someone can bring a case in a court and it's decided then. You can advance your legal theory as to why it is allowed, and it may be a sufficient defense, or it may not. There is no a priori certainty in these things... the closest you might get is precedent.
The jocular saying is that, in England, "everything which is not forbidden is allowed", while, in Germany, the opposite applies, so "everything which is not allowed is forbidden". This may be extended to France — "everything is allowed even if it is forbidden" — and Russia where "everything is forbidden, even that which is expressly allowed". While in North Korea it is said that "everything that is not forbidden is compulsory"
I mean, not according to the law... my understanding is that in most jurisdictions ignorant != impervious. Perhaps burden of proof for a discussion is on the claimant, but it might behoove a user to check their local laws
When you play in the browser, you are playing on youtube. when you download, you can play wherever you want. This is similar to saying I'll go record a movie from a cinema hall and watch it later at home since I paid for it.
No it's just a simple, direct assessment of a situation. There is no technical difference between "streaming" or "downloading" the bytes. In each case, the exact same thing happens, the numbers are copied to the local machine. The distinctions are a legal fiction that doesn't actually have a reflection in the real reality, and as most imposed fictions end up, there is very little respect for the idea on the ground.
True, but at the end of streaming, the provider/browser clears the cache. The legality of it is debatable, but downloading copyright material is certainly not legal.
If someone visits me at home and uses my coffee-maker the action is same as taking it to his home and using, but only one of them is acceptable.
I did not say breaking in. That would be equivalent to hacking. If i'm home and I let my friend use my coffee-maker, that is analogous to youtube giving you a license to watch a video.
I apologize for the confusion. I read your original comment to be a comparison between letting someone use your coffee maker (lending) and someone stealing your coffee maker which I believe is how you intended it. My comment was intentionally obtuse and was intended to highlight problems with your metaphor. I do not believe that letting a friend use my coffee maker is analogous to youtube granting me a license to watch a video. For instance, I have no desire to recoup my electricity costs by displaying advertising to my friend while she is making her coffee.
I don't think this is the same thing at all. If someone slides an envelope under my door that says "Please do not open" am I obliged to leave it sealed? What if I open it anyway and the contents advise me to destroy the message, am I obliged to do this?
What if you go to a friend's house (youtube) and see a letter that says do not read. But you whip out your camera phone, take a picture, come home and read?
The discussion is not about what is possible or should be done, it is about what is legal/moral.
When you watch a video on Youtube, you are essentially given a license to watch that content on their site. They show some ads and make some money. When you download, you are violating that license.
Depends on the jurisdiction. Some make a explicit difference, e.g. German law speaks of (rough translation of the critical bits by myself) "temporary reproductions that are [...] integral and necessary part of a technical way of a) transmitting through a network [...]" which in practice means that streaming is ok in cases where explicit saving is not. For private use, downloading from not clearly non-legal streaming sources is fine though (again, in Germany)
I believe streaming vs downloading has slight implication differences. E.g if they choose to shut it off you can't stream anymore. Or force ads or view counts. Yet in downloaded form you are bypassing those things that have value
One problem is that you're not only time shifting but space shifting to digital media as well. And the laws as written are very specific as to what is permitted.
Example: In the US, the AHRA that makes personal space shifting digital audio legal (relevant to the submission) is fairly limited in the media that can be used for copying. Though I agree that they're being used for basically the same thing, computer hard drives aren't covered.
A relevant quote from Wikipedia [1] that sums up why I think this act falls short of its purpose: "In each case, the principal distinction between what is and is not covered by the AHRA is determined by whether or not the device is marketed or designed (or in the case of media, commonly used by consumers) to make audio recordings, not the device's capabilities."
Time shifting means copying for the purpose of listening to the recording at a better time, whereas space shifting is relevant here because the intended purpose is to allow the audio to be played in a different environment (i.e. not the YouTube player or app).
The more important thing is that space shifting to different media (digital, personal computer hard drive in this case) is legally treated differently. Though, to be honest, I'm not convinced that any personal recording protections would or should apply to the YouTube situation. It's just one way that the two differ.
On a similar note. To all those who love to store movies and watch. It's always a pain to decide what to view. I wrote a tool which helps the process - https://github.com/navinsylvester/cinephile . Pip install is broken so try the git one.
Pretty much the same as playbylyrics.com[1], something I made, except you run it yourself. I really like it!
[1] (Note that the site is broken as of a few months.. it never caught on and I'm going to let the domain expire unless someone wants to have it (for free, just tell me what you're going to do with it).)
After a bunch of mess getting it installed on Mac OS X, I get it to find a song, which is a bit of trouble in and of itself, and am then stuck with this error:
sh: youtube-dl: command not found
Yep, this project depends on youtube-dl[1] (which is an awesome tool anyway, so if you don't have it already, you should consider grabbing it regardless).
Cool! But I'm looking at the video and this thing seems it automatically transcodes the audio stream to MP3. Why not just put the highest quality AAC stream available in an M4A container?
[youtube] YfE2-T1r-jw: Downloading video info webpage
[youtube] YfE2-T1r-jw: Extracting video information
[youtube] YfE2-T1r-jw: Downloading DASH manifest
[youtube] YfE2-T1r-jw: Downloading DASH manifest
ERROR: unable to open for writing: [Errno 13] Permission
denied: u'The Ambassador Christology Release Party I Used to be a Thug.mpg 11-22-
99-YfE2-T1r-jw.m4a.part
`play` will instantly play any song (great for parties), and `mp3` will download it: https://github.com/exogen/dotfiles/blob/730fb8e2b72b2fc3aa3d...