deezer-node
Version:
Deezer platformundan API Key olmadan bilgiler çekebilmenizi sağlar.
28 lines (24 loc) • 1.04 kB
JavaScript
const fetch = require("axios").default;
const { url } = require("../config.json");
require("../prototypes/turkishToEnglish.js");
module.exports = async(search) => {
const res = await fetch(url+""+encodeURI(search.turkishToEnglish())).catch(err => { return undefined; });
if(!res) return;
const data = res?.data?.data;
const song = data?.[0];
return (
(song?.title) ? {
name: song?.title,
id: song?.id,
image: song?.album?.cover,
visit: song?.link,
duration: (song?.duration * 1000),
list: song?.rank,
preview: song?.preview,
explicitLyrics: song?.explicit_lyrics,
artist: { name: song?.artist?.name, id: song?.artist.id, image: song?.artist?.picture, tracks: song?.artist?.tracklist },
album: { name: song?.album?.title, id: song?.album?.id, image: song?.album?.cover, tracks: song?.album?.tracks},
type: song?.type
} : undefined
);
}