Skip to content

Commit 1e88d51

Browse files
Eithoomr687
andauthored
fixed AZLyrics empty lyrics string error (#18)
* fixed AZLyrics empty lyrics string error * Update package.json * Update package.json Co-authored-by: Davi Nomoeh Dani <davinomoehdanino@gmail.com>
1 parent df2bb13 commit 1e88d51

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "songlyrics",
3-
"version": "2.4.3",
3+
"version": "2.4.4",
44
"description": "Find a lyrics just enter the song title",
55
"keywords": [
66
"lyrics",

src/sources/azlyrics.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ import { HTMLElement } from 'node-html-parser'
33
export const azlyrics = {
44
name: 'AZLyrics',
55
parse: (html: HTMLElement): Promise<string> => {
6-
const content = html
6+
let possibleContent = html
77
.querySelector('div.ringtone')
8-
?.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling.textContent.trim()
8+
?.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling
9+
if (html.querySelector('span.feat'))
10+
possibleContent = possibleContent?.nextElementSibling.nextElementSibling
11+
const content = possibleContent?.textContent.trim()
912
return Promise.resolve(`${content}`)
1013
},
11-
}
14+
}

0 commit comments

Comments
 (0)