Hello,
Lets start...
First of all find a website that provides an API for converting Youtube videos to audio files
- For that you may find a website with url http://youtubeinmp3.com/
Then, visit that website..Follow their documentation/guide for fetching the mp3 from the video and displaying a download button.
Follow this code format -
<a href='//www.youtubeinmp3.com/fetch/?video=https://www.youtube.com/watch?v=i62Zjga8JOM' style='text-decoration:none;color:#03a730;'><img src='//www.youtubeinmp3.com/icon/folder.png' style='vertical-align:middle;'> <strong>Download MP3</strong></a>
Pass the watch link,through the above url..If the url is correct then a download button named "Download MP3" should get generated
You can find addtional customisations to API below in the website (http://youtubeinmp3.com/)
Note : You can save the fetched data in json,xml or plain text format and then use it later or you can fetch the metadata of the Youtube video and do something more amazing..
PS : Downloading or converting youtube videos maybe illegal..Its just for educational purposes.
This project is available on my github account https://github.com/jayantur13/Youtube_video_to_audio_converter
Regards.