“I need know how can I use API of the youtubeinmp3… Can you give me an example?”
The API link you provided is the manual with example. Scroll down to Direct Links section an read that for reference (the fetch
part of URL gives you the MP3 data). You simply access your link as:
https://www.youtubeinmp3.com/fetch/?video=https://www.youtube.com/watch?v=12345
where you replace the 12345
with actual video ID for required video (eg: iOWamCtnwTc
). Example :
https://www.youtubeinmp3.com/fetch/?video=https://www.youtube.com/watch?v=iOWamCtnwTc
And it will return the bytes of mp3 (in desktop browser testing this will begin downloading to hard drive). So in Android you simply receive the bytes to a ByteArray
and then save those bytes as file in your storage location.
You can check some tutorials like Download from Internet and save to SD but actually any tutorial about saving file from internet (whether image or MP3 or whatever) can be adjusted to instead use your the API link as download source.
solved How can I use youtubeinmp3 in my app?