const axios = require('axios');
async function lrclib(title) {
try {
if (!title) throw new Error('Title is required');
const { data } = await axios.get(`https://lrclib.net/api/search?q=${encodeURIComponent(title)}`, {
headers: {
referer: `https://lrclib.net/search/${encodeURIComponent(title)}`,
'user-agent': 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Mobile Safari/537.36'
}
});
return data;
} catch (error) {
throw new Error(error.message);
}
}
lrclib('bunga maaf').then(console.log);