mirror of
https://github.com/beetbox/beets.git
synced 2026-02-26 09:11:32 +01:00
Merge pull request #2634 from anarcat/musixmatch-block-detect
lyrics: detect MusixMatch blocking
This commit is contained in:
commit
c06eca7e58
2 changed files with 14 additions and 1 deletions
|
|
@ -319,9 +319,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('<p class="mxm-lyrics__content')[-1]
|
||||
lyrics = extract_text_between(html_part, '>', '</p>')
|
||||
return lyrics.strip(',"').replace('\\n', '\n')
|
||||
lyrics = lyrics.strip(',"').replace('\\n', '\n')
|
||||
# another odd case: sometimes only that string remains, for
|
||||
# missing songs. this seems to happen after being blocked
|
||||
# above, when filling in the CAPTCHA.
|
||||
if "Instant lyrics for all your music." in lyrics:
|
||||
return
|
||||
return lyrics
|
||||
|
||||
|
||||
class Genius(Backend):
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue