Remove unnecessary sections from Genius lyrics (#1154)

* remove unnecessary sections in genius lyrics

* made variable names camelCase

* used title instead of full title
This commit is contained in:
angelolz 2025-10-22 19:28:49 -06:00 committed by GitHub
parent ce1d37479c
commit 947cad451c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -109,8 +109,11 @@ export async function getLyricsBySongId(url: string): Promise<null | string> {
if (lyricsDiv.length > 0) return lyricsDiv.text().trim(); if (lyricsDiv.length > 0) return lyricsDiv.text().trim();
const lyricSections = $('div[class^=Lyrics__Container]') const lyricSections = $('div[data-lyrics-container="true"]')
.map((_, e) => $(e).text()) .map((_, e) => {
$(e).find('[data-exclude-from-selection="true"]').remove();
return $(e).text();
})
.toArray() .toArray()
.join('\n'); .join('\n');
return lyricSections; return lyricSections;
@ -204,7 +207,7 @@ async function getSongId(
return { return {
artist: hit.artist_names, artist: hit.artist_names,
id: hit.url, id: hit.url,
name: hit.full_title, name: hit.title,
source: LyricSource.GENIUS, source: LyricSource.GENIUS,
}; };
} }