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] 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('