From 5e8d17a4fcd735075d526ffd07e4d47677908285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Mon, 17 Jul 2017 12:21:55 -0400 Subject: [PATCH 1/2] lyrics: detect MusixMatch blocking we just look for the bad string in the HTML. this has the downside that we may consider songs that have those exact lyrics (you never know, really) may trigger this warning as well and we would fail to fetch those songs. we also fail if lyrics contain another magic string that seems to come up when you do fill in the CAPTCHA after being blocked. --- beetsplug/lyrics.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/beetsplug/lyrics.py b/beetsplug/lyrics.py index 57265a469..cc8de9f1d 100644 --- a/beetsplug/lyrics.py +++ b/beetsplug/lyrics.py @@ -301,9 +301,19 @@ class MusiXmatch(SymbolsReplaced): html = self.fetch_url(url) if not html: return + if "We detected that your IP is blocked" in html: + self._log.warning(u'we are blocked at MusixMatch: url %s failed' + % url) + return html_part = html.split('

Date: Tue, 18 Jul 2017 16:36:40 -0400 Subject: [PATCH 2/2] add changelog entry for #2634 --- docs/changelog.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index e30080f49..d94260906 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -14,6 +14,9 @@ Fixes: * :doc:`/plugins/replaygain`: Fix a regression in the previous release related to the new R128 tags. :bug:`2615` :bug:`2623` +* :doc:`/plugins/lyrics`: The MusixMatch backend now detect and warns + the user when blocked on the server. Thanks to + :user:`anarcat`. :bug:`2634` :bug:`2632` For developers: