LyricsGenius
LyricsGenius copied to clipboard
fix ads and other unwanted content in lyrics
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.
But it removes the new line for ads
block:
@xathon so maybe instead of
decompose
we can use replaceWith('\n')
for ads
?
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.
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 anyone tell, is this patch still working?
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
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)
Fixes #265