This commit is contained in:
kodjomoustapha
2023-10-09 16:01:14 +01:00
parent c2c22677e0
commit b9d4bedcfb
7 changed files with 78 additions and 64 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

File diff suppressed because one or more lines are too long

View File

@@ -59,6 +59,7 @@ getPopularManga(MangaModel manga) async {
"sourceId": manga.sourceId, "sourceId": manga.sourceId,
"body": body "body": body
}; };
res = await MBridge.http('POST', json.encode(data)); res = await MBridge.http('POST', json.encode(data));
} else { } else {
final newEndpointUrl = "${manga.apiUrl}/query"; final newEndpointUrl = "${manga.apiUrl}/query";
@@ -80,7 +81,6 @@ getPopularManga(MangaModel manga) async {
}; };
print("sssssssssssssssssssss"); print("sssssssssssssssssssss");
res = await MBridge.http('GET', json.encode(newEndpointData)); res = await MBridge.http('GET', json.encode(newEndpointData));
print(res);
} }
if (res.isEmpty) { if (res.isEmpty) {
return manga; return manga;
@@ -136,8 +136,7 @@ getLatestUpdatesManga(MangaModel manga) async {
} }
getMangaDetail(MangaModel manga) async { getMangaDetail(MangaModel manga) async {
String currentSlug = manga.link.split('/').last; String currentSlug = MBridge.substringAfterLast(manga.link, "/");
final headers = getHeader(manga.baseUrl); final headers = getHeader(manga.baseUrl);
final url = "${manga.apiUrl}/series/$currentSlug"; final url = "${manga.apiUrl}/series/$currentSlug";
final data = {"url": url, "headers": headers}; final data = {"url": url, "headers": headers};
@@ -145,31 +144,39 @@ getMangaDetail(MangaModel manga) async {
if (res.isEmpty) { if (res.isEmpty) {
return manga; return manga;
} }
print(res);
manga.author = MBridge.getMapValue(res, "author"); manga.author = MBridge.getMapValue(res, "author");
manga.description = MBridge.getMapValue(res, "description"); manga.description = MBridge.getMapValue(res, "description");
manga.genre = manga.genre =
MBridge.jsonPathToString(res, r"$.tags[*].name", "._").split("._"); MBridge.jsonPathToString(res, r"$.tags[*].name", "._").split("._");
var chapters = [];
if (!useNewQueryEndpoint(manga.source)) {
chapters = json.decode(res)["chapters"];
} else {
final seasons = json.decode(res)["seasons"].first;
chapters = seasons["chapters"];
}
List<String> chapterTitles = []; List<String> chapterTitles = [];
List<String> chapterUrls = []; List<String> chapterUrls = [];
List<String> chapterDates = []; List<String> chapterDates = [];
for (var chapter in chapters) {
final chapterName = chapter["chapter_name"]; if (!useNewQueryEndpoint(manga.source)) {
final chapterSlug = chapter["chapter_slug"]; for (var chapter in json.decode(res)["chapters"]) {
final chapterId = chapter["id"]; final chapterName = chapter["chapter_name"];
final createdAt = chapter["created_at"]; final chapterSlug = chapter["chapter_slug"];
chapterUrls.add("/series/$currentSlug/$chapterSlug#$chapterId"); final chapterId = chapter["id"];
chapterTitles.add(chapterName); final createdAt = chapter["created_at"];
chapterDates.add(createdAt); chapterUrls.add("/series/$currentSlug/$chapterSlug#$chapterId");
chapterTitles.add(chapterName);
chapterDates.add(createdAt);
}
} else {
final seasons = json.decode(res)["seasons"].first;
for (var chapter in seasons["chapters"]) {
final chapterName = chapter["chapter_name"];
final chapterSlug = chapter["chapter_slug"];
final chapterId = chapter["id"];
final createdAt = chapter["created_at"];
chapterUrls.add("/series/$currentSlug/$chapterSlug#$chapterId");
chapterTitles.add(chapterName);
chapterDates.add(createdAt);
}
} }
if (!useNewQueryEndpoint(manga.source)) { if (!useNewQueryEndpoint(manga.source)) {
manga.urls = chapterUrls.reversed.toList(); manga.urls = chapterUrls.reversed.toList();
manga.names = chapterTitles.reversed.toList(); manga.names = chapterTitles.reversed.toList();
@@ -244,31 +251,41 @@ bool useNewQueryEndpoint(String sourceName) {
} }
bool useslugStrategy(String sourceName) { bool useslugStrategy(String sourceName) {
List<String> sources = ["YugenMangas", "Reaper Scans"]; List<String> sources = ["YugenMangas", "Reaper Scans", "Perf Scan"];
return sources.contains(sourceName); return sources.contains(sourceName);
} }
MangaModel mangaModelRes(String res, MangaModel manga) { MangaModel mangaModelRes(String res, MangaModel manga) {
var jsonList = [];
List<String> names = []; List<String> names = [];
List<String> urls = []; List<String> urls = [];
List<String> images = []; List<String> images = [];
if (res.startsWith("{")) { if (res.startsWith("{")) {
jsonList = json.decode(res)["data"]; for (var a in json.decode(res)["data"]) {
} else { String thumbnail = a["thumbnail"];
jsonList = json.decode(res); if (thumbnail.startsWith("https://")) {
} images.add(thumbnail);
for (var a in jsonList) { } else {
String thumbnail = a["thumbnail"]; images.add("${manga.apiUrl}/cover/$thumbnail");
if (thumbnail.startsWith("https://")) { }
images.add(thumbnail); names.add(a["title"]);
} else { final seriesSlug = MBridge.regExp(a["series_slug"], "-\\d+", "", 0, 0);
images.add("${manga.apiUrl}/cover/$thumbnail"); urls.add("/series/$seriesSlug");
}
} else {
for (var a in json.decode(res)) {
String thumbnail = a["thumbnail"];
if (thumbnail.startsWith("https://")) {
images.add(thumbnail);
} else {
images.add("${manga.apiUrl}/cover/$thumbnail");
}
names.add(a["title"]);
final seriesSlug = MBridge.regExp(a["series_slug"], "-\\d+", "", 0, 0);
urls.add("/series/$seriesSlug");
} }
names.add(a["title"]);
final seriesSlug = MBridge.regExp(a["series_slug"], "-\\d+", "", 0, 0);
urls.add("/series/$seriesSlug");
} }
manga.urls = urls; manga.urls = urls;
manga.images = images; manga.images = images;
manga.names = names; manga.names = names;

View File

@@ -1,7 +1,7 @@
import '../../../model/source.dart'; import '../../../model/source.dart';
import '../../../utils/utils.dart'; import '../../../utils/utils.dart';
const heancmsVersion = "0.0.2"; const heancmsVersion = "0.0.21";
const heancmsSourceCodeUrl = const heancmsSourceCodeUrl =
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/heancms/heancms-v$heancmsVersion.dart"; "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/heancms/heancms-v$heancmsVersion.dart";
const defaultDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"; const defaultDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ";
@@ -11,7 +11,7 @@ List<Source> _heanCmsSourcesList = [
Source( Source(
name: "YugenMangas", name: "YugenMangas",
baseUrl: "https://yugenmangas.lat", baseUrl: "https://yugenmangas.lat",
apiUrl: "https://api.yugenmangas.lat", apiUrl: "https://api.yugenmangas.net",
lang: "es", lang: "es",
typeSource: "heancms", typeSource: "heancms",
isNsfw: true, isNsfw: true,
@@ -32,40 +32,37 @@ List<Source> _heanCmsSourcesList = [
version: heancmsVersion, version: heancmsVersion,
dateFormat: defaultDateFormat, dateFormat: defaultDateFormat,
dateFormatLocale: defaultDateFormatLocale), dateFormatLocale: defaultDateFormatLocale),
Source( // Source(
name: "Reaper Scans", // name: "Reaper Scans",
baseUrl: "https://reaperscans.net", // baseUrl: "https://reaperscans.net",
apiUrl: "https://api.reaperscans.net", // apiUrl: "https://api.reaperscans.net",
lang: "pt-BR", // lang: "pt-br",
typeSource: "heancms", // typeSource: "heancms",
isNsfw: true, // iconUrl: getIconUrl("reaperscans", "pt"),
iconUrl: getIconUrl("reaperscans", "pt-BR"), // sourceCodeUrl: heancmsSourceCodeUrl,
sourceCodeUrl: heancmsSourceCodeUrl, // version: heancmsVersion,
version: heancmsVersion, // dateFormat: defaultDateFormat,
dateFormat: defaultDateFormat, // dateFormatLocale: defaultDateFormatLocale),
dateFormatLocale: defaultDateFormatLocale),
Source( Source(
name: "Perf Scan", name: "Perf Scan",
baseUrl: "https://perf-scan.fr", baseUrl: "https://perf-scan.fr",
apiUrl: "https://api.perf-scan.fr", apiUrl: "https://api.perf-scan.fr",
lang: "fr", lang: "fr",
typeSource: "heancms", typeSource: "heancms",
isNsfw: true,
iconUrl: getIconUrl("perfscan", "fr"), iconUrl: getIconUrl("perfscan", "fr"),
sourceCodeUrl: heancmsSourceCodeUrl, sourceCodeUrl: heancmsSourceCodeUrl,
version: heancmsVersion, version: heancmsVersion,
dateFormat: defaultDateFormat, dateFormat: defaultDateFormat,
dateFormatLocale: defaultDateFormatLocale), dateFormatLocale: defaultDateFormatLocale),
Source( // Source(
name: "Glorious Scan", // name: "Glorious Scan",
baseUrl: "https://gloriousscan.com", // baseUrl: "https://gloriousscan.com",
apiUrl: "https://api.gloriousscan.com", // apiUrl: "https://api.gloriousscan.com",
lang: "pt-BR", // lang: "pt-br",
typeSource: "heancms", // typeSource: "heancms",
isNsfw: true, // iconUrl: getIconUrl("gloriousscan", "pt"),
iconUrl: getIconUrl("gloriousscan", "pt-BR"), // sourceCodeUrl: heancmsSourceCodeUrl,
sourceCodeUrl: heancmsSourceCodeUrl, // version: heancmsVersion,
version: heancmsVersion, // dateFormat: defaultDateFormat,
dateFormat: defaultDateFormat, // dateFormatLocale: defaultDateFormatLocale),
dateFormatLocale: defaultDateFormatLocale),
]; ];

View File

@@ -246,7 +246,7 @@ List<Source> _mangareaderSourcesList = [
Source( Source(
name: "Mundo Mangá-Kun", name: "Mundo Mangá-Kun",
baseUrl: "https://mundomangakun.com.br", baseUrl: "https://mundomangakun.com.br",
lang: "pt-BR", lang: "pt-br",
isNsfw: true, isNsfw: true,
iconUrl: getIconUrl("mundomangakun", "pt"), iconUrl: getIconUrl("mundomangakun", "pt"),
dateFormat: "MMMMM dd, yyyy", dateFormat: "MMMMM dd, yyyy",
@@ -256,7 +256,7 @@ List<Source> _mangareaderSourcesList = [
Source( Source(
name: "Origami Orpheans", name: "Origami Orpheans",
baseUrl: "https://origami-orpheans.com.br", baseUrl: "https://origami-orpheans.com.br",
lang: "pt-BR", lang: "pt-br",
iconUrl: getIconUrl("origamiorpheans", "pt"), iconUrl: getIconUrl("origamiorpheans", "pt"),
dateFormat: "MMMMM dd, yyyy", dateFormat: "MMMMM dd, yyyy",
dateFormatLocale: "pt-BR", dateFormatLocale: "pt-BR",