LyricsGenius icon indicating copy to clipboard operation
LyricsGenius copied to clipboard

[fix] fix for extra text at last line of lyrics

Open gautamajay52 opened this issue 3 years ago β€’ 10 comments

Most of the times the last line of lyrics has EmbedShare Url:CopyEmbed:Copy as extra words.

gautamajay52 avatar Jun 29 '21 15:06 gautamajay52

Hi @gautamajay52, could you provide a couple of examples of lyrics returning those extra words? Thanks!

johnwmillr avatar Jun 29 '21 18:06 johnwmillr

Hi @gautamajay52, could you provide a couple of examples of lyrics returning those extra words? Thanks!

I am not getting in all songs. I am integrating this with Spotify to get the current playing lyrics.

Here is HTMl that I used to get when that text appear for me while testing.

But on requesting again sometimes it doesn't appear. So it is random, but I have noticed it with a lot of songs.

gautamajay52 avatar Jun 29 '21 20:06 gautamajay52

Hi @gautamajay52, could you provide a couple of examples of lyrics returning those extra words? Thanks!

Here is another HTML I just got again while testing.

Sir you can find the name of song in this html.

edit: html of same song when I don't get that extra text.

gautamajay52 avatar Jun 29 '21 20:06 gautamajay52

Hi @gautamajay52, could you provide a couple of examples of lyrics returning those extra words? Thanks!

Sir ! Are you able to reproduce the error? Do I have to provide any other details?

gautamajay52 avatar Jul 01 '21 06:07 gautamajay52

I seem to be having this issue as well with songs such as "Say So" and "Kiss Me More" by Doja Cat.

jam0ra avatar Jul 22 '21 03:07 jam0ra

@johnwmillr I seem to be having this issue as well with songs such as "Say So" and "Kiss Me More" by Doja Cat.

Hey, Have you tried this fix ?

gautamajay52 avatar Jul 22 '21 04:07 gautamajay52

@gautamajay52 Yup seems to work fine so far!

jam0ra avatar Jul 22 '21 04:07 jam0ra

@gautamajay52 Yup seems to work fine so far!

Actually, I was getting in almost all songs after doing multiple requests on the same song. Thanks for your review.

gautamajay52 avatar Jul 22 '21 04:07 gautamajay52

There also appears to be extra header text prepended to the first line, too. When getting the div on line 137, this is what is outputted. Line one has the extra text "Mood Lyrics" in an h2 element.

Changing the pull request to this would fix both the original and this issue:

else:
    rem = div.find("div", class_=re.compile("Lyrics__Footer"))
    if rem:
        rem.replace_with("")
        
    header = div.find("h2", class_=re.compile("TextLabel"))
    if header:
        header.replace_with("")

iiKurt avatar Mar 30 '22 22:03 iiKurt

There also appears to be extra header text prepended to the first line, too. When getting the div on line 137, this is what is outputted. Line one has the extra text "Mood Lyrics" in an h2 element.

Changing the pull request to this would fix both the original and this issue:

else:
    rem = div.find("div", class_=re.compile("Lyrics__Footer"))
    if rem:
        rem.replace_with("")
        
    header = div.find("h2", class_=re.compile("TextLabel"))
    if header:
        header.replace_with("")

Some songs with translated lyrics also have some extra text at the beginning. I solved it with:

else:
    rem = div.find("div", class_=re.compile("Lyrics__Footer"))
    if rem:
        rem.replace_with("")

    header = div.find("h2", class_=re.compile("TextLabel"))
    if header:
        header.replace_with("")

    controls = div.find("div", class_=re.compile("LyricsControls"))
    if controls:
        controls.replace_with("")

Acervans avatar Jan 21 '23 00:01 Acervans