mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
WIP
This commit is contained in:
@@ -1,61 +1,59 @@
|
||||
import 'package:mangayomi/bridge_lib.dart';
|
||||
import 'package:mangayomi/utils.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
class Batoto extends MSourceProvider {
|
||||
class Batoto extends MProvider {
|
||||
Batoto();
|
||||
|
||||
@override
|
||||
Future<MPages> getPopular(MSource sourceInfo, int page) async {
|
||||
Future<MPages> getPopular(MSource source, int page) async {
|
||||
final url =
|
||||
"${sourceInfo.baseUrl}/browse?${lang(sourceInfo.lang)}&sort=views_a&page=$page";
|
||||
"${source.baseUrl}/browse?${lang(source.lang)}&sort=views_a&page=$page";
|
||||
final data = {"url": url};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
return mangaElementM(res, sourceInfo);
|
||||
final res = await http('GET', json.encode(data));
|
||||
return mangaElementM(res, source);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> getLatestUpdates(MSource sourceInfo, int page) async {
|
||||
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||
final url =
|
||||
"${sourceInfo.baseUrl}/browse?${lang(sourceInfo.lang)}&sort=update&page=$page";
|
||||
"${source.baseUrl}/browse?${lang(source.lang)}&sort=update&page=$page";
|
||||
final data = {"url": url};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
return mangaElementM(res, sourceInfo);
|
||||
final res = await http('GET', json.encode(data));
|
||||
return mangaElementM(res, source);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> search(MSource sourceInfo, String query, int page) async {
|
||||
final url = "${sourceInfo.baseUrl}/search?word=$query&page=$page";
|
||||
Future<MPages> search(MSource source, String query, int page) async {
|
||||
final url = "${source.baseUrl}/search?word=$query&page=$page";
|
||||
final data = {"url": url};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
return mangaElementM(res, sourceInfo);
|
||||
final res = await http('GET', json.encode(data));
|
||||
return mangaElementM(res, source);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MManga> getDetail(MSource sourceInfo, String url) async {
|
||||
Future<MManga> getDetail(MSource source, String url) async {
|
||||
final statusList = [
|
||||
{"Ongoing": 0, "Completed": 1, "Cancelled": 3, "Hiatus": 2}
|
||||
];
|
||||
|
||||
final data = {"url": "${sourceInfo.baseUrl}$url"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
final data = {"url": "${source.baseUrl}$url"};
|
||||
final res = await http('GET', json.encode(data));
|
||||
MManga manga = MManga();
|
||||
final workStatus = MBridge.xpath(res,
|
||||
final workStatus = xpath(res,
|
||||
'//*[@class="attr-item"]/b[contains(text(),"Original work")]/following-sibling::span[1]/text()')
|
||||
.first;
|
||||
manga.status = MBridge.parseStatus(workStatus, statusList);
|
||||
manga.status = parseStatus(workStatus, statusList);
|
||||
|
||||
manga.author = MBridge.xpath(res,
|
||||
manga.author = xpath(res,
|
||||
'//*[@class="attr-item"]/b[contains(text(),"Authors")]/following-sibling::span[1]/text()')
|
||||
.first;
|
||||
manga.genre = MBridge.xpath(res,
|
||||
manga.genre = xpath(res,
|
||||
'//*[@class="attr-item"]/b[contains(text(),"Genres")]/following-sibling::span[1]/text()')
|
||||
.first
|
||||
.split(",");
|
||||
manga.description =
|
||||
MBridge.xpath(res, '//*[@class="limit-html"]/text()').first;
|
||||
manga.description = xpath(res, '//*[@class="limit-html"]/text()').first;
|
||||
|
||||
List<String> chapsElement = MBridge.querySelectorAll(res,
|
||||
List<String> chapsElement = querySelectorAll(res,
|
||||
selector: "div.main div.p-2",
|
||||
typeElement: 2,
|
||||
attributes: "",
|
||||
@@ -65,26 +63,24 @@ class Batoto extends MSourceProvider {
|
||||
List<String> chapsNames = [];
|
||||
List<String> scanlators = [];
|
||||
for (var element in chapsElement) {
|
||||
final urlElement = MBridge.querySelectorAll(element,
|
||||
final urlElement = querySelectorAll(element,
|
||||
selector: "a.chapt",
|
||||
typeElement: 2,
|
||||
attributes: "",
|
||||
typeRegExp: 0)
|
||||
.first;
|
||||
final group =
|
||||
MBridge.xpath(element, '//*[@class="extra"]/a/text()').first;
|
||||
final name = MBridge.xpath(urlElement, '//a/text()').first;
|
||||
final url = MBridge.xpath(urlElement, '//a/@href').first;
|
||||
final group = xpath(element, '//*[@class="extra"]/a/text()').first;
|
||||
final name = xpath(urlElement, '//a/text()').first;
|
||||
final url = xpath(urlElement, '//a/@href').first;
|
||||
final time =
|
||||
MBridge.xpath(element, '//*[@class="extra"]/i[@class="ps-3"]/text()')
|
||||
.first;
|
||||
xpath(element, '//*[@class="extra"]/i[@class="ps-3"]/text()').first;
|
||||
times.add(time);
|
||||
chapsUrls.add(url);
|
||||
scanlators.add(group);
|
||||
chapsNames.add(name.replaceAll("\n ", "").replaceAll(" ", ""));
|
||||
}
|
||||
var dateUploads = MBridge.parseDates(
|
||||
times, sourceInfo.dateFormat, sourceInfo.dateFormatLocale);
|
||||
var dateUploads =
|
||||
parseDates(times, source.dateFormat, source.dateFormatLocale);
|
||||
List<MChapter>? chaptersList = [];
|
||||
for (var i = 0; i < chapsNames.length; i++) {
|
||||
MChapter chapter = MChapter();
|
||||
@@ -99,29 +95,23 @@ class Batoto extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<String>> getPageList(MSource sourceInfo, String url) async {
|
||||
final datas = {"url": "${sourceInfo.baseUrl}$url"};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
Future<List<String>> getPageList(MSource source, String url) async {
|
||||
final datas = {"url": "${source.baseUrl}$url"};
|
||||
final res = await http('GET', json.encode(datas));
|
||||
|
||||
final script = MBridge.xpath(res,
|
||||
final script = xpath(res,
|
||||
'//script[contains(text(), "imgHttpLis") and contains(text(), "batoWord") and contains(text(), "batoPass")]/text()')
|
||||
.first;
|
||||
final imgHttpLisString = Substring(script)
|
||||
.substringAfterLast('const imgHttpLis =')
|
||||
.substringBefore(';')
|
||||
.text;
|
||||
final imgHttpLisString =
|
||||
substringBefore(substringAfterLast(script, 'const imgHttpLis ='), ';');
|
||||
var imgHttpLis = json.decode(imgHttpLisString);
|
||||
final batoWord = Substring(script)
|
||||
.substringAfterLast('const batoWord =')
|
||||
.substringBefore(';')
|
||||
.text;
|
||||
final batoPass = Substring(script)
|
||||
.substringAfterLast('const batoPass =')
|
||||
.substringBefore(';')
|
||||
.text;
|
||||
final evaluatedPass = MBridge.deobfuscateJsPassword(batoPass);
|
||||
final batoWord =
|
||||
substringBefore(substringAfterLast(script, 'const batoWord ='), ';');
|
||||
final batoPass =
|
||||
substringBefore(substringAfterLast(script, 'const batoPass ='), ';');
|
||||
final evaluatedPass = deobfuscateJsPassword(batoPass);
|
||||
final imgAccListString =
|
||||
MBridge.decryptAESCryptoJS(batoWord.replaceAll('"', ""), evaluatedPass);
|
||||
decryptAESCryptoJS(batoWord.replaceAll('"', ""), evaluatedPass);
|
||||
var imgAccList = json.decode(imgAccListString);
|
||||
List<String> pagesUrl = [];
|
||||
for (int i = 0; i < imgHttpLis.length; i++) {
|
||||
@@ -133,10 +123,10 @@ class Batoto extends MSourceProvider {
|
||||
return pagesUrl;
|
||||
}
|
||||
|
||||
MPages mangaElementM(String res, MSource sourceInfo) async {
|
||||
final lang = sourceInfo.lang.replaceAll("-", "_");
|
||||
MPages mangaElementM(String res, MSource source) async {
|
||||
final lang = source.lang.replaceAll("-", "_");
|
||||
|
||||
var resB = MBridge.querySelectorAll(res,
|
||||
var resB = querySelectorAll(res,
|
||||
selector: "div#series-list div.col",
|
||||
typeElement: 2,
|
||||
attributes: "",
|
||||
@@ -147,22 +137,22 @@ class Batoto extends MSourceProvider {
|
||||
List<String> names = [];
|
||||
|
||||
for (var element in resB) {
|
||||
if (sourceInfo.lang == "all" ||
|
||||
sourceInfo.lang == "en" && element.contains('no-flag') ||
|
||||
if (source.lang == "all" ||
|
||||
source.lang == "en" && element.contains('no-flag') ||
|
||||
element.contains('data-lang="$lang"')) {
|
||||
final item = MBridge.querySelectorAll(element,
|
||||
final item = querySelectorAll(element,
|
||||
selector: "a.item-cover",
|
||||
typeElement: 2,
|
||||
attributes: "",
|
||||
typeRegExp: 0)
|
||||
.first;
|
||||
final img = MBridge.querySelectorAll(item,
|
||||
final img = querySelectorAll(item,
|
||||
selector: "img",
|
||||
typeElement: 3,
|
||||
attributes: "src",
|
||||
typeRegExp: 0)
|
||||
.first;
|
||||
final url = MBridge.querySelectorAll(item,
|
||||
final url = querySelectorAll(item,
|
||||
selector: "a",
|
||||
typeElement: 3,
|
||||
attributes: "href",
|
||||
@@ -170,7 +160,7 @@ class Batoto extends MSourceProvider {
|
||||
.first;
|
||||
images.add(img);
|
||||
urls.add(url);
|
||||
final title = MBridge.querySelectorAll(element,
|
||||
final title = querySelectorAll(element,
|
||||
selector: "a.item-title",
|
||||
typeElement: 0,
|
||||
attributes: "",
|
||||
@@ -201,7 +191,7 @@ class Batoto extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<MVideo>> getVideoList(MSource sourceInfo, String url) async {
|
||||
Future<List<MVideo>> getVideoList(MSource source, String url) async {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,94 +1,88 @@
|
||||
import 'package:mangayomi/bridge_lib.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
class ComickFun extends MSourceProvider {
|
||||
class ComickFun extends MProvider {
|
||||
ComickFun();
|
||||
|
||||
@override
|
||||
Future<MPages> getPopular(MSource sourceInfo, int page) async {
|
||||
Future<MPages> getPopular(MSource source, int page) async {
|
||||
final url =
|
||||
"${sourceInfo.apiUrl}/v1.0/search?sort=follow&page=$page&tachiyomi=true";
|
||||
final data = {"url": url, "headers": getHeader(sourceInfo.baseUrl)};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
"${source.apiUrl}/v1.0/search?sort=follow&page=$page&tachiyomi=true";
|
||||
final data = {"url": url, "headers": getHeader(source.baseUrl)};
|
||||
final res = await http('GET', json.encode(data));
|
||||
return mangaRes(res);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> getLatestUpdates(MSource sourceInfo, int page) async {
|
||||
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||
final url =
|
||||
"${sourceInfo.apiUrl}/v1.0/search?sort=uploaded&page=$page&tachiyomi=true";
|
||||
final data = {"url": url, "headers": getHeader(sourceInfo.baseUrl)};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
"${source.apiUrl}/v1.0/search?sort=uploaded&page=$page&tachiyomi=true";
|
||||
final data = {"url": url, "headers": getHeader(source.baseUrl)};
|
||||
final res = await http('GET', json.encode(data));
|
||||
return mangaRes(res);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> search(MSource sourceInfo, String query, int page) async {
|
||||
final url = "${sourceInfo.apiUrl}/v1.0/search?q=$query&tachiyomi=true";
|
||||
final data = {"url": url, "headers": getHeader(sourceInfo.baseUrl)};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
Future<MPages> search(MSource source, String query, int page) async {
|
||||
final url = "${source.apiUrl}/v1.0/search?q=$query&tachiyomi=true";
|
||||
final data = {"url": url, "headers": getHeader(source.baseUrl)};
|
||||
final res = await http('GET', json.encode(data));
|
||||
return mangaRes(res);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MManga> getDetail(MSource sourceInfo, String url) async {
|
||||
Future<MManga> getDetail(MSource source, String url) async {
|
||||
final statusList = [
|
||||
{"1": 0, "2": 1, "3": 3, "4": 2}
|
||||
];
|
||||
|
||||
final headers = getHeader(sourceInfo.baseUrl);
|
||||
final headers = getHeader(source.baseUrl);
|
||||
|
||||
final urll =
|
||||
"${sourceInfo.apiUrl}${url.replaceAll("#", '')}?tachiyomi=true";
|
||||
final urll = "${source.apiUrl}${url.replaceAll("#", '')}?tachiyomi=true";
|
||||
final data = {"url": urll, "headers": headers};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
final res = await http('GET', json.encode(data));
|
||||
MManga manga = MManga();
|
||||
manga.author = MBridge.jsonPathToString(res, r'$.authors[*].name', '');
|
||||
manga.genre =
|
||||
MBridge.jsonPathToString(res, r'$.genres[*].name', "_.").split("_.");
|
||||
manga.description = MBridge.jsonPathToString(res, r'$..desc', '');
|
||||
manga.status = MBridge.parseStatus(
|
||||
MBridge.jsonPathToString(res, r'$..comic.status', ''), statusList);
|
||||
manga.author = jsonPathToString(res, r'$.authors[*].name', '');
|
||||
manga.genre = jsonPathToString(res, r'$.genres[*].name', "_.").split("_.");
|
||||
manga.description = jsonPathToString(res, r'$..desc', '');
|
||||
manga.status =
|
||||
parseStatus(jsonPathToString(res, r'$..comic.status', ''), statusList);
|
||||
final chapUrlReq =
|
||||
"${sourceInfo.apiUrl}${url.replaceAll("#", '')}chapters?lang=${sourceInfo.lang}&tachiyomi=true&page=1";
|
||||
"${source.apiUrl}${url.replaceAll("#", '')}chapters?lang=${source.lang}&tachiyomi=true&page=1";
|
||||
final dataReq = {"url": chapUrlReq, "headers": headers};
|
||||
final request = await MBridge.http('GET', json.encode(dataReq));
|
||||
var total = MBridge.jsonPathToString(request, r'$.total', '');
|
||||
final request = await http('GET', json.encode(dataReq));
|
||||
var total = jsonPathToString(request, r'$.total', '');
|
||||
final chapterLimit = int.parse(total);
|
||||
final newChapUrlReq =
|
||||
"${sourceInfo.apiUrl}${url.replaceAll("#", '')}chapters?limit=$chapterLimit&lang=${sourceInfo.lang}&tachiyomi=true&page=1";
|
||||
"${source.apiUrl}${url.replaceAll("#", '')}chapters?limit=$chapterLimit&lang=${source.lang}&tachiyomi=true&page=1";
|
||||
|
||||
final newDataReq = {"url": newChapUrlReq, "headers": headers};
|
||||
final newRequest = await MBridge.http('GET', json.encode(newDataReq));
|
||||
final newRequest = await http('GET', json.encode(newDataReq));
|
||||
|
||||
final chapsUrls =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].hid', "_.")
|
||||
.split("_.");
|
||||
jsonPathToString(newRequest, r'$.chapters[*].hid', "_.").split("_.");
|
||||
final chapDate =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].created_at', "_.")
|
||||
jsonPathToString(newRequest, r'$.chapters[*].created_at', "_.")
|
||||
.split("_.");
|
||||
final chaptersVolumes =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].vol', "_.")
|
||||
.split("_.");
|
||||
jsonPathToString(newRequest, r'$.chapters[*].vol', "_.").split("_.");
|
||||
final chaptersScanlators =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].group_name', "_.")
|
||||
jsonPathToString(newRequest, r'$.chapters[*].group_name', "_.")
|
||||
.split("_.");
|
||||
final chapsNames =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].title', "_.")
|
||||
.split("_.");
|
||||
jsonPathToString(newRequest, r'$.chapters[*].title', "_.").split("_.");
|
||||
final chaptersChaps =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].chap', "_.")
|
||||
.split("_.");
|
||||
jsonPathToString(newRequest, r'$.chapters[*].chap', "_.").split("_.");
|
||||
|
||||
var dateUploads = MBridge.parseDates(
|
||||
chapDate, sourceInfo.dateFormat, sourceInfo.dateFormatLocale);
|
||||
var dateUploads =
|
||||
parseDates(chapDate, source.dateFormat, source.dateFormatLocale);
|
||||
List<MChapter>? chaptersList = [];
|
||||
for (var i = 0; i < chapsNames.length; i++) {
|
||||
String title = "";
|
||||
String scanlator = "";
|
||||
if (chaptersChaps.isNotEmpty && chaptersVolumes.isNotEmpty) {
|
||||
title = beautifyChapterName(chaptersVolumes[i], chaptersChaps[i],
|
||||
chapsNames[i], sourceInfo.lang);
|
||||
title = beautifyChapterName(
|
||||
chaptersVolumes[i], chaptersChaps[i], chapsNames[i], source.lang);
|
||||
} else {
|
||||
title = chapsNames[i];
|
||||
}
|
||||
@@ -110,23 +104,22 @@ class ComickFun extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<String>> getPageList(MSource sourceInfo, String url) async {
|
||||
final urll = "${sourceInfo.apiUrl}/chapter/$url?tachiyomi=true";
|
||||
Future<List<String>> getPageList(MSource source, String url) async {
|
||||
final urll = "${source.apiUrl}/chapter/$url?tachiyomi=true";
|
||||
final data = {"url": urll, "headers": getHeader(url)};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
return MBridge.jsonPathToString(res, r'$.chapter.images[*].url', '_.')
|
||||
.split('_.');
|
||||
final res = await http('GET', json.encode(data));
|
||||
return jsonPathToString(res, r'$.chapter.images[*].url', '_.').split('_.');
|
||||
}
|
||||
|
||||
MPages mangaRes(String res) async {
|
||||
final names = MBridge.jsonPathToList(res, r'$.title', 0);
|
||||
List<String> ids = MBridge.jsonPathToList(res, r'$.hid', 0);
|
||||
final names = jsonPathToList(res, r'$.title', 0);
|
||||
List<String> ids = jsonPathToList(res, r'$.hid', 0);
|
||||
List<String> mangaUrls = [];
|
||||
for (var id in ids) {
|
||||
mangaUrls.add("/comic/$id/#");
|
||||
}
|
||||
final urls = mangaUrls;
|
||||
final images = MBridge.jsonPathToList(res, r'$.cover_url', 0);
|
||||
final images = jsonPathToList(res, r'$.cover_url', 0);
|
||||
List<MManga> mangaList = [];
|
||||
for (var i = 0; i < urls.length; i++) {
|
||||
MManga manga = MManga();
|
||||
@@ -139,15 +132,6 @@ class ComickFun extends MSourceProvider {
|
||||
return MPages(mangaList, true);
|
||||
}
|
||||
|
||||
Map<String, String> getHeader(String url) {
|
||||
final headers = {
|
||||
"Referer": "$url/",
|
||||
'User-Agent':
|
||||
"Tachiyomi Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:110.0) Gecko/20100101 Firefox/110.0"
|
||||
};
|
||||
return headers;
|
||||
}
|
||||
|
||||
String beautifyChapterName(
|
||||
String vol, String chap, String title, String lang) {
|
||||
String result = "";
|
||||
@@ -184,11 +168,20 @@ class ComickFun extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<MVideo>> getVideoList(MSource sourceInfo, String url) async {
|
||||
Future<List<MVideo>> getVideoList(MSource source, String url) async {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, String> getHeader(String url) {
|
||||
final headers = {
|
||||
"Referer": "$url/",
|
||||
'User-Agent':
|
||||
"Tachiyomi Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:110.0) Gecko/20100101 Firefox/110.0"
|
||||
};
|
||||
return headers;
|
||||
}
|
||||
|
||||
ComickFun main() {
|
||||
return ComickFun();
|
||||
}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import 'package:mangayomi/bridge_lib.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
class MangaDex extends MSourceProvider {
|
||||
class MangaDex extends MProvider {
|
||||
MangaDex();
|
||||
|
||||
@override
|
||||
Future<MPages> getPopular(MSource sourceInfo, int page) async {
|
||||
Future<MPages> getPopular(MSource source, int page) async {
|
||||
page = (20 * (page - 1));
|
||||
final url =
|
||||
"https://api.mangadex.org/manga?limit=20&offset=$page&availableTranslatedLanguage[]=en&includes[]=cover_art${getMDXContentRating()}&order[followedCount]=desc";
|
||||
final datas = {"url": url};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
return mangaRes(res, sourceInfo);
|
||||
final res = await http('GET', json.encode(datas));
|
||||
return mangaRes(res, source);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> getLatestUpdates(MSource sourceInfo, int page) async {
|
||||
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||
page = (20 * (page - 1));
|
||||
final urll =
|
||||
"https://api.mangadex.org/chapter?limit=20&offset=$page&translatedLanguage[]=${sourceInfo.lang}&includeFutureUpdates=0&order[publishAt]=desc&includeFuturePublishAt=0&includeEmptyPages=0";
|
||||
"https://api.mangadex.org/chapter?limit=20&offset=$page&translatedLanguage[]=${source.lang}&includeFutureUpdates=0&order[publishAt]=desc&includeFuturePublishAt=0&includeEmptyPages=0";
|
||||
final datas = {"url": urll};
|
||||
final ress = await MBridge.http('GET', json.encode(datas));
|
||||
final ress = await http('GET', json.encode(datas));
|
||||
final mangaIds =
|
||||
MBridge.jsonPathToString(ress, r'$.data[*].relationships[*].id', '.--')
|
||||
jsonPathToString(ress, r'$.data[*].relationships[*].id', '.--')
|
||||
.split('.--');
|
||||
String mangaIdss = "".toString();
|
||||
for (var id in mangaIds) {
|
||||
@@ -30,58 +30,58 @@ class MangaDex extends MSourceProvider {
|
||||
}
|
||||
final newUrl =
|
||||
"https://api.mangadex.org/manga?includes[]=cover_art&limit=${mangaIds.length}${getMDXContentRating()}$mangaIdss";
|
||||
final res = await MBridge.http('GET', json.encode({"url": newUrl}));
|
||||
return mangaRes(res, sourceInfo);
|
||||
final res = await http('GET', json.encode({"url": newUrl}));
|
||||
return mangaRes(res, source);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> search(MSource sourceInfo, String query, int page) async {
|
||||
Future<MPages> search(MSource source, String query, int page) async {
|
||||
final url =
|
||||
"https://api.mangadex.org/manga?includes[]=cover_art&offset=0&limit=20&title=$query${getMDXContentRating()}&order[followedCount]=desc&availableTranslatedLanguage[]=${sourceInfo.lang}";
|
||||
"https://api.mangadex.org/manga?includes[]=cover_art&offset=0&limit=20&title=$query${getMDXContentRating()}&order[followedCount]=desc&availableTranslatedLanguage[]=${source.lang}";
|
||||
|
||||
final res = await MBridge.http('GET', json.encode({"url": url}));
|
||||
return mangaRes(res, sourceInfo);
|
||||
final res = await http('GET', json.encode({"url": url}));
|
||||
return mangaRes(res, source);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MManga> getDetail(MSource sourceInfo, String url) async {
|
||||
Future<MManga> getDetail(MSource source, String url) async {
|
||||
final statusList = [
|
||||
{"ongoing": 0, "completed": 1, "hiatus": 2, "cancelled": 3}
|
||||
];
|
||||
|
||||
final urll =
|
||||
"https://api.mangadex.org$url?includes[]=cover_art&includes[]=author&includes[]=artist";
|
||||
final res = await MBridge.http('GET', json.encode({"url": urll}));
|
||||
final res = await http('GET', json.encode({"url": urll}));
|
||||
MManga manga = MManga();
|
||||
manga.author = MBridge.jsonPathToString(
|
||||
manga.author = jsonPathToString(
|
||||
res, r'$..data.relationships[*].attributes.name', ', ');
|
||||
|
||||
String expressionDescriptionA = r'$..data.attributes.description.en';
|
||||
String expressionDescription = MBridge.regExp(
|
||||
String expressionDescription = regExp(
|
||||
r'$..data.attributes.description[a]',
|
||||
r'\[a\]',
|
||||
".${sourceInfo.lang}",
|
||||
".${source.lang}",
|
||||
0,
|
||||
1);
|
||||
|
||||
String description =
|
||||
MBridge.jsonPathToString(res, expressionDescription, '');
|
||||
jsonPathToString(res, expressionDescription, '');
|
||||
if (description.isEmpty) {
|
||||
description = MBridge.jsonPathToString(res, expressionDescriptionA, '');
|
||||
description = jsonPathToString(res, expressionDescriptionA, '');
|
||||
}
|
||||
manga.description = description;
|
||||
List<String> genres = [];
|
||||
|
||||
genres = MBridge.jsonPathToString(
|
||||
genres = jsonPathToString(
|
||||
res, r'$..data.attributes.tags[*].attributes.name.en', '.-')
|
||||
.split('.-');
|
||||
|
||||
String contentRating =
|
||||
MBridge.jsonPathToString(res, r'$..data.attributes.contentRating', '');
|
||||
jsonPathToString(res, r'$..data.attributes.contentRating', '');
|
||||
if (contentRating != "safe") {
|
||||
genres.add(contentRating);
|
||||
}
|
||||
String publicationDemographic = MBridge.jsonPathToString(
|
||||
String publicationDemographic = jsonPathToString(
|
||||
res, r'$..data.attributes.publicationDemographic', '');
|
||||
if (publicationDemographic == "null") {
|
||||
} else {
|
||||
@@ -89,21 +89,21 @@ class MangaDex extends MSourceProvider {
|
||||
}
|
||||
manga.genre = genres;
|
||||
String statusRes =
|
||||
MBridge.jsonPathToString(res, r'$..data.attributes.status', '');
|
||||
manga.status = MBridge.parseStatus(statusRes, statusList);
|
||||
jsonPathToString(res, r'$..data.attributes.status', '');
|
||||
manga.status = parseStatus(statusRes, statusList);
|
||||
final mangaId = url.split('/').last;
|
||||
|
||||
final paginatedChapterList =
|
||||
await paginatedChapterListRequest(mangaId, 0, sourceInfo.lang);
|
||||
await paginatedChapterListRequest(mangaId, 0, source.lang);
|
||||
final chapterList =
|
||||
MBridge.jsonPathToString(paginatedChapterList, r'$.data[*]', '_.')
|
||||
jsonPathToString(paginatedChapterList, r'$.data[*]', '_.')
|
||||
.split('_.');
|
||||
int limit = int.parse(
|
||||
MBridge.jsonPathToString(paginatedChapterList, r'$.limit', ''));
|
||||
jsonPathToString(paginatedChapterList, r'$.limit', ''));
|
||||
int offset = int.parse(
|
||||
MBridge.jsonPathToString(paginatedChapterList, r'$.offset', ''));
|
||||
jsonPathToString(paginatedChapterList, r'$.offset', ''));
|
||||
int total = int.parse(
|
||||
MBridge.jsonPathToString(paginatedChapterList, r'$.total', ''));
|
||||
jsonPathToString(paginatedChapterList, r'$.total', ''));
|
||||
List<MChapter> chapterListA = [];
|
||||
|
||||
final list =
|
||||
@@ -114,11 +114,11 @@ class MangaDex extends MSourceProvider {
|
||||
while (hasMoreResults) {
|
||||
offset += limit;
|
||||
var newRequest =
|
||||
await paginatedChapterListRequest(mangaId, offset, sourceInfo.lang);
|
||||
await paginatedChapterListRequest(mangaId, offset, source.lang);
|
||||
int total =
|
||||
int.parse(MBridge.jsonPathToString(newRequest, r'$.total', ''));
|
||||
int.parse(jsonPathToString(newRequest, r'$.total', ''));
|
||||
final chapterList =
|
||||
MBridge.jsonPathToString(paginatedChapterList, r'$.data[*]', '_.')
|
||||
jsonPathToString(paginatedChapterList, r'$.data[*]', '_.')
|
||||
.split('_.');
|
||||
final list = getChapters(int.parse("${chapterList.length}"), newRequest);
|
||||
chapterListA.addAll(list);
|
||||
@@ -130,10 +130,10 @@ class MangaDex extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<String>> getPageList(MSource sourceInfo, String url) async {
|
||||
Future<List<String>> getPageList(MSource source, String url) async {
|
||||
final urll = "https://api.mangadex.org/at-home/server/$url";
|
||||
|
||||
final res = await MBridge.http('GET', json.encode({"url": urll}));
|
||||
final res = await http('GET', json.encode({"url": urll}));
|
||||
|
||||
final dataRes = json.decode(res);
|
||||
final host = dataRes["baseUrl"];
|
||||
@@ -142,13 +142,13 @@ class MangaDex extends MSourceProvider {
|
||||
return chapterDatas.map((e) => "$host/data/$hash/$e").toList();
|
||||
}
|
||||
|
||||
MPages mangaRes(String res, MSource sourceInfo) {
|
||||
MPages mangaRes(String res, MSource source) {
|
||||
final datasRes = json.decode(res);
|
||||
final resJson = datasRes["data"] as List;
|
||||
List<MManga> mangaList = [];
|
||||
for (var e in resJson) {
|
||||
MManga manga = MManga();
|
||||
manga.name = findTitle(e, sourceInfo.lang);
|
||||
manga.name = findTitle(e, source.lang);
|
||||
manga.imageUrl = getCover(e);
|
||||
manga.link = "/manga/${e["id"]}";
|
||||
mangaList.add(manga);
|
||||
@@ -160,18 +160,18 @@ class MangaDex extends MSourceProvider {
|
||||
List<MChapter> chaptersList = [];
|
||||
String paginatedChapterList = paginatedChapterListA.toString();
|
||||
final dataList =
|
||||
MBridge.jsonPathToList(paginatedChapterList, r'$.data[*]', 0);
|
||||
jsonPathToList(paginatedChapterList, r'$.data[*]', 0);
|
||||
for (var res in dataList) {
|
||||
String scan = "".toString();
|
||||
final groups = MBridge.jsonPathToList(res,
|
||||
final groups = jsonPathToList(res,
|
||||
r'$.relationships[?@.id!="00e03853-1b96-4f41-9542-c71b8692033b"]', 0);
|
||||
String chapName = "".toString();
|
||||
for (var element in groups) {
|
||||
final data = MBridge.getMapValue(element, "attributes", encode: true);
|
||||
final data = getMapValue(element, "attributes", encode: true);
|
||||
if (data.isNotEmpty) {
|
||||
final name = MBridge.getMapValue(data, "name");
|
||||
final name = getMapValue(data, "name");
|
||||
scan += "$name".toString();
|
||||
final username = MBridge.getMapValue(data, "username");
|
||||
final username = getMapValue(data, "username");
|
||||
if (username.isNotEmpty) {
|
||||
if (scan.isEmpty) {
|
||||
scan += "Uploaded by $username".toString();
|
||||
@@ -182,22 +182,22 @@ class MangaDex extends MSourceProvider {
|
||||
if (scan.isEmpty) {
|
||||
scan = "No Group".toString();
|
||||
}
|
||||
final dataRes = MBridge.getMapValue(res, "attributes", encode: true);
|
||||
final dataRes = getMapValue(res, "attributes", encode: true);
|
||||
if (dataRes.isNotEmpty) {
|
||||
final data = MBridge.getMapValue(res, "attributes", encode: true);
|
||||
final volume = MBridge.getMapValue(data, "volume");
|
||||
final data = getMapValue(res, "attributes", encode: true);
|
||||
final volume = getMapValue(data, "volume");
|
||||
if (volume.isNotEmpty) {
|
||||
if (volume != "null") {
|
||||
chapName = "Vol.$volume ".toString();
|
||||
}
|
||||
}
|
||||
final chapter = MBridge.getMapValue(data, "chapter");
|
||||
final chapter = getMapValue(data, "chapter");
|
||||
if (chapter.isNotEmpty) {
|
||||
if (chapter != "null") {
|
||||
chapName += "Ch.$chapter ".toString();
|
||||
}
|
||||
}
|
||||
final title = MBridge.getMapValue(data, "title");
|
||||
final title = getMapValue(data, "title");
|
||||
if (title.isNotEmpty) {
|
||||
if (title != "null") {
|
||||
if (chapName.isNotEmpty) {
|
||||
@@ -209,13 +209,13 @@ class MangaDex extends MSourceProvider {
|
||||
if (chapName.isEmpty) {
|
||||
chapName += "Oneshot".toString();
|
||||
}
|
||||
final date = MBridge.getMapValue(data, "publishAt");
|
||||
final id = MBridge.getMapValue(res, "id");
|
||||
final date = getMapValue(data, "publishAt");
|
||||
final id = getMapValue(res, "id");
|
||||
MChapter chapterr = MChapter();
|
||||
chapterr.name = chapName;
|
||||
chapterr.url = id;
|
||||
chapterr.scanlator = scan;
|
||||
chapterr.dateUpload = MBridge.parseDates(
|
||||
chapterr.dateUpload = parseDates(
|
||||
[date], "yyyy-MM-dd'T'HH:mm:ss+SSS", "en_US")
|
||||
.first;
|
||||
chaptersList.add(chapterr);
|
||||
@@ -229,7 +229,7 @@ class MangaDex extends MSourceProvider {
|
||||
String mangaId, int offset, String lang) async {
|
||||
final url =
|
||||
'https://api.mangadex.org/manga/$mangaId/feed?limit=500&offset=$offset&includes[]=user&includes[]=scanlation_group&order[volume]=desc&order[chapter]=desc&translatedLanguage[]=$lang&includeFuturePublishAt=0&includeEmptyPages=0${getMDXContentRating()}';
|
||||
final res = await MBridge.http('GET', json.encode({"url": url}));
|
||||
final res = await http('GET', json.encode({"url": url}));
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -242,10 +242,10 @@ class MangaDex extends MSourceProvider {
|
||||
String findTitle(Map<String, dynamic> dataRes, String lang) {
|
||||
final altTitlesJ = dataRes["attributes"]["altTitles"];
|
||||
final titleJ = dataRes["attributes"]["title"];
|
||||
final title = MBridge.getMapValue(json.encode(titleJ), "en");
|
||||
final title = getMapValue(json.encode(titleJ), "en");
|
||||
if (title.isEmpty) {
|
||||
for (var r in altTitlesJ) {
|
||||
final altTitle = MBridge.getMapValue(json.encode(r), "en");
|
||||
final altTitle = getMapValue(json.encode(r), "en");
|
||||
if (altTitle.isNotEmpty) {
|
||||
return altTitle;
|
||||
}
|
||||
@@ -270,7 +270,7 @@ class MangaDex extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<MVideo>> getVideoList(MSource sourceInfo, String url) async {
|
||||
Future<List<MVideo>> getVideoList(MSource source, String url) async {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user