From 4ecc55e778d66f69beb1c27f19bdfc3541a0de5e Mon Sep 17 00:00:00 2001 From: aka paul <50n50@noreply.localhost> Date: Fri, 9 Jan 2026 21:10:52 +0000 Subject: [PATCH] Add weebcentral/weebcentral.js --- weebcentral/weebcentral.js | 116 +++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 weebcentral/weebcentral.js diff --git a/weebcentral/weebcentral.js b/weebcentral/weebcentral.js new file mode 100644 index 0000000..6362c90 --- /dev/null +++ b/weebcentral/weebcentral.js @@ -0,0 +1,116 @@ +async function searchContent(keyword, page=0) { + const results = []; + try { + const headers = { + "Content-Type": "application/x-www-form-urlencoded" + }; + const postData = `text=${encodeURIComponent(keyword)}`; + + const response = await fetch(`https://weebcentral.com/search/simple?location=main`, { + method: "POST", + headers: headers, + body: postData + }); + + const html = await response.text(); + const regex = /]*>[\s\S]*?]*>[\s\S]*?
([^<]+)<\/div>/g; + + let match; + while ((match = regex.exec(html)) !== null) { + results.push({ + id: match[1].trim(), + imageURL: match[2].trim(), + title: match[3].trim().replace(/'/g, "'") + }); + } + + return results; + } catch (err) { + return []; + } +} + +async function getContentData(url) { + try { + const response = await fetch(url); + const html = await response.text(); + + const descMatch = html.match(/Description<\/strong>\s*

([\s\S]*?)<\/p>/); + const description = descMatch ? descMatch[1].trim().replace(/'/g, "'") : ""; + + const tagsMatch = html.match(/Associated Name\(s\)<\/strong>\s*