mirror of
https://git.luna-app.eu/50n50/sources
synced 2025-12-21 21:26:19 +01:00
Add mangafreak/mangafreak.js
This commit is contained in:
parent
3bf6faa7a4
commit
4a15a1c1d0
1 changed files with 86 additions and 0 deletions
86
mangafreak/mangafreak.js
Normal file
86
mangafreak/mangafreak.js
Normal file
|
|
@ -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 = /<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 [];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue