mirror of
https://git.luna-app.eu/50n50/sources
synced 2025-12-21 13:16:21 +01:00
86 lines
No EOL
2.5 KiB
JavaScript
86 lines
No EOL
2.5 KiB
JavaScript
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 = /<div class="manga_search_item">\s*<h6>\d+\.<\/h6>\s*<span>\s*<a href="([^"]+)"><img src="([^"]+)"><\/a>\s*<\/span>\s*<span>\s*<h3>\s*<a href="[^"]+">([^<]+)<\/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 = /<div class="manga_series_description">\s*<div>Synopsis<\/div>\s*<p>([\s\S]*?)<\/p>/;
|
|
const match = descRegex.exec(html);
|
|
const description = match ? match[1].trim() : "";
|
|
|
|
return {
|
|
description: description,
|
|
tags: []
|
|
};
|
|
} catch (err) {
|
|
return {
|
|
description: "Error",
|
|
tags: []
|
|
};
|
|
}
|
|
}
|
|
|
|
async function getChapters(url) {
|
|
const results = [];
|
|
try {
|
|
const response = await fetch(url);
|
|
const html = await response.text();
|
|
const regex = /<tr>\s*<td><a href="([^"]+)">([^<]+)<\/a><\/td>\s*<td>[^<]+<\/td>\s*<\/tr>/g;
|
|
let match;
|
|
let index = 0;
|
|
|
|
while ((match = regex.exec(html)) !== null) {
|
|
results.push([
|
|
String(index),
|
|
[{
|
|
id: "https://ww2.mangafreak.me" + match[1].trim(),
|
|
chapter: index,
|
|
scanlation_group: match[2].trim()
|
|
}]
|
|
]);
|
|
index++;
|
|
}
|
|
|
|
return { en: results };
|
|
} catch (err) {
|
|
return { en: [] };
|
|
}
|
|
}
|
|
|
|
async function getChapterImages(url) {
|
|
const results = [];
|
|
try {
|
|
const response = await fetch(url);
|
|
const html = await response.text();
|
|
const regex = /<img id="gohere" src="([^"]+)"/g;
|
|
|
|
let match;
|
|
while ((match = regex.exec(html)) !== null) {
|
|
results.push(match[1].trim());
|
|
}
|
|
|
|
return results;
|
|
} catch (err) {
|
|
return [];
|
|
}
|
|
} |