zohlathu 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +13 -2
- package/package.json +1 -1
- package/test.js +0 -28
package/index.js
CHANGED
|
@@ -64,9 +64,20 @@ async function get_lyrics(query) {
|
|
|
64
64
|
let cleaned_content = htmlToText(lyricsHtmlOnly, {
|
|
65
65
|
wordwrap: false,
|
|
66
66
|
preserveNewlines: true,
|
|
67
|
+
formatters: {
|
|
68
|
+
'lineBreak': (el, walk, options) => {
|
|
69
|
+
return '\n';
|
|
70
|
+
}
|
|
71
|
+
},
|
|
67
72
|
selectors: [
|
|
68
|
-
{
|
|
69
|
-
|
|
73
|
+
{
|
|
74
|
+
selector: 'p',
|
|
75
|
+
options: {
|
|
76
|
+
leadingLineBreaks: 0,
|
|
77
|
+
trailingLineBreaks: 2
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{ selector: 'br', format: 'lineBreak' },
|
|
70
81
|
{ selector: 'a', options: { ignoreHref: true } },
|
|
71
82
|
{ selector: 'img', format: 'skip' }
|
|
72
83
|
]
|
package/package.json
CHANGED
package/test.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const { get_lyrics } = require('./index.js');
|
|
2
|
-
|
|
3
|
-
async function runTest() {
|
|
4
|
-
console.log("Hla thu kan zawng mek e, lo nghak lawk rawh...");
|
|
5
|
-
|
|
6
|
-
// I hla zawn duh chu hetah hian i thlak thei ang
|
|
7
|
-
const songToSearch = "Tawngmang lasi";
|
|
8
|
-
|
|
9
|
-
try {
|
|
10
|
-
const result = await get_lyrics(songToSearch);
|
|
11
|
-
|
|
12
|
-
if (result) {
|
|
13
|
-
console.log("\n✅ HLA HMUH A NI!");
|
|
14
|
-
console.log("----------------------------------");
|
|
15
|
-
console.log("Hla Hming :", result.title);
|
|
16
|
-
console.log("Link :", result.source_url);
|
|
17
|
-
console.log("----------------------------------");
|
|
18
|
-
console.log(result.lyrics);
|
|
19
|
-
console.log("----------------------------------");
|
|
20
|
-
} else {
|
|
21
|
-
console.log("\n❌ Pawi lutuk, he hla hi hmuh a ni lo.");
|
|
22
|
-
}
|
|
23
|
-
} catch (error) {
|
|
24
|
-
console.error("Harsatna a awm:", error);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
runTest();
|