Added search song genius API

This commit is contained in:
2020-12-17 22:26:43 +01:00
parent f98437335c
commit 797940993f
4 changed files with 184 additions and 0 deletions

18
genius.js Normal file
View File

@@ -0,0 +1,18 @@
const axios = require("axios");
const config = require("./config/config.json");
class Genius {
async search_song(q, callback) {
axios({
method: "get",
url: "https://api.genius.com/search?q=" + q,
headers: {'Authorization': 'Bearer ' + config["genius-token"]}
}).then(response => {
return callback(response.data.response.hits[0]);
}).catch(err => {
console.error(err);
})
}
}
module.exports = new Genius();