const axios = require('axios'); async function aio(url) { try { if (!url || !url.includes('https://')) throw new Error('Url is required'); const { data } = await axios.post('https://auto-download-all-in-one.p.rapidapi.com/v1/social/autolink', { url: url }, { headers: { 'accept-encoding': 'gzip', 'cache-control': 'no-cache', 'content-type': 'application/json; charset=utf-8', referer: 'https://auto-download-all-in-one.p.rapidapi.com/', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 OPR/78.0.4093.184', 'x-rapidapi-host': 'auto-download-all-in-one.p.rapidapi.com', 'x-rapidapi-key': '1dda0d29d3mshc5f2aacec619c44p16f219jsn99a62a516f98' } }); return data; } catch (error) { throw new Error(error.message); } } // Usage: const resp = await aio('https://open.spotify.com/track/3rPtS4nfpy7PsARctAWpzd'); console.log(resp);