Created
June 1, 2024 05:19
-
-
Save creuserr/28f9bdc3da7d5309dbb150d77a6a96e6 to your computer and use it in GitHub Desktop.
cloudcre: index.js template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getAudio(name, artist) { | |
// Place your audio API deployment here | |
const domain = "your-deployment.vercel.app"; | |
// If you want to change the piped instance, | |
// go to https://github.com/TeamPiped/Piped/wiki/Instances | |
// and find a domain | |
const pipe = "ngn.tf"; | |
const f = await fetch(`https://pipedapi.${pipe}/search?q=${encodeURIComponent(`${name} ${artist}`)}&filter=music_songs`); | |
const res = await f.json(); | |
const id = res.items[0].url.substr(9, res.items[0].url.length); | |
return `https://${domain}/${id}/${name.trim().replaceAll(" ", "-")}.mp3`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment