mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
code refactor
This commit is contained in:
@@ -1,223 +0,0 @@
|
||||
import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
getPopularManga(MangaModel manga) async {
|
||||
final url =
|
||||
"${manga.baseUrl}/browse?${lang(manga.lang)}&sort=views_a&page=${manga.page}";
|
||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
return mangaElementM(res, manga);
|
||||
}
|
||||
|
||||
String lang(String lang) {
|
||||
lang = lang.replaceAll("-", "_");
|
||||
if (lang == "all") {
|
||||
return "";
|
||||
}
|
||||
return "langs=$lang";
|
||||
}
|
||||
|
||||
getLatestUpdatesManga(MangaModel manga) async {
|
||||
final url =
|
||||
"${manga.baseUrl}/browse?${lang(manga.lang)}&sort=update&page=${manga.page}";
|
||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
return mangaElementM(res, manga);
|
||||
}
|
||||
|
||||
searchManga(MangaModel manga) async {
|
||||
final data = {
|
||||
"url": "${manga.baseUrl}/search?word=${manga.query}&page=${manga.page}",
|
||||
"headers": null,
|
||||
"sourceId": manga.sourceId
|
||||
};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
return mangaElementM(res, manga);
|
||||
}
|
||||
|
||||
getMangaDetail(MangaModel manga) async {
|
||||
final statusList = [
|
||||
{
|
||||
"Ongoing": 0,
|
||||
"Completed": 1,
|
||||
"Cancelled": 3,
|
||||
"Hiatus": 2,
|
||||
}
|
||||
];
|
||||
|
||||
final url = "${manga.baseUrl}${manga.link}";
|
||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
|
||||
final workStatus = MBridge.xpath(
|
||||
res,
|
||||
'//*[@class="attr-item"]/b[contains(text(),"Original work")]/following-sibling::span[1]/text()',
|
||||
'');
|
||||
manga.status = MBridge.parseStatus(workStatus, statusList);
|
||||
|
||||
manga.author = MBridge.xpath(
|
||||
res,
|
||||
'//*[@class="attr-item"]/b[contains(text(),"Authors")]/following-sibling::span[1]/text()',
|
||||
'');
|
||||
manga.genre = MBridge.xpath(
|
||||
res,
|
||||
'//*[@class="attr-item"]/b[contains(text(),"Genres")]/following-sibling::span[1]/text()',
|
||||
'')
|
||||
.split(",");
|
||||
manga.description = MBridge.xpath(res, '//*[@class="limit-html"]/text()', '');
|
||||
|
||||
List<String> chapsElement =
|
||||
MBridge.querySelectorAll(res, "div.main div.p-2", 2, "", 0, 0, '-.')
|
||||
.split('-.');
|
||||
List<String> times = [];
|
||||
List<String> chapsUrls = [];
|
||||
List<String> chapsNames = [];
|
||||
List<String> scanlators = [];
|
||||
for (var element in MBridge.listParse(chapsElement, 0)) {
|
||||
final urlElement = MBridge.querySelector(element, "a.chapt", 2, "");
|
||||
final group = MBridge.xpath(element, '//*[@class="extra"]/a/text()', '');
|
||||
final name = MBridge.xpath(urlElement, '//a/text()', '');
|
||||
final url = MBridge.xpath(urlElement, '//a/@href', '');
|
||||
final time = MBridge.xpath(
|
||||
element, '//*[@class="extra"]/i[@class="ps-3"]/text()', '');
|
||||
times.add(time);
|
||||
chapsUrls.add(url);
|
||||
scanlators.add(group);
|
||||
chapsNames.add(name.replaceAll("\n ", "").replaceAll(" ", ""));
|
||||
}
|
||||
|
||||
manga.urls = chapsUrls;
|
||||
manga.names = chapsNames;
|
||||
manga.chaptersScanlators = scanlators;
|
||||
manga.chaptersDateUploads = MBridge.listParse(
|
||||
MBridge.listParseDateTime(times, "MMM dd,yyyy", "en"), 0);
|
||||
|
||||
return manga;
|
||||
}
|
||||
|
||||
getChapterUrl(MangaModel manga) async {
|
||||
final datas = {
|
||||
"url": "${manga.baseUrl}${manga.link}",
|
||||
"headers": null,
|
||||
"sourceId": manga.sourceId
|
||||
};
|
||||
final res = await MBridge.http(json.encode(datas), 0);
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
final script = MBridge.xpath(
|
||||
res,
|
||||
'//script[contains(text(), "imgHttpLis") and contains(text(), "batoWord") and contains(text(), "batoPass")]/text()',
|
||||
"");
|
||||
final imgHttpLisString = MBridge.subString(
|
||||
MBridge.subString(script, 'const imgHttpLis =', 2), ';', 0);
|
||||
List<String> imgHttpLis = MBridge.jsonDecodeToList(imgHttpLisString, 0);
|
||||
final batoWord = MBridge.subString(
|
||||
MBridge.subString(script, 'const batoWord =', 2), ';', 0);
|
||||
final batoPass = MBridge.subString(
|
||||
MBridge.subString(script, 'const batoPass =', 2), ';', 0);
|
||||
final evaluatedPass = MBridge.deobfuscateJsPassword(batoPass);
|
||||
final imgAccListString =
|
||||
MBridge.decryptAESCryptoJS(batoWord.replaceAll('"', ""), evaluatedPass);
|
||||
List<String> imgAccList = MBridge.jsonDecodeToList(imgAccListString, 0);
|
||||
List<String> pagesUrl = [];
|
||||
for (int i = 0; i < imgHttpLis.length; i++) {
|
||||
final imgUrl = MBridge.listParse(imgHttpLis, 0)[i];
|
||||
final imgAcc = MBridge.listParse(imgAccList, 0)[i];
|
||||
pagesUrl.add("$imgUrl?$imgAcc");
|
||||
}
|
||||
|
||||
return pagesUrl;
|
||||
}
|
||||
|
||||
MangaModel mangaElementM(String res, MangaModel manga) async {
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
final lang = manga.lang.replaceAll("-", "_");
|
||||
List<String> resB = MBridge.querySelectorAll(
|
||||
res, "div#series-list div.col", 2, "", 0, 0, '-.')
|
||||
.split('-.');
|
||||
List<String> images = [];
|
||||
List<String> urls = [];
|
||||
List<String> names = [];
|
||||
|
||||
for (var element in MBridge.listParse(resB, 0)) {
|
||||
if (manga.lang == "all") {
|
||||
final item = MBridge.querySelector(element, "a.item-cover", 2, "");
|
||||
final img = MBridge.querySelector(item, "img", 3, "src");
|
||||
final url = MBridge.querySelector(item, "a", 3, "href");
|
||||
images.add(img);
|
||||
urls.add(url);
|
||||
final title = MBridge.querySelector(element, "a.item-title", 0, "");
|
||||
names.add(title);
|
||||
} else if (manga.lang == "en") {
|
||||
if (element.contains('no-flag')) {
|
||||
final item = MBridge.querySelector(element, "a.item-cover", 2, "");
|
||||
final img = MBridge.querySelector(item, "img", 3, "src");
|
||||
final url = MBridge.querySelector(item, "a", 3, "href");
|
||||
images.add(img);
|
||||
urls.add(url);
|
||||
final title = MBridge.querySelector(element, "a.item-title", 0, "");
|
||||
names.add(title);
|
||||
}
|
||||
} else {
|
||||
if (element.contains('data-lang="$lang"')) {
|
||||
final item = MBridge.querySelector(element, "a.item-cover", 2, "");
|
||||
final img = MBridge.querySelector(item, "img", 3, "src");
|
||||
final url = MBridge.querySelector(item, "a", 3, "href");
|
||||
images.add(img);
|
||||
urls.add(url);
|
||||
final title = MBridge.querySelector(element, "a.item-title", 0, "");
|
||||
names.add(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
manga.urls = urls;
|
||||
manga.names = names;
|
||||
manga.images = images;
|
||||
final nextPage = MBridge.xpath(
|
||||
res,
|
||||
'//li[@class="page-item disabled"]/a/span[contains(text(),"»")]/text()',
|
||||
"");
|
||||
if (nextPage.isEmpty) {
|
||||
manga.hasNextPage = true;
|
||||
} else {
|
||||
manga.hasNextPage = false;
|
||||
}
|
||||
return manga;
|
||||
}
|
||||
|
||||
Map<String, String> getMirrorPref() {
|
||||
return {
|
||||
"bato.to": "https://bato.to",
|
||||
"batocomic.com": "https://batocomic.com",
|
||||
"batocomic.net": "https://batocomic.net",
|
||||
"batocomic.org": "https://batocomic.org",
|
||||
"batotoo.com": "https://batotoo.com",
|
||||
"batotwo.com": "https://batotwo.com",
|
||||
"battwo.com": "https://battwo.com",
|
||||
"comiko.net": "https://comiko.net",
|
||||
"comiko.org": "https://comiko.org",
|
||||
"mangatoto.com": "https://mangatoto.com",
|
||||
"mangatoto.net": "https://mangatoto.net",
|
||||
"mangatoto.org": "https://mangatoto.org",
|
||||
"readtoto.com": "https://readtoto.com",
|
||||
"readtoto.net": "https://readtoto.net",
|
||||
"readtoto.org": "https://readtoto.org",
|
||||
"dto.to": "https://dto.to",
|
||||
"hto.to": "https://hto.to",
|
||||
"mto.to": "https://mto.to",
|
||||
"wto.to": "https://wto.to",
|
||||
"xbato.com": "https://xbato.com",
|
||||
"xbato.net": "https://xbato.net",
|
||||
"xbato.org": "https://xbato.org",
|
||||
"zbato.com": "https://zbato.com",
|
||||
"zbato.net": "https://zbato.net",
|
||||
"zbato.org": "https://zbato.org",
|
||||
};
|
||||
}
|
||||
187
manga/src/all/batoto/batoto-v0.0.2.dart
Normal file
187
manga/src/all/batoto/batoto-v0.0.2.dart
Normal file
@@ -0,0 +1,187 @@
|
||||
import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
getPopularManga(MangaModel manga) async {
|
||||
final url = "${manga.baseUrl}/browse?${lang(manga.lang)}&sort=views_a&page=${manga.page}";
|
||||
final data = {"url": url, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
return mangaElementM(res, manga);
|
||||
}
|
||||
|
||||
String lang(String lang) {
|
||||
lang = lang.replaceAll("-", "_");
|
||||
if (lang == "all") {
|
||||
return "";
|
||||
}
|
||||
return "langs=$lang";
|
||||
}
|
||||
|
||||
getLatestUpdatesManga(MangaModel manga) async {
|
||||
final url = "${manga.baseUrl}/browse?${lang(manga.lang)}&sort=update&page=${manga.page}";
|
||||
final data = {"url": url, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
return mangaElementM(res, manga);
|
||||
}
|
||||
|
||||
searchManga(MangaModel manga) async {
|
||||
final data = {"url": "${manga.baseUrl}/search?word=${manga.query}&page=${manga.page}", "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
return mangaElementM(res, manga);
|
||||
}
|
||||
|
||||
getMangaDetail(MangaModel manga) async {
|
||||
final statusList = [
|
||||
{
|
||||
"Ongoing": 0,
|
||||
"Completed": 1,
|
||||
"Cancelled": 3,
|
||||
"Hiatus": 2,
|
||||
}
|
||||
];
|
||||
|
||||
final url = "${manga.baseUrl}${manga.link}";
|
||||
final data = {"url": url, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
|
||||
final workStatus = MBridge.xpath(
|
||||
res, '//*[@class="attr-item"]/b[contains(text(),"Original work")]/following-sibling::span[1]/text()')
|
||||
.first;
|
||||
manga.status = MBridge.parseStatus(workStatus, statusList);
|
||||
|
||||
manga.author =
|
||||
MBridge.xpath(res, '//*[@class="attr-item"]/b[contains(text(),"Authors")]/following-sibling::span[1]/text()')
|
||||
.first;
|
||||
manga.genre =
|
||||
MBridge.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;
|
||||
|
||||
List<String> chapsElement =
|
||||
MBridge.querySelectorAll(res, selector: "div.main div.p-2", typeElement: 2, attributes: "", typeRegExp: 0);
|
||||
List<String> times = [];
|
||||
List<String> chapsUrls = [];
|
||||
List<String> chapsNames = [];
|
||||
List<String> scanlators = [];
|
||||
for (var element in chapsElement) {
|
||||
final urlElement =
|
||||
MBridge.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 time = MBridge.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(" ", ""));
|
||||
}
|
||||
|
||||
manga.urls = chapsUrls;
|
||||
manga.names = chapsNames;
|
||||
manga.chaptersScanlators = scanlators;
|
||||
manga.chaptersDateUploads = MBridge.listParseDateTime(times, "MMM dd,yyyy", "en");
|
||||
|
||||
return manga;
|
||||
}
|
||||
|
||||
getChapterUrl(MangaModel manga) async {
|
||||
final datas = {"url": "${manga.baseUrl}${manga.link}", "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
final script = MBridge.xpath(res,
|
||||
'//script[contains(text(), "imgHttpLis") and contains(text(), "batoWord") and contains(text(), "batoPass")]/text()')
|
||||
.first;
|
||||
final imgHttpLisString = MBridge.substringBefore(MBridge.substringAfterLast(script, 'const imgHttpLis ='), ';');
|
||||
var imgHttpLis = json.decode(imgHttpLisString);
|
||||
final batoWord = MBridge.substringBefore(MBridge.substringAfterLast(script, 'const batoWord ='), ';');
|
||||
final batoPass = MBridge.substringBefore(MBridge.substringAfterLast(script, 'const batoPass ='), ';');
|
||||
final evaluatedPass = MBridge.deobfuscateJsPassword(batoPass);
|
||||
final imgAccListString = MBridge.decryptAESCryptoJS(batoWord.replaceAll('"', ""), evaluatedPass);
|
||||
var imgAccList = json.decode(imgAccListString);
|
||||
List<String> pagesUrl = [];
|
||||
for (int i = 0; i < imgHttpLis.length; i++) {
|
||||
String imgUrl = imgHttpLis[i];
|
||||
String imgAcc = imgAccList[i];
|
||||
pagesUrl.add("$imgUrl?$imgAcc");
|
||||
}
|
||||
|
||||
return pagesUrl;
|
||||
}
|
||||
|
||||
MangaModel mangaElementM(String res, MangaModel manga) async {
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
final lang = manga.lang.replaceAll("-", "_");
|
||||
var resB =
|
||||
MBridge.querySelectorAll(res, selector: "div#series-list div.col", typeElement: 2, attributes: "", typeRegExp: 0);
|
||||
List<String> images = [];
|
||||
List<String> urls = [];
|
||||
List<String> names = [];
|
||||
|
||||
for (var element in resB) {
|
||||
if (manga.lang == "all" ||
|
||||
manga.lang == "en" && element.contains('no-flag') ||
|
||||
element.contains('data-lang="$lang"')) {
|
||||
final item =
|
||||
MBridge.querySelectorAll(element, selector: "a.item-cover", typeElement: 2, attributes: "", typeRegExp: 0)
|
||||
.first;
|
||||
final img =
|
||||
MBridge.querySelectorAll(item, selector: "img", typeElement: 3, attributes: "src", typeRegExp: 0).first;
|
||||
final url =
|
||||
MBridge.querySelectorAll(item, selector: "a", typeElement: 3, attributes: "href", typeRegExp: 0).first;
|
||||
images.add(img);
|
||||
urls.add(url);
|
||||
final title =
|
||||
MBridge.querySelectorAll(element, selector: "a.item-title", typeElement: 0, attributes: "", typeRegExp: 0)
|
||||
.first;
|
||||
names.add(title);
|
||||
}
|
||||
}
|
||||
manga.urls = urls;
|
||||
manga.names = names;
|
||||
manga.images = images;
|
||||
final nextPage = MBridge.xpath(res, '//li[@class="page-item disabled"]/a/span[contains(text(),"»")]/text()').first;
|
||||
if (nextPage.isEmpty) {
|
||||
manga.hasNextPage = true;
|
||||
} else {
|
||||
manga.hasNextPage = false;
|
||||
}
|
||||
return manga;
|
||||
}
|
||||
|
||||
Map<String, String> getMirrorPref() {
|
||||
return {
|
||||
"bato.to": "https://bato.to",
|
||||
"batocomic.com": "https://batocomic.com",
|
||||
"batocomic.net": "https://batocomic.net",
|
||||
"batocomic.org": "https://batocomic.org",
|
||||
"batotoo.com": "https://batotoo.com",
|
||||
"batotwo.com": "https://batotwo.com",
|
||||
"battwo.com": "https://battwo.com",
|
||||
"comiko.net": "https://comiko.net",
|
||||
"comiko.org": "https://comiko.org",
|
||||
"mangatoto.com": "https://mangatoto.com",
|
||||
"mangatoto.net": "https://mangatoto.net",
|
||||
"mangatoto.org": "https://mangatoto.org",
|
||||
"readtoto.com": "https://readtoto.com",
|
||||
"readtoto.net": "https://readtoto.net",
|
||||
"readtoto.org": "https://readtoto.org",
|
||||
"dto.to": "https://dto.to",
|
||||
"hto.to": "https://hto.to",
|
||||
"mto.to": "https://mto.to",
|
||||
"wto.to": "https://wto.to",
|
||||
"xbato.com": "https://xbato.com",
|
||||
"xbato.net": "https://xbato.net",
|
||||
"xbato.org": "https://xbato.org",
|
||||
"zbato.com": "https://zbato.com",
|
||||
"zbato.net": "https://zbato.net",
|
||||
"zbato.org": "https://zbato.org",
|
||||
};
|
||||
}
|
||||
@@ -2,13 +2,13 @@ import 'package:bridge_lib/bridge_lib.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
getLatestUpdatesManga(MangaModel manga) async {
|
||||
final url =
|
||||
"${manga.apiUrl}/v1.0/search?sort=uploaded&page=${manga.page}&tachiyomi=true";
|
||||
final url = "${manga.apiUrl}/v1.0/search?sort=uploaded&page=${manga.page}&tachiyomi=true";
|
||||
final data = {"url": url, "headers": getHeader(manga.baseUrl)};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
|
||||
manga.names = MBridge.jsonPathToList(res, r'$.title', 0);
|
||||
List<String> ids = MBridge.jsonPathToList(res, r'$.hid', 0);
|
||||
List<String> mangaUrls = [];
|
||||
@@ -32,59 +32,43 @@ getMangaDetail(MangaModel manga) async {
|
||||
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
|
||||
final urll =
|
||||
"${manga.apiUrl}${manga.link.replaceAll("#", '')}?tachiyomi=true";
|
||||
final urll = "${manga.apiUrl}${manga.link.replaceAll("#", '')}?tachiyomi=true";
|
||||
final data = {"url": urll, "headers": headers};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.author = MBridge.jsonPathToString(res, r'$.authors[*].name', '');
|
||||
manga.genre =
|
||||
MBridge.jsonPathToString(res, r'$.genres[*].name', "_.").split("_.");
|
||||
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.status = MBridge.parseStatus(MBridge.jsonPathToString(res, r'$..comic.status', ''), statusList);
|
||||
final chapUrlReq =
|
||||
"${manga.apiUrl}${manga.link.replaceAll("#", '')}chapters?lang=${manga.lang}&tachiyomi=true&page=1";
|
||||
final dataReq = {"url": chapUrlReq, "headers": headers};
|
||||
final request = await MBridge.http(json.encode(dataReq), 0);
|
||||
final request = await MBridge.http('GET', json.encode(dataReq));
|
||||
var total = MBridge.jsonPathToString(request, r'$.total', '');
|
||||
final chapterLimit = MBridge.intParse("$total");
|
||||
final newChapUrlReq =
|
||||
"${manga.apiUrl}${manga.link.replaceAll("#", '')}chapters?limit=$chapterLimit&lang=${manga.lang}&tachiyomi=true&page=1";
|
||||
|
||||
final newDataReq = {"url": newChapUrlReq, "headers": headers};
|
||||
final newRequest = await MBridge.http(json.encode(newDataReq), 0);
|
||||
final newRequest = await MBridge.http('GET', json.encode(newDataReq));
|
||||
|
||||
manga.urls = MBridge.jsonPathToString(newRequest, r'$.chapters[*].hid', "_.")
|
||||
.split("_.");
|
||||
final chapDate =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].created_at', "_.")
|
||||
.split("_.");
|
||||
manga.chaptersDateUploads = MBridge.listParse(
|
||||
MBridge.listParseDateTime(chapDate, "yyyy-MM-dd'T'HH:mm:ss'Z'", "en"), 0);
|
||||
manga.chaptersVolumes =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].vol', "_.")
|
||||
.split("_.");
|
||||
manga.chaptersScanlators =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].group_name', "_.")
|
||||
.split("_.");
|
||||
manga.names =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].title', "_.")
|
||||
.split("_.");
|
||||
manga.chaptersChaps =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].chap', "_.")
|
||||
.split("_.");
|
||||
manga.urls = MBridge.jsonPathToString(newRequest, r'$.chapters[*].hid', "_.").split("_.");
|
||||
final chapDate = MBridge.jsonPathToString(newRequest, r'$.chapters[*].created_at', "_.").split("_.");
|
||||
manga.chaptersDateUploads =MBridge.listParseDateTime(chapDate, "yyyy-MM-dd'T'HH:mm:ss'Z'", "en");
|
||||
manga.chaptersVolumes = MBridge.jsonPathToString(newRequest, r'$.chapters[*].vol', "_.").split("_.");
|
||||
manga.chaptersScanlators = MBridge.jsonPathToString(newRequest, r'$.chapters[*].group_name', "_.").split("_.");
|
||||
manga.names = MBridge.jsonPathToString(newRequest, r'$.chapters[*].title', "_.").split("_.");
|
||||
manga.chaptersChaps = MBridge.jsonPathToString(newRequest, r'$.chapters[*].chap', "_.").split("_.");
|
||||
|
||||
return manga;
|
||||
}
|
||||
|
||||
getPopularManga(MangaModel manga) async {
|
||||
final urll =
|
||||
"${manga.apiUrl}/v1.0/search?sort=follow&page=${manga.page}&tachiyomi=true";
|
||||
final urll = "${manga.apiUrl}/v1.0/search?sort=follow&page=${manga.page}&tachiyomi=true";
|
||||
final data = {"url": urll, "headers": getHeader(manga.baseUrl)};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
@@ -102,7 +86,7 @@ getPopularManga(MangaModel manga) async {
|
||||
searchManga(MangaModel manga) async {
|
||||
final urll = "${manga.apiUrl}/v1.0/search?q=${manga.query}&tachiyomi=true";
|
||||
final data = {"url": urll, "headers": getHeader(manga.baseUrl)};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
@@ -120,19 +104,17 @@ searchManga(MangaModel manga) async {
|
||||
getChapterUrl(MangaModel manga) async {
|
||||
final url = "${manga.apiUrl}/chapter/${manga.link}?tachiyomi=true";
|
||||
final data = {"url": url, "headers": getHeader(url)};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
return MBridge.jsonPathToString(res, r'$.chapter.images[*].url', '_.')
|
||||
.split('_.');
|
||||
return MBridge.jsonPathToString(res, r'$.chapter.images[*].url', '_.').split('_.');
|
||||
}
|
||||
|
||||
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"
|
||||
'User-Agent': "Tachiyomi Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:110.0) Gecko/20100101 Firefox/110.0"
|
||||
};
|
||||
return headers;
|
||||
}
|
||||
@@ -12,7 +12,7 @@ getPopularManga(MangaModel manga) async {
|
||||
final url =
|
||||
"https://api.mangadex.org/manga?limit=20&offset=$page&availableTranslatedLanguage[]=en&includes[]=cover_art${getMDXContentRating()}&order[followedCount]=desc";
|
||||
final datas = {"url": url, "headers": null};
|
||||
final res = await MBridge.http(json.encode(datas), 0);
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
@@ -51,12 +51,12 @@ MangaModel getChapters(
|
||||
r'$.relationships[?@.id!="00e03853-1b96-4f41-9542-c71b8692033b"]', 0);
|
||||
String chapName = "".toString();
|
||||
for (var element in groups) {
|
||||
final data = MBridge.getMapValue(element, "attributes", 1);
|
||||
final data = MBridge.getMapValue(element, "attributes", encode: true);
|
||||
if (data.isEmpty) {
|
||||
} else {
|
||||
final name = MBridge.getMapValue(data, "name", 0);
|
||||
final name = MBridge.getMapValue(data, "name");
|
||||
scan += "$name".toString();
|
||||
final username = MBridge.getMapValue(data, "username", 0);
|
||||
final username = MBridge.getMapValue(data, "username");
|
||||
if (username.isEmpty) {
|
||||
} else {
|
||||
if (scan.isEmpty) {
|
||||
@@ -68,11 +68,11 @@ MangaModel getChapters(
|
||||
if (scan.isEmpty) {
|
||||
scan = "No Group".toString();
|
||||
}
|
||||
final dataRes = MBridge.getMapValue(res, "attributes", 1);
|
||||
final dataRes = MBridge.getMapValue(res, "attributes", encode: true);
|
||||
if (dataRes.isEmpty) {
|
||||
} else {
|
||||
final data = MBridge.getMapValue(res, "attributes", 1);
|
||||
final volume = MBridge.getMapValue(data, "volume", 0);
|
||||
final data = MBridge.getMapValue(res, "attributes", encode: true);
|
||||
final volume = MBridge.getMapValue(data, "volume");
|
||||
if (volume.isEmpty) {
|
||||
} else {
|
||||
if (volume == "null") {
|
||||
@@ -80,7 +80,7 @@ MangaModel getChapters(
|
||||
chapName = "Vol.$volume ".toString();
|
||||
}
|
||||
}
|
||||
final chapter = MBridge.getMapValue(data, "chapter", 0);
|
||||
final chapter = MBridge.getMapValue(data, "chapter");
|
||||
if (chapter.isEmpty) {
|
||||
} else {
|
||||
if (chapter == "null") {
|
||||
@@ -88,7 +88,7 @@ MangaModel getChapters(
|
||||
chapName += "Ch.$chapter ".toString();
|
||||
}
|
||||
}
|
||||
final title = MBridge.getMapValue(data, "title", 0);
|
||||
final title = MBridge.getMapValue(data, "title");
|
||||
if (title.isEmpty) {
|
||||
} else {
|
||||
if (title == "null") {
|
||||
@@ -103,8 +103,8 @@ MangaModel getChapters(
|
||||
if (chapName.isEmpty) {
|
||||
chapName += "Oneshot".toString();
|
||||
}
|
||||
final date = MBridge.getMapValue(data, "publishAt", 0);
|
||||
final id = MBridge.getMapValue(res, "id", 0);
|
||||
final date = MBridge.getMapValue(data, "publishAt");
|
||||
final id = MBridge.getMapValue(res, "id");
|
||||
chapterUrl += "._$id";
|
||||
chapDate += "._._$date";
|
||||
scanlators += "._$scan";
|
||||
@@ -132,7 +132,7 @@ getMangaDetail(MangaModel manga) async {
|
||||
final url =
|
||||
"https://api.mangadex.org${manga.link}?includes[]=cover_art&includes[]=author&includes[]=artist";
|
||||
final datas = {"url": url, "headers": null};
|
||||
final res = await MBridge.http(json.encode(datas), 0);
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
@@ -254,7 +254,7 @@ getLatestUpdatesManga(MangaModel manga) async {
|
||||
final urll =
|
||||
"https://api.mangadex.org/chapter?limit=20&offset=$page&translatedLanguage[]=${manga.lang}&includeFutureUpdates=0&order[publishAt]=desc&includeFuturePublishAt=0&includeEmptyPages=0";
|
||||
final datas = {"url": urll, "headers": null};
|
||||
final ress = await MBridge.http(json.encode(datas), 0);
|
||||
final ress = await MBridge.http('GET', json.encode(datas));
|
||||
if (ress.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ getLatestUpdatesManga(MangaModel manga) async {
|
||||
final newUrl =
|
||||
"https://api.mangadex.org/manga?includes[]=cover_art&limit=${mangaIds.length}${getMDXContentRating()}$mangaa";
|
||||
final datass = {"url": newUrl, "headers": null};
|
||||
final res = await MBridge.http(json.encode(datass), 0);
|
||||
final res = await MBridge.http('GET', json.encode(datass));
|
||||
List<String> data = MBridge.listParse(
|
||||
MBridge.jsonPathToString(res, r'$.data[*]', '_.').split("_."), 0);
|
||||
List<String> urlList = [];
|
||||
@@ -293,7 +293,7 @@ searchManga(MangaModel manga) async {
|
||||
final url =
|
||||
"https://api.mangadex.org/manga?includes[]=cover_art&offset=0&limit=20&title=${manga.query}${getMDXContentRating()}&order[followedCount]=desc&availableTranslatedLanguage[]=${manga.lang}";
|
||||
final datas = {"url": url, "headers": null};
|
||||
final res = await MBridge.http(json.encode(datas), 0);
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
@@ -319,7 +319,7 @@ searchManga(MangaModel manga) async {
|
||||
getChapterUrl(MangaModel manga) async {
|
||||
final url = "https://api.mangadex.org/at-home/server/${manga.link}";
|
||||
final data = {"url": url, "headers": null};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
@@ -345,7 +345,7 @@ Future<String> paginatedChapterListRequest(
|
||||
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 datas = {"url": url, "headers": null};
|
||||
return await MBridge.http(json.encode(datas), 0);
|
||||
return await MBridge.http('GET', json.encode(datas));
|
||||
}
|
||||
|
||||
String findTitle(String dataRes, int mangaIndex, String lang) {
|
||||
Reference in New Issue
Block a user