From ce7858a60274fc26e8f1976f16683e3cf69fbb4f Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Sat, 14 Aug 2021 11:38:23 +0300 Subject: [PATCH] docs: add comments for genius behavior --- README.org | 2 ++ lyrics-fetcher-genius.el | 3 +++ lyrics-fetcher.el | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.org b/README.org index 0b081db..f403753 100644 --- a/README.org +++ b/README.org @@ -94,3 +94,5 @@ The album cover fetching is similar. The corresponding function is set in ~lyric - =sync= - as above. The first argument is =track= because in EMMS all the required information is stored in tracks, and album data is deduced from tracks. So this package just takes a sample track in the album. +* Troubleshooting +I've noticed that Genius can give pages with different DOMs to different people. If you have an empty buffer instead of lyrics, please attach the =curl-cookie-jar= file to the issue. It usually resides in =.emacs.d/request=. diff --git a/lyrics-fetcher-genius.el b/lyrics-fetcher-genius.el index fae93fe..df10e02 100644 --- a/lyrics-fetcher-genius.el +++ b/lyrics-fetcher-genius.el @@ -236,6 +236,9 @@ 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)))) + ;; Apparently, Genius can give different + ;; responses to different people based on + ;; cookies. (lyrics-divs (or (dom-by-class html (rx bos "lyrics" eos)) (dom-by-class html (rx bos "Lyrics__Container" (* nonl)))))) (funcall callback diff --git a/lyrics-fetcher.el b/lyrics-fetcher.el index cdb07db..bf06374 100644 --- a/lyrics-fetcher.el +++ b/lyrics-fetcher.el @@ -5,7 +5,7 @@ ;; Author: Korytov Pavel ;; Maintainer: Korytov Pavel -;; Version: 0.1.2 +;; Version: 0.1.3 ;; Package-Requires: ((emacs "27") (emms "7.5") (f "0.20.0") (request "0.3.2")) ;; Homepage: https://github.com/SqrtMinusOne/lyrics-fetcher.el