Update audible/audible.js

This commit is contained in:
aka paul 2025-11-27 21:03:23 +00:00
parent eda07e6430
commit 08ad0ca92f

View file

@ -25,8 +25,20 @@ async function searchResults(keyword) {
if (data.books && Array.isArray(data.books)) {
foundBooks = true;
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({
title: book.title || "Untitled",
title: title,
image: book.image || "",
href: "https://mapple.site/listen/" + (book.$id || "") + "/" + encodeURIComponent(book.title || "untitled")
});