321 points · by yask123 · 11y ago · 134 comments
`play` will instantly play any song (great for parties), and `mp3` will download it: https://github.com/exogen/dotfiles/blob/730fb8e2b72b2fc3aa3d...
If the first result for your search isn't the song you want, I usually append "hq", "hd", or "album version".
youtube-dl: error: no such option: --youtube-skip-dash-manifest
As an error, am I missing something? response = urlopen('https://www.youtube.com/results?search_query=' + search)
command = 'youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 ' + video_link
Amazing how useful of a tool you can make with such little code. There is really some great libraries available today. 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.>"bestaudio[ext=m4a]"
(First time I've ever used it but it wouldn't work for me without the quotes)
# Youtube-dl is a proof that god exists.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).
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.
I'm curious, did you blind test yourself? I blind tested a friend of mine who kept saying so, and he did barely better than random.
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.
https://en.wikipedia.org/wiki/Compact_Disc_Digital_Audio#Dat...
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.
This website can help you compare the bit rates and see if you can hear the difference. http://www.npr.org/sections/therecord/2015/06/02/411473508/h...
Sure looks a lot more productive to the boss than searching for your next track on YouTube. :)
A few people ask for music. They could have shazaamed it, but they don't.
It would also be great if I could pipe in the search and bypass confirmation, e.g:
> echo hide your love away | instantmusic -f
I haven't updated the package as yet.
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')])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 think it'd be nice to have a SoundHound/Shazam-style audio fingerprint downloader too: then you can either repeat lyrics, or get a quick soundbyte!
probably wouldn't be too hard, depending on what's available for voice recognition libs in Python; I haven't actually looked. Anyone know?
My testing env : Windows 8.1, MSYS2, Python 3. It's working flawlessly even with some obscur foreign/french lyrics/song/group.
I'm impressed. :)
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).
> 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.
[1] https://en.wikipedia.org/wiki/Web_scraping#Legal_issues
[2] https://www.youtube.com/t/terms
[3] https://www.techdirt.com/articles/20110208/01511613004/is-do...
It's about as illegal as violating a TOS.
The EFF's interpretation of the TPP makes it also seem like for any member country, it could also be liable for criminal penalties.
IANAL
...which in the US, due to the joy that is the CFAA, is pretty illegal and could result in jail time.
https://ilt.eff.org/index.php/Computer_Fraud_and_Abuse_Act_%...
Also, because everything which is not forbidden is allowed, one would need to show that youtube-dl is illegal, and not that youtube-dl is not illegal.
if it was illegal why would it still exist publicly?
if something was illegal you bet your ass the USG will take it down.
[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).)
This was sufficient for me on OS X 10.10.5:
pip install instantmusic
brew install ffmpeg
instantmusic
> ...some lyrics...
afplay foo.mp3$ instantmusic
Enter songname/ lyrics/ artist.. or whatever
> used to be a thug
Making a Query Request!
Found: The Ambassador Christology Release Party I Used to be a Thug.mpg 11-22-99
Download song (y/n)? y
Downloading...
[generic] watch?v=YfE2-T1r-jw: Requesting header
[redirect] Following redirect to
https://www.youtube.com/watch?v=YfE2-T1r-jw
[youtube] YfE2-T1r-jw: Downloading webpage
[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