Version 2.0.1 - Changement de l'API des Lyrics
This commit is contained in:
@ -19,8 +19,8 @@ const markdownit = require("markdown-it")({
|
||||
typographer: true
|
||||
})
|
||||
|
||||
const Genius = require("genius-lyrics");
|
||||
const GClient = new Genius.Client("OHOV9c0B4uuyfWTK2w2YRliC9iyPjjF2Kk6ijCtZ2RtqfkZ2JpntnO2fwraF1A5h");
|
||||
const Lyrics = require('song-lyrics-api');
|
||||
const lyrics = new Lyrics();
|
||||
|
||||
module.exports.WebServer = class {
|
||||
|
||||
@ -479,26 +479,13 @@ function IOConnection(io) {
|
||||
})
|
||||
|
||||
PostRequest("LYRICS", async (data) => {
|
||||
const searches = await GClient.songs.search(data);
|
||||
|
||||
if(!searches) {
|
||||
lyrics.getLyrics(data)
|
||||
.then((response) => {
|
||||
PostAnswer("LYRICS", response[0].lyrics)
|
||||
})
|
||||
.catch((error) => {
|
||||
PostAnswer("LYRICS", null)
|
||||
return
|
||||
}
|
||||
const firstSong = searches[0];
|
||||
if(!firstSong) {
|
||||
PostAnswer("LYRICS", null)
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
const lyrics = await firstSong.lyrics();
|
||||
if(!lyrics) {
|
||||
PostAnswer("LYRICS", null)
|
||||
return
|
||||
}
|
||||
|
||||
PostAnswer("LYRICS", lyrics)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user