diff --git a/animeweek/animeweek.js b/animeweek/animeweek.js new file mode 100644 index 0000000..d4954da --- /dev/null +++ b/animeweek/animeweek.js @@ -0,0 +1,107 @@ + +async function searchResults(keyword) { + const results = []; + try { + const response = await fetchv2("https://aniweek.com/bbs/search.php?srows=240&gr_id=&sfl=wr_subject&stx=" + encodeURIComponent(keyword)); + const html = await response.text(); + const regex = /
[\s\S]*?
([\s\S]*?)<\/div><\/div>/; + + let description = "N/A"; + const match = regex.exec(html); + if (match) { + description = match[1].replace(/
/g, "\n").replace(/ /g, " ").replace(/<[^>]*>/g, "").replace(/\n\n+/g, "\n").trim(); + } + + return JSON.stringify([{ + description: description, + aliases: "N/A", + airdate: "N/A" + }]); + } catch (err) { + return JSON.stringify([{ + description: "Error", + aliases: "Error", + airdate: "Error" + }]); + } +} + +async function extractEpisodes(url) { + const results = []; + try { + const response = await fetchv2(url); + const html = await response.text(); + const regex = /
  • [\s\S]*?