From 54fc67b30a8ecaa33fe40790a6f277749c9ebc00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Nejus?= Date: Mon, 7 Oct 2024 18:24:22 +0100 Subject: [PATCH] Remove extract_text_between --- beetsplug/lyrics.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/beetsplug/lyrics.py b/beetsplug/lyrics.py index 8bd7f15d3..7adb1bc7e 100644 --- a/beetsplug/lyrics.py +++ b/beetsplug/lyrics.py @@ -127,15 +127,6 @@ def close_session(): # Utilities. -def extract_text_between(html, start_marker, end_marker): - try: - _, html = html.split(start_marker, 1) - html, _ = html.split(end_marker, 1) - except ValueError: - return "" - return html - - def search_pairs(item): """Yield a pairs of artists and titles to search for. @@ -448,7 +439,7 @@ class MusiXmatch(DirectBackend): # Sometimes lyrics come in 2 or more parts lyrics_parts = [] for html_part in html_parts: - lyrics_parts.append(extract_text_between(html_part, ">", "

")) + lyrics_parts.append(re.sub(r"^[^>]+>|

.*", "", html_part)) lyrics = "\n".join(lyrics_parts) lyrics = lyrics.strip(',"').replace("\\n", "\n") # another odd case: sometimes only that string remains, for