Fix with Genius UI update#17
Conversation
|
Hi I haven't had any issue using the package to fetch lyrics (last used it ~2 months ago). Could you clarify the issue this PR fixes? |
|
Tested again - lyrics fetching is not working at all for me and just returning an empty string. const {lyrics} = await lyricist.song(song_id, {fetchLyrics: true});
console.log(lyrics); // empty stringApplying this patch makes it work again. If I go to a lyrics page on the genius website, It might be possible that this update is not completely rolled out or there's some difference on your system making it return the old version of the page? This PR is much more complex than it needs to be to fix this issue, ideally it could just be |
|
Oh I'm sorry. I just checked the project repo where it worked fine and it was actually Nov 4-5, so a bit more than the 2 months I remembered. Running the code now returns an empty string for lyrics... it must have been a slow rollout(?). Thank you for the PR, I'll take a look at the new layout and see if it can be done a simpler way. |

The lyrics are now shown in two places in the html, once in the thing with the class
.lyricsand once for react preloading or something in a script tag. I would have used the one in the.lyricsdiv but cheerio doesn't seem to have anything similar to html.innerTextthat gets the text content including<br />tags as newlines. There might be an easier way to do this than what I've done.