@@ -53,7 +53,7 @@ class LyricsCommand : MusicCommand() {
5353 val args = ctx.args
5454
5555 if (args.isNotEmpty()) {
56- // TODO: search with lavalink for lyrics
56+ // TODO: search with lavalink for lyrics?
5757 handleSearch(ctx.argsRaw, ctx.config) {
5858 if (it == null ) {
5959 sendMsg(ctx, " There where no lyrics found for `${ctx.argsRaw} `" )
@@ -75,9 +75,7 @@ class LyricsCommand : MusicCommand() {
7575
7676 loadLyricsFromLavalink(player.link) {
7777 if (it == null ) {
78- // TODO: figure out why the search is not executing.
79- sendMsg(ctx, " There where no lyrics found for `${playingTrack.info.title} `" )
80- /* val searchItem = "${playingTrack.info.title} - ${playingTrack.info.author}"
78+ val searchItem = " ${playingTrack.info.title} - ${playingTrack.info.author} "
8179
8280 handleSearch(searchItem, ctx.config) { embed ->
8381 if (embed == null ) {
@@ -86,7 +84,7 @@ class LyricsCommand : MusicCommand() {
8684 }
8785
8886 sendEmbed(ctx, embed)
89- }*/
87+ }
9088 return @loadLyricsFromLavalink
9189 }
9290
@@ -120,10 +118,7 @@ class LyricsCommand : MusicCommand() {
120118
121119 loadLyricsFromLavalink(player.link) {
122120 if (it == null ) {
123- event.hook.sendMessage(" There where no lyrics found for `${playingTrack.info.title} `" )
124- .queue()
125-
126- /* val searchItem = "${playingTrack.info.title} - ${playingTrack.info.author}"
121+ val searchItem = " ${playingTrack.info.title} - ${playingTrack.info.author} "
127122
128123 handleSearch(searchItem, variables.config) { embed ->
129124 if (embed == null ) {
@@ -133,7 +128,7 @@ class LyricsCommand : MusicCommand() {
133128 }
134129
135130 event.hook.sendMessageEmbeds(embed.build()).queue()
136- }*/
131+ }
137132 return @loadLyricsFromLavalink
138133 }
139134
@@ -146,7 +141,7 @@ class LyricsCommand : MusicCommand() {
146141
147142 val search = opt.asString
148143
149- // TODO: search with lavalink for lyrics
144+ // TODO: search with lavalink for lyrics?
150145 handleSearch(search, variables.config) {
151146 if (it == null ) {
152147 event.hook.sendMessage(" There where no lyrics found for `$search `" ).queue()
@@ -270,7 +265,7 @@ class LyricsCommand : MusicCommand() {
270265 callback(
271266 LyricInfo (
272267 data[" song_art_image_url" ].asText(),
273- " " ,
268+ data[ " full_title " ].asText() ,
274269 data[" url" ].asText(),
275270 " genius.com" ,
276271 lyrics
@@ -282,9 +277,9 @@ class LyricsCommand : MusicCommand() {
282277 }
283278
284279 private fun loadLyrics (path : String , callback : (String? ) -> Unit ) {
285- WebUtils .ins.scrapeWebPage(" https://genius.com/amp $path " ) { it.setRateLimiter(RateLimiter .directLimiter()) }
280+ WebUtils .ins.scrapeWebPage(" https://genius.com$path " ) { it.setRateLimiter(RateLimiter .directLimiter()) }
286281 .async({
287- val lyricsContainer = it.select(" div. lyrics" )
282+ val lyricsContainer = it.select(" div[data- lyrics-container] " )
288283 val text = lyricsContainer.first()!!
289284 .wholeText()
290285 .replace(" <br>" , " \n " )
@@ -293,6 +288,7 @@ class LyricsCommand : MusicCommand() {
293288
294289 callback(text)
295290 }) {
291+ LOGGER .error(" Loading lyrics from genius.com failed!" , it)
296292 callback(null )
297293 }
298294 }
0 commit comments