From 4cfb1e30bd6713b8d6984a0b010581e8f5ad4d3f Mon Sep 17 00:00:00 2001 From: midriasi Date: Wed, 31 Dec 2025 10:59:12 +0200 Subject: [PATCH] set encoding to None for non-genius backends --- beetsplug/lyrics.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/beetsplug/lyrics.py b/beetsplug/lyrics.py index c00258415..cd73f021d 100644 --- a/beetsplug/lyrics.py +++ b/beetsplug/lyrics.py @@ -198,15 +198,16 @@ class LyricsRequestHandler(RequestHandler): ) -> str: """Return text / HTML data from the given URL. - By default, trust the server's encoding and requests' apparent_encoding - detection. When force_utf8=True, default to UTF-8 if server doesn't - specify encoding (avoids MacRoman misdetection on some sites like Genius). + Set encoding to None to let requests auto-detect (works for most sites). + For Genius, force UTF-8 to avoid MacRoman misdetection. """ url = self.format_url(url, params) self.debug("Fetching HTML from {}", url) r = self.get(url, **kwargs) if force_utf8: r.encoding = r.encoding or "utf-8" + else: + r.encoding = None return r.text def get_json(self, url: str, params: JSONDict | None = None, **kwargs):