diff --git a/mangafreak/mangafreak.js b/mangafreak/mangafreak.js new file mode 100644 index 0000000..65864d4 --- /dev/null +++ b/mangafreak/mangafreak.js @@ -0,0 +1,86 @@ +async function searchContent(keyword, page=0) { + const results = []; + try { + const response = await fetch("https://ww2.mangafreak.me/Find/" + encodeURIComponent(keyword)); + const html = await response.text(); + const regex = /
\s*
\d+\.<\/h6>\s*\s*<\/a>\s*<\/span>\s*\s*

\s*([^<]+)<\/a>\s*<\/h3>/g; + + let match; + while ((match = regex.exec(html)) !== null) { + results.push({ + id: "https://ww2.mangafreak.me" + match[1].trim(), + imageURL: match[2].trim(), + title: match[3].trim() + }); + } + + return results; + } catch (err) { + return []; + } +} + +async function getContentData(url) { + try { + const response = await fetch(url); + const html = await response.text(); + const descRegex = /