LyricsGenius icon indicating copy to clipboard operation
LyricsGenius copied to clipboard

fix ads and other unwanted content in lyrics

Open xathon opened this issue 9 months ago • 7 comments

This PR not only contains a fix for the embed string in the end of the lyrics, but also the ticket ads and contributor numbers that have shown up in my scrapes.

xathon avatar May 05 '24 15:05 xathon

But it removes the new line for ads block: Снимок экрана 2024-05-10 в 19 20 27 @xathon so maybe instead of decompose we can use replaceWith('\n') for ads?

vinchilive avatar May 10 '24 07:05 vinchilive

Ah, good catch. I was using the function to remove the markers, so didn't see that. I'll be back home on Monday, I can put that in then.

xathon avatar May 10 '24 09:05 xathon

Its not perfect either so I ended up using lyrics = re.sub(r"(?<!\n)\n(\[)", r"\n\n\1", lyrics) to add missing newlines before [blocks] :)

vinchilive avatar May 11 '24 09:05 vinchilive

Can anyone tell, is this patch still working?

prono69 avatar Sep 21 '24 05:09 prono69

Its not perfect either so I ended up using lyrics = re.sub(r"(?<!\n)\n(\[)", r"\n\n\1", lyrics) to add missing newlines before [blocks] :)

Can you explain, where u used this . I mean can you tell me the line number

prono69 avatar Sep 21 '24 05:09 prono69

Can you explain, where u used this . I mean can you tell me the line number

hey @prono69, I used it to format the output of the search_song function

song = genius.search_song(title, artist)
rawLyrics = song.lyrics if song != None else ""
lyrics = re.sub(r"(?<!\n)\n(\[)", r"\n\n\1", rawLyrics)

vinchilive avatar Sep 23 '24 03:09 vinchilive

Fixes #265

DLu avatar Oct 15 '24 01:10 DLu