mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
Refactor
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
searchManga(MangaModel manga) async {
|
||||
searchManga(MManga manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
|
||||
String res = "".toString();
|
||||
@@ -14,32 +14,20 @@ searchManga(MangaModel manga) async {
|
||||
return manga;
|
||||
}
|
||||
} else {
|
||||
final newEndpointUrl = "${manga.apiUrl}/query";
|
||||
final newEndpointBody = {
|
||||
"query_string": manga.query,
|
||||
"series_status": "All",
|
||||
"page": manga.page,
|
||||
"order": "desc",
|
||||
"order_by": "total_views",
|
||||
"perPage": "12",
|
||||
"tags_ids": "[]",
|
||||
"series_type": "Comic"
|
||||
};
|
||||
final newEndpointData = {
|
||||
"url": newEndpointUrl,
|
||||
"headers": headers,
|
||||
"newEndpointBody": newEndpointBody
|
||||
};
|
||||
final newEndpointUrl =
|
||||
"${manga.apiUrl}/query/?page=${manga.page}&query_string=${manga.query}&series_status=All&order=desc&orderBy=total_views&perPage=12&tags_ids=[]&series_type=Comic";
|
||||
|
||||
final newEndpointData = {"url": newEndpointUrl, "headers": headers};
|
||||
res = await MBridge.http('GET', json.encode(newEndpointData));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
}
|
||||
|
||||
return mangaModelRes(res, manga);
|
||||
return MMangaRes(res, manga);
|
||||
}
|
||||
|
||||
getPopularManga(MangaModel manga) async {
|
||||
getPopularManga(MManga manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
String res = "".toString();
|
||||
if (!useNewQueryEndpoint(manga.source)) {
|
||||
@@ -62,33 +50,23 @@ getPopularManga(MangaModel manga) async {
|
||||
|
||||
res = await MBridge.http('POST', json.encode(data));
|
||||
} else {
|
||||
final newEndpointUrl = "${manga.apiUrl}/query";
|
||||
final newEndpointBody = {
|
||||
"query_string": "",
|
||||
"series_status": "All",
|
||||
"page": manga.page,
|
||||
"order": "desc",
|
||||
"order_by": "total_views",
|
||||
"perPage": "12",
|
||||
"tags_ids": "[]",
|
||||
"series_type": "Comic"
|
||||
};
|
||||
final newEndpointUrl =
|
||||
"${manga.apiUrl}/query/?page=${manga.page}&query_string=&series_status=All&order=desc&orderBy=total_views&perPage=12&tags_ids=[]&series_type=Comic";
|
||||
|
||||
final newEndpointData = {
|
||||
"url": newEndpointUrl,
|
||||
"headers": headers,
|
||||
"sourceId": manga.sourceId,
|
||||
"body": newEndpointBody
|
||||
"sourceId": manga.sourceId
|
||||
};
|
||||
print("sssssssssssssssssssss");
|
||||
res = await MBridge.http('GET', json.encode(newEndpointData));
|
||||
}
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
return mangaModelRes(res, manga);
|
||||
return MMangaRes(res, manga);
|
||||
}
|
||||
|
||||
getLatestUpdatesManga(MangaModel manga) async {
|
||||
getLatestUpdatesManga(MManga manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
String res = "".toString();
|
||||
if (!useNewQueryEndpoint(manga.source)) {
|
||||
@@ -108,23 +86,10 @@ getLatestUpdatesManga(MangaModel manga) async {
|
||||
};
|
||||
res = await MBridge.http('POST', json.encode(data));
|
||||
} else {
|
||||
final newEndpointUrl = "${manga.apiUrl}/query";
|
||||
final newEndpointBody = {
|
||||
"query_string": "",
|
||||
"series_status": "All",
|
||||
"page": manga.page,
|
||||
"order": "desc",
|
||||
"order_by": "latest",
|
||||
"perPage": "12",
|
||||
"tags_ids": "[]",
|
||||
"series_type": "Comic"
|
||||
};
|
||||
final newEndpointData = {
|
||||
"url": newEndpointUrl,
|
||||
"headers": headers,
|
||||
"sourceId": manga.sourceId,
|
||||
"body": newEndpointBody
|
||||
};
|
||||
final newEndpointUrl =
|
||||
"${manga.apiUrl}/query/?page=${manga.page}&query_string=&series_status=All&order=desc&orderBy=latest&perPage=12&tags_ids=[]&series_type=Comic";
|
||||
|
||||
final newEndpointData = {"url": newEndpointUrl, "headers": headers};
|
||||
res = await MBridge.http('GET', json.encode(newEndpointData));
|
||||
print(res);
|
||||
}
|
||||
@@ -132,10 +97,10 @@ getLatestUpdatesManga(MangaModel manga) async {
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
return mangaModelRes(res, manga);
|
||||
return MMangaRes(res, manga);
|
||||
}
|
||||
|
||||
getMangaDetail(MangaModel manga) async {
|
||||
getMangaDetail(MManga manga) async {
|
||||
String currentSlug = MBridge.substringAfterLast(manga.link, "/");
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
final url = "${manga.apiUrl}/series/$currentSlug";
|
||||
@@ -144,7 +109,7 @@ getMangaDetail(MangaModel manga) async {
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
print(res);
|
||||
print("${manga.apiUrl}/series/$currentSlug");
|
||||
manga.author = MBridge.getMapValue(res, "author");
|
||||
|
||||
manga.description = MBridge.getMapValue(res, "description");
|
||||
@@ -193,7 +158,7 @@ getMangaDetail(MangaModel manga) async {
|
||||
return manga;
|
||||
}
|
||||
|
||||
getChapterUrl(MangaModel manga) async {
|
||||
getChapterPages(MManga manga) async {
|
||||
String res = "".toString();
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
if (!useslugStrategy(manga.source)) {
|
||||
@@ -255,7 +220,7 @@ bool useslugStrategy(String sourceName) {
|
||||
return sources.contains(sourceName);
|
||||
}
|
||||
|
||||
MangaModel mangaModelRes(String res, MangaModel manga) {
|
||||
MManga MMangaRes(String res, MManga manga) {
|
||||
List<String> names = [];
|
||||
List<String> urls = [];
|
||||
List<String> images = [];
|
||||
@@ -269,7 +234,7 @@ MangaModel mangaModelRes(String res, MangaModel manga) {
|
||||
images.add("${manga.apiUrl}/cover/$thumbnail");
|
||||
}
|
||||
names.add(a["title"]);
|
||||
final seriesSlug = MBridge.regExp(a["series_slug"], "-\\d+", "", 0, 0);
|
||||
final seriesSlug = a["series_slug"];
|
||||
urls.add("/series/$seriesSlug");
|
||||
}
|
||||
} else {
|
||||
@@ -281,9 +246,10 @@ MangaModel mangaModelRes(String res, MangaModel manga) {
|
||||
images.add("${manga.apiUrl}/cover/$thumbnail");
|
||||
}
|
||||
names.add(a["title"]);
|
||||
final seriesSlug = MBridge.regExp(a["series_slug"], "-\\d+", "", 0, 0);
|
||||
final seriesSlug = a["series_slug"];
|
||||
urls.add("/series/$seriesSlug");
|
||||
}
|
||||
manga.hasNextPage = false;
|
||||
}
|
||||
|
||||
manga.urls = urls;
|
||||
@@ -1,7 +1,7 @@
|
||||
import '../../../model/source.dart';
|
||||
import '../../../utils/utils.dart';
|
||||
|
||||
const heancmsVersion = "0.0.21";
|
||||
const heancmsVersion = "0.0.3";
|
||||
const heancmsSourceCodeUrl =
|
||||
"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";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
getPopularManga(MangaModel manga) async {
|
||||
getPopularManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}/manga/page/${manga.page}/?m_orderby=views";
|
||||
final data = {"url": url, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
@@ -25,7 +25,7 @@ getPopularManga(MangaModel manga) async {
|
||||
return manga;
|
||||
}
|
||||
|
||||
getMangaDetail(MangaModel manga) async {
|
||||
getMangaDetail(MManga manga) async {
|
||||
final statusList = [
|
||||
{
|
||||
"OnGoing": 0,
|
||||
@@ -174,7 +174,7 @@ getMangaDetail(MangaModel manga) async {
|
||||
return manga;
|
||||
}
|
||||
|
||||
getChapterUrl(MangaModel manga) async {
|
||||
getChapterPages(MManga manga) async {
|
||||
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
if (res.isEmpty) {
|
||||
@@ -222,7 +222,7 @@ getChapterUrl(MangaModel manga) async {
|
||||
return pageUrls;
|
||||
}
|
||||
|
||||
getLatestUpdatesManga(MangaModel manga) async {
|
||||
getLatestUpdatesManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}/manga/page/${manga.page}/?m_orderby=latest";
|
||||
final datas = {"url": url, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
@@ -245,7 +245,7 @@ getLatestUpdatesManga(MangaModel manga) async {
|
||||
return manga;
|
||||
}
|
||||
|
||||
searchManga(MangaModel manga) async {
|
||||
searchManga(MManga manga) async {
|
||||
final urll = "${manga.baseUrl}/?s=${manga.query}&post_type=wp-manga";
|
||||
final datas = {"url": urll, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
@@ -1,7 +1,7 @@
|
||||
import '../../../model/source.dart';
|
||||
import '../../../utils/utils.dart';
|
||||
|
||||
const madaraVersion = "0.0.2";
|
||||
const madaraVersion = "0.0.3";
|
||||
const madaraSourceCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/madara/madara-v$madaraVersion.dart";
|
||||
const defaultDateFormat = "MMMM dd, yyyy";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
getPopularManga(MangaModel manga) async {
|
||||
getPopularManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}${getMangaUrlDirectory(manga.source)}/?page=${manga.page}&order=popular";
|
||||
final data = {"url": url, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
@@ -14,7 +14,7 @@ getPopularManga(MangaModel manga) async {
|
||||
return manga;
|
||||
}
|
||||
|
||||
getLatestUpdatesManga(MangaModel manga) async {
|
||||
getLatestUpdatesManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}${getMangaUrlDirectory(manga.source)}/?page=${manga.page}&order=update";
|
||||
final data = {"url": url, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
@@ -27,7 +27,7 @@ getLatestUpdatesManga(MangaModel manga) async {
|
||||
return manga;
|
||||
}
|
||||
|
||||
getMangaDetail(MangaModel manga) async {
|
||||
getMangaDetail(MManga manga) async {
|
||||
final statusList = [
|
||||
{
|
||||
"مستمرة": 0,
|
||||
@@ -125,7 +125,7 @@ getMangaDetail(MangaModel manga) async {
|
||||
return manga;
|
||||
}
|
||||
|
||||
searchManga(MangaModel manga) async {
|
||||
searchManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}${getMangaUrlDirectory(manga.source)}/?&title=${manga.query}&page=${manga.page}";
|
||||
final data = {"url": url, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
@@ -138,7 +138,7 @@ searchManga(MangaModel manga) async {
|
||||
return manga;
|
||||
}
|
||||
|
||||
getChapterUrl(MangaModel manga) async {
|
||||
getChapterPages(MManga manga) async {
|
||||
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
||||
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
@@ -1,7 +1,7 @@
|
||||
import '../../../model/source.dart';
|
||||
import '../../../utils/utils.dart';
|
||||
|
||||
const mangareaderVersion = "0.0.3";
|
||||
const mangareaderVersion = "0.0.4";
|
||||
const mangareaderSourceCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/mangareader/mangareader-v$mangareaderVersion.dart";
|
||||
const defaultDateFormat = "MMMM dd, yyyy";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
searchManga(MangaModel manga) async {
|
||||
searchManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}/search?query=${manga.query}";
|
||||
final data = {"url": url, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
@@ -35,7 +35,7 @@ searchManga(MangaModel manga) async {
|
||||
return manga;
|
||||
}
|
||||
|
||||
getPopularManga(MangaModel manga) async {
|
||||
getPopularManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}/filterList?page=${manga.page}&sortBy=views&asc=false";
|
||||
final data = {"url": url, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
@@ -57,7 +57,7 @@ getPopularManga(MangaModel manga) async {
|
||||
return manga;
|
||||
}
|
||||
|
||||
getMangaDetail(MangaModel manga) async {
|
||||
getMangaDetail(MManga manga) async {
|
||||
final statusList = [
|
||||
{
|
||||
"complete": 1,
|
||||
@@ -99,7 +99,7 @@ getMangaDetail(MangaModel manga) async {
|
||||
return manga;
|
||||
}
|
||||
|
||||
getLatestUpdatesManga(MangaModel manga) async {
|
||||
getLatestUpdatesManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}/latest-release?page=${manga.page}";
|
||||
final data = {"url": url, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
@@ -121,7 +121,7 @@ getLatestUpdatesManga(MangaModel manga) async {
|
||||
return manga;
|
||||
}
|
||||
|
||||
getChapterUrl(MangaModel manga) async {
|
||||
getChapterPages(MManga manga) async {
|
||||
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
if (res.isEmpty) {
|
||||
@@ -1,7 +1,7 @@
|
||||
import '../../../model/source.dart';
|
||||
import '../../../utils/utils.dart';
|
||||
|
||||
const mmrcmsVersion = "0.0.2";
|
||||
const mmrcmsVersion = "0.0.3";
|
||||
const mmrcmsSourceCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/mmrcms/mmrcms-v$mmrcmsVersion.dart";
|
||||
const defaultDateFormat = "d MMM. yyyy";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
getPopularManga(MangaModel manga) async {
|
||||
getPopularManga(MManga manga) async {
|
||||
final data = {"url": "${manga.baseUrl}/search/"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
@@ -13,7 +13,7 @@ getPopularManga(MangaModel manga) async {
|
||||
return parseDirectory(resSort, manga);
|
||||
}
|
||||
|
||||
getLatestUpdatesManga(MangaModel manga) async {
|
||||
getLatestUpdatesManga(MManga manga) async {
|
||||
final data = {"url": "${manga.baseUrl}/search/"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
@@ -25,7 +25,7 @@ getLatestUpdatesManga(MangaModel manga) async {
|
||||
return parseDirectory(resSort, manga);
|
||||
}
|
||||
|
||||
searchManga(MangaModel manga) async {
|
||||
searchManga(MManga manga) async {
|
||||
final data = {"url": "${manga.baseUrl}/search/"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
@@ -45,7 +45,7 @@ searchManga(MangaModel manga) async {
|
||||
return parseDirectory(json.encode(queryRes), manga);
|
||||
}
|
||||
|
||||
getMangaDetail(MangaModel manga) async {
|
||||
getMangaDetail(MManga manga) async {
|
||||
final statusList = [
|
||||
{"Ongoing": 0, "Completed": 1, "Cancelled": 3, "Hiatus": 2}
|
||||
];
|
||||
@@ -94,7 +94,7 @@ getMangaDetail(MangaModel manga) async {
|
||||
return manga;
|
||||
}
|
||||
|
||||
getChapterUrl(MangaModel manga) async {
|
||||
getChapterPages(MManga manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
final url = '${manga.baseUrl}${manga.link}';
|
||||
List<String> pages = [];
|
||||
@@ -164,7 +164,7 @@ String directoryFromDocument(String res) {
|
||||
.replaceAll(";", " ");
|
||||
}
|
||||
|
||||
MangaModel parseDirectory(String resSort, MangaModel manga) {
|
||||
MManga parseDirectory(String resSort, MManga manga) {
|
||||
final datas = json.decode(resSort) as List;
|
||||
manga.names = datas.map((e) => e["s"]).toList();
|
||||
manga.images = datas
|
||||
@@ -1,7 +1,7 @@
|
||||
import '../../../model/source.dart';
|
||||
import '../../../utils/utils.dart';
|
||||
|
||||
const nepnepVersion = "0.0.1";
|
||||
const nepnepVersion = "0.0.2";
|
||||
const nepnepSourceCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/nepnep/nepnep-v$nepnepVersion.dart";
|
||||
const defaultDateFormat = "yyyy-MM-dd HH:mm:ss";
|
||||
@@ -18,7 +18,6 @@ List<Source> _nepnepSourcesList = [
|
||||
dateFormat: defaultDateFormat,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: nepnepVersion,
|
||||
appMinVerReq: "0.0.5",
|
||||
sourceCodeUrl: nepnepSourceCodeUrl,
|
||||
),
|
||||
Source(
|
||||
@@ -30,7 +29,6 @@ List<Source> _nepnepSourcesList = [
|
||||
dateFormat: defaultDateFormat,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: nepnepVersion,
|
||||
appMinVerReq: "0.0.5",
|
||||
sourceCodeUrl: nepnepSourceCodeUrl,
|
||||
),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user