mirror of
https://github.com/SqrtMinusOne/lyrics-fetcher.el.git
synced 2025-12-10 17:03:03 +03:00
fix: add fallback DOM queries for lyrics-fetcher-genius
This commit is contained in:
parent
87a99f328b
commit
12175e6965
1 changed files with 13 additions and 8 deletions
|
|
@ -236,14 +236,19 @@ If SYNC is non-nil, the request will be performed synchronously."
|
|||
(let* ((html (with-temp-buffer
|
||||
(insert data)
|
||||
(libxml-parse-html-region (point-min) (point-max))))
|
||||
(lyrics-div (dom-by-class html (rx bos "lyrics" eos))))
|
||||
(lyrics-divs (or (dom-by-class html (rx bos "lyrics" eos))
|
||||
(dom-by-class html (rx bos "Lyrics__Container" (* nonl))))))
|
||||
(funcall callback
|
||||
(mapconcat
|
||||
(lambda (lyrics-div)
|
||||
(with-temp-buffer
|
||||
(lyrics-fetcher-genius--dom-print lyrics-div)
|
||||
(shr-render-region (point-min) (point-max))
|
||||
(funcall callback
|
||||
(buffer-substring-no-properties
|
||||
(point-min)
|
||||
(point-max)))))))
|
||||
(point-max))))
|
||||
lyrics-divs
|
||||
"\n")))))
|
||||
:error
|
||||
(cl-function
|
||||
(lambda (&key error-thrown &allow-other-keys)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue