Is there a Youtube API that gives only audio?
Youtube ApiYoutube Api Problem Overview
I've searched for this question several times
Many suggested that 'Get both audio and video. And hide video.' and said that 'there is no audio only API'
But it needs more traffic than when only audio is retrieved if I wanted to listen to music via Youtube.
What makes me confused is, an android app called Firetube provides audio only.
Is this just a trick or does Google provides AUDIO ONLY API?
Youtube Api Solutions
Solution 1 - Youtube Api
YES YOU CAN
Yes, it is certainly possible, here is an API for that:
> https://market.mashape.com/ehmo/savedeo
While it is against YouTube Terms of Service, it is technically possible to hack your way to the audio-only download link, and that's how the API's above work.
The is how I imagine the SaveDeo API does its magic: https://stackoverflow.com/questions/15241076/download-only-audio-from-a-youtube-video
This is what the guy at SaveDeo told me:
> Youtube has audio only files. Savedeo doesn't do anything beyond > providing you with the link. How we're doing this is the reason why > are you using savedeo, isn't it.
Solution 2 - Youtube Api
Regarding the Terms of Service of the YouTube API
https://developers.google.com/youtube/terms/developer-policies
YOU CAN'T :
> separate, isolate, or modify the audio or video components of any > YouTube audiovisual content made available through the YouTube API; > > promote separately the audio or video components of any YouTube > audiovisual content made available through the YouTube API;
Solution 3 - Youtube Api
youtube-dl
This is technically possible and very easy to do with youtube-dl
. Note: this isn't an "api". This isn't supported by Google, and it technically may be against there TOS. I assume if you have access in North Korea, that it's totally legal.
# Download the stream and extract the audio.
youtube-dl -x
# If you just need the url you can use
youtube-dl -x --get-url <URL>
Solution 4 - Youtube Api
Update, because I think no one thought it what that easy. Just read it, if you want to use it for private usage (you know, youtube terms and stuff like that).
After some research work with different APIs and libraries and researching source code, I just tried it by myself and wolla.
Just saying, audio only links are in the page source of each video.
You just have to know what you are looking for ;)
Open a youtube video, view page source and search for "mime%3Daudio". There should be 5 matches, full url for example:
"https%3A%2F%2Fr2---sn-35cxanpbo5a-8pxl.googlevideo.com%2Fvideoplayback%3Fsource%3Dyoutube%26signature%3D30EC556F55533FBFD9003767730D10556681F33A.B12E021CA54CCB9E225F58A4430E9BB528081FB5%26requiressl%3Dyes%26expire%3D1527306011%26clen%3D3064602%26initcwndbps%3D1152500%26ipbits%3D0%26mime%3Daudio%252Fmp4%26dur%3D192.911%26fvip%3D5%26lmt%3D1524946334873350%26key%3Dyt6%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Ckeepalive%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Crequiressl%252Csource%252Cexpire%26itag%3D140%26gir%3Dyes%26ip%3D81.217.53.239%26id%3Do-ALNxMeQYw4LLc1FAjxt4h795wKTdqJnzc_SBgzEJVBxR%26c%3DWEB%26keepalive%3Dyes%26mm%3D31%252C29%26mn%3Dsn-35cxanpbo5a-8pxl%252Csn-2gb7sn7r%26ei%3Du4IIW7DfC46rgAfrrpnICw%26ms%3Dau%252Crdu%26mt%3D1527284230%26pl%3D16%26mv%3Dm"
Just decode URL and you got what you want.
Solution 5 - Youtube Api
Well, I know its an old thread but still i'm posting my answer because its still unanswered.
I know its against youtube policy to download video but there is a way of downloading youtube video as an audio/mp3 file.
First is: http://api.youtube6download.top These guys will give you an easiest way of converting yt to mp3 by using there HTML LINK, Javascript/iframe widgets.
I have also seen their API listed on mashape link: https://market.mashape.com/CoolGuruji/youtube-to-mp3-download
All you need to enter youtube video id and it will fetch/convert youtube video into audio format.
Its not official an API by youtube itself.
I am using it on my websites it works very well for me.
I hope now this question is actually answered.
Solution 6 - Youtube Api
Use the YouTube MP3 API. The iframe Code generates Download Buttons in various qualities and it´s free and without Ads.
Look also at this Github Link: YouTube-MP3-API @ GitHub
Solution 7 - Youtube Api
I have developed YouTuber little software to extract mp3 from YouTube.
You can clone source code https://github.com/maythamfahmi/YouTuber
Or just use the release version in (cmd) command line for windows https://github.com/maythamfahmi/YouTuber/releases.
> disclaimer: the added github is to my personal repo
Solution 8 - Youtube Api
using loadercdn you can apply for your own API to do the download.