forked from 50n50/sources
Update audible/audible.js
This commit is contained in:
+13
-1
@@ -25,8 +25,20 @@ async function searchResults(keyword) {
|
|||||||
if (data.books && Array.isArray(data.books)) {
|
if (data.books && Array.isArray(data.books)) {
|
||||||
foundBooks = true;
|
foundBooks = true;
|
||||||
for (const book of data.books) {
|
for (const book of data.books) {
|
||||||
|
let title = book.title || "Untitled";
|
||||||
|
title = title.replace(/\s+free\s+online\s*$/i, '')
|
||||||
|
.replace(/\s+audiobook\s+free\s+online\s*$/i, '')
|
||||||
|
.replace(/\s+audiobook\s+free\s*$/i, '')
|
||||||
|
.replace(/\s+free\s+audiobook\s*$/i, '')
|
||||||
|
.replace(/\s+free\s*$/i, '')
|
||||||
|
.replace(/\s+\(free\s*\)\s*$/i, '')
|
||||||
|
.replace(/\s+free\s+read\s+/i, ' read ')
|
||||||
|
.replace(/\s+\(.*?free.*?\)\s*$/i, '')
|
||||||
|
.replace(/\s+audiobook\s*$/i, '')
|
||||||
|
.trim();
|
||||||
|
|
||||||
results.push({
|
results.push({
|
||||||
title: book.title || "Untitled",
|
title: title,
|
||||||
image: book.image || "",
|
image: book.image || "",
|
||||||
href: "https://mapple.site/listen/" + (book.$id || "") + "/" + encodeURIComponent(book.title || "untitled")
|
href: "https://mapple.site/listen/" + (book.$id || "") + "/" + encodeURIComponent(book.title || "untitled")
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user