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
|
(let* ((html (with-temp-buffer
|
||||||
(insert data)
|
(insert data)
|
||||||
(libxml-parse-html-region (point-min) (point-max))))
|
(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))
|
||||||
(with-temp-buffer
|
(dom-by-class html (rx bos "Lyrics__Container" (* nonl))))))
|
||||||
(lyrics-fetcher-genius--dom-print lyrics-div)
|
(funcall callback
|
||||||
(shr-render-region (point-min) (point-max))
|
(mapconcat
|
||||||
(funcall callback
|
(lambda (lyrics-div)
|
||||||
(buffer-substring-no-properties
|
(with-temp-buffer
|
||||||
(point-min)
|
(lyrics-fetcher-genius--dom-print lyrics-div)
|
||||||
(point-max)))))))
|
(shr-render-region (point-min) (point-max))
|
||||||
|
(buffer-substring-no-properties
|
||||||
|
(point-min)
|
||||||
|
(point-max))))
|
||||||
|
lyrics-divs
|
||||||
|
"\n")))))
|
||||||
:error
|
:error
|
||||||
(cl-function
|
(cl-function
|
||||||
(lambda (&key error-thrown &allow-other-keys)
|
(lambda (&key error-thrown &allow-other-keys)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue