mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
Refactor
This commit is contained in:
@@ -4,21 +4,21 @@ import 'dart:convert';
|
||||
class Batoto extends MProvider {
|
||||
Batoto();
|
||||
|
||||
final Client client = Client();
|
||||
|
||||
@override
|
||||
Future<MPages> getPopular(MSource source, int page) async {
|
||||
final url =
|
||||
"${preferenceMirror(source.id)}/browse?${lang(source.lang)}&sort=views_a&page=$page";
|
||||
final data = {"url": url};
|
||||
final res = await http('GET', json.encode(data));
|
||||
final res = (await client.get(Uri.parse(
|
||||
"${preferenceMirror(source.id)}/browse?${lang(source.lang)}&sort=views_a&page=$page")))
|
||||
.body;
|
||||
return mangaElementM(res, source);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||
final url =
|
||||
"${preferenceMirror(source.id)}/browse?${lang(source.lang)}&sort=update&page=$page";
|
||||
final data = {"url": url};
|
||||
final res = await http('GET', json.encode(data));
|
||||
final res = (await client.get(Uri.parse(
|
||||
"${preferenceMirror(source.id)}/browse?${lang(source.lang)}&sort=update&page=$page")))
|
||||
.body;
|
||||
return mangaElementM(res, source);
|
||||
}
|
||||
|
||||
@@ -52,9 +52,7 @@ class Batoto extends MProvider {
|
||||
}
|
||||
url += "${source.lang}";
|
||||
}
|
||||
}
|
||||
//
|
||||
else if (filter.type == "GenreGroupFilter") {
|
||||
} else if (filter.type == "GenreGroupFilter") {
|
||||
final included = (filter.state as List)
|
||||
.where((e) => e.state == 1 ? true : false)
|
||||
.toList();
|
||||
@@ -100,8 +98,7 @@ class Batoto extends MProvider {
|
||||
url += "${ll(url)}chapters=$min-$max";
|
||||
}
|
||||
|
||||
final data = {"url": url};
|
||||
final res = await http('GET', json.encode(data));
|
||||
final res = (await client.get(Uri.parse(url))).body;
|
||||
return mangaElementM(res, source);
|
||||
}
|
||||
|
||||
@@ -111,8 +108,9 @@ class Batoto extends MProvider {
|
||||
{"Ongoing": 0, "Completed": 1, "Cancelled": 3, "Hiatus": 2}
|
||||
];
|
||||
|
||||
final data = {"url": "${preferenceMirror(source.id)}$url"};
|
||||
final res = await http('GET', json.encode(data));
|
||||
final res =
|
||||
(await client.get(Uri.parse("${preferenceMirror(source.id)}$url")))
|
||||
.body;
|
||||
MManga manga = MManga();
|
||||
final workStatus = xpath(res,
|
||||
'//*[@class="attr-item"]/b[contains(text(),"Original work")]/following-sibling::span[1]/text()')
|
||||
@@ -164,9 +162,9 @@ class Batoto extends MProvider {
|
||||
|
||||
@override
|
||||
Future<List<String>> getPageList(MSource source, String url) async {
|
||||
final datas = {"url": "${preferenceMirror(source.id)}$url"};
|
||||
final res = await http('GET', json.encode(datas));
|
||||
|
||||
final res =
|
||||
(await client.get(Uri.parse("${preferenceMirror(source.id)}$url")))
|
||||
.body;
|
||||
final script = xpath(res,
|
||||
'//script[contains(text(), "imgHttpLis") and contains(text(), "batoWord") and contains(text(), "batoPass")]/text()')
|
||||
.first;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import '../../../../model/source.dart';
|
||||
|
||||
const _batotoVersion = "0.0.55";
|
||||
const _batotoVersion = "0.0.6";
|
||||
const _batotoSourceCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/manga/src/all/batoto/batoto.dart";
|
||||
|
||||
|
||||
@@ -4,21 +4,25 @@ import 'dart:convert';
|
||||
class ComickFun extends MProvider {
|
||||
ComickFun();
|
||||
|
||||
final Client client = Client();
|
||||
|
||||
@override
|
||||
Future<MPages> getPopular(MSource source, int page) async {
|
||||
final url =
|
||||
"${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));
|
||||
final res = (await client.get(
|
||||
Uri.parse(
|
||||
"${source.apiUrl}/v1.0/search?sort=follow&page=$page&tachiyomi=true"),
|
||||
headers: getHeader(source.baseUrl)))
|
||||
.body;
|
||||
return mangaRes(res);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||
final url =
|
||||
"${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));
|
||||
final res = (await client.get(
|
||||
Uri.parse(
|
||||
"${source.apiUrl}/v1.0/search?sort=uploaded&page=$page&tachiyomi=true"),
|
||||
headers: getHeader(source.baseUrl)))
|
||||
.body;
|
||||
return mangaRes(res);
|
||||
}
|
||||
|
||||
@@ -100,8 +104,10 @@ class ComickFun extends MProvider {
|
||||
}
|
||||
url += "${ll(url)}page=$page&tachiyomi=true";
|
||||
}
|
||||
final data = {"url": url, "headers": getHeader(source.baseUrl)};
|
||||
final res = await http('GET', json.encode(data));
|
||||
|
||||
final res =
|
||||
(await client.get(Uri.parse(url), headers: getHeader(source.baseUrl)))
|
||||
.body;
|
||||
return mangaRes(res);
|
||||
}
|
||||
|
||||
@@ -110,12 +116,12 @@ class ComickFun extends MProvider {
|
||||
final statusList = [
|
||||
{"1": 0, "2": 1, "3": 3, "4": 2}
|
||||
];
|
||||
|
||||
final headers = getHeader(source.baseUrl);
|
||||
|
||||
final urll = "${source.apiUrl}${url.replaceAll("#", '')}?tachiyomi=true";
|
||||
final data = {"url": urll, "headers": headers};
|
||||
final res = await http('GET', json.encode(data));
|
||||
final res = (await client.get(
|
||||
Uri.parse(
|
||||
"${source.apiUrl}${url.replaceAll("#", '')}?tachiyomi=true"),
|
||||
headers: headers))
|
||||
.body;
|
||||
MManga manga = MManga();
|
||||
manga.author = jsonPathToString(res, r'$.authors[*].name', '');
|
||||
manga.genre = jsonPathToString(res, r'$.genres[*].name', "_.").split("_.");
|
||||
@@ -124,15 +130,15 @@ class ComickFun extends MProvider {
|
||||
parseStatus(jsonPathToString(res, r'$..comic.status', ''), statusList);
|
||||
final chapUrlReq =
|
||||
"${source.apiUrl}${url.replaceAll("#", '')}chapters?lang=${source.lang}&tachiyomi=true&page=1";
|
||||
final dataReq = {"url": chapUrlReq, "headers": headers};
|
||||
final request = await http('GET', json.encode(dataReq));
|
||||
final request =
|
||||
(await client.get(Uri.parse(chapUrlReq), headers: headers)).body;
|
||||
var total = jsonPathToString(request, r'$.total', '');
|
||||
final chapterLimit = int.parse(total);
|
||||
final newChapUrlReq =
|
||||
"${source.apiUrl}${url.replaceAll("#", '')}chapters?limit=$chapterLimit&lang=${source.lang}&tachiyomi=true&page=1";
|
||||
|
||||
final newDataReq = {"url": newChapUrlReq, "headers": headers};
|
||||
final newRequest = await http('GET', json.encode(newDataReq));
|
||||
final newRequest =
|
||||
(await client.get(Uri.parse(newChapUrlReq), headers: headers)).body;
|
||||
|
||||
final chapsUrls =
|
||||
jsonPathToString(newRequest, r'$.chapters[*].hid', "_.").split("_.");
|
||||
@@ -180,9 +186,10 @@ class ComickFun extends MProvider {
|
||||
|
||||
@override
|
||||
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 http('GET', json.encode(data));
|
||||
final res = (await client.get(
|
||||
Uri.parse("${source.apiUrl}/chapter/$url?tachiyomi=true"),
|
||||
headers: getHeader(url)))
|
||||
.body;
|
||||
return jsonPathToString(res, r'$.chapter.images[*].url', '_.').split('_.');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import '../../../../model/source.dart';
|
||||
|
||||
const _comickVersion = "0.0.5";
|
||||
const _comickVersion = "0.0.55";
|
||||
const _comickSourceCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/manga/src/all/comick/comick.dart";
|
||||
|
||||
|
||||
@@ -4,23 +4,23 @@ import 'dart:convert';
|
||||
class MangaDex extends MProvider {
|
||||
MangaDex();
|
||||
|
||||
final Client client = Client();
|
||||
|
||||
@override
|
||||
Future<MPages> getPopular(MSource source, int page) async {
|
||||
page = (20 * (page - 1));
|
||||
final url =
|
||||
"https://api.mangadex.org/manga?limit=20&offset=$page&availableTranslatedLanguage[]=${source.lang}&includes[]=cover_art${preferenceContentRating(source.id)}${preferenceOriginalLanguages(source.id)}&order[followedCount]=desc";
|
||||
final datas = {"url": url};
|
||||
final res = await http('GET', json.encode(datas));
|
||||
final res = (await client.get(Uri.parse(url))).body;
|
||||
return mangaRes(res, source);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||
page = (20 * (page - 1));
|
||||
final urll =
|
||||
final url =
|
||||
"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 http('GET', json.encode(datas));
|
||||
final ress = (await client.get(Uri.parse(url))).body;
|
||||
final mangaIds =
|
||||
jsonPathToString(ress, r'$.data[*].relationships[*].id', '.--')
|
||||
.split('.--');
|
||||
@@ -30,7 +30,7 @@ class MangaDex extends MProvider {
|
||||
}
|
||||
final newUrl =
|
||||
"https://api.mangadex.org/manga?includes[]=cover_art&limit=${mangaIds.length}${preferenceContentRating(source.id)}${preferenceOriginalLanguages(source.id)}$mangaIdss";
|
||||
final res = await http('GET', json.encode({"url": newUrl}));
|
||||
final res = (await client.get(Uri.parse(newUrl))).body;
|
||||
return mangaRes(res, source);
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ class MangaDex extends MProvider {
|
||||
}
|
||||
}
|
||||
|
||||
final res = await http('GET', json.encode({"url": url}));
|
||||
final res = (await client.get(Uri.parse(url))).body;
|
||||
return mangaRes(res, source);
|
||||
}
|
||||
|
||||
@@ -149,9 +149,9 @@ class MangaDex extends MProvider {
|
||||
{"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 http('GET', json.encode({"url": urll}));
|
||||
final res = (await client.get(Uri.parse(
|
||||
"https://api.mangadex.org$url?includes[]=cover_art&includes[]=author&includes[]=artist")))
|
||||
.body;
|
||||
MManga manga = MManga();
|
||||
manga.author = jsonPathToString(
|
||||
res, r'$..data.relationships[*].attributes.name', ', ');
|
||||
@@ -223,11 +223,10 @@ class MangaDex extends MProvider {
|
||||
|
||||
@override
|
||||
Future<List<String>> getPageList(MSource source, String url) async {
|
||||
final urll = "https://api.mangadex.org/at-home/server/$url";
|
||||
final res = (await client
|
||||
.get(Uri.parse("https://api.mangadex.org/at-home/server/$url")))
|
||||
.body;
|
||||
|
||||
final res = await http('GET', json.encode({"url": urll}));
|
||||
|
||||
// final dataRes = json.decode(res);
|
||||
final host = getMapValue(res, "baseUrl");
|
||||
final chapter = getMapValue(res, "chapter", encode: true);
|
||||
final hash = getMapValue(chapter, "hash");
|
||||
@@ -322,7 +321,7 @@ class MangaDex extends MProvider {
|
||||
String mangaId, int offset, String lang, int sourceId) 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${preferenceContentRating(sourceId)}';
|
||||
final res = await http('GET', json.encode({"url": url}));
|
||||
final res = (await client.get(Uri.parse(url))).body;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import '../../../../model/source.dart';
|
||||
const _apiUrl = 'https://api.mangadex.org';
|
||||
const _baseUrl = 'https://mangadex.org';
|
||||
const _isNsfw = true;
|
||||
const _mangadexVersion = "0.0.6";
|
||||
const _mangadexVersion = "0.0.65";
|
||||
const _mangadexSourceCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/manga/src/all/mangadex/mangadex.dart";
|
||||
String _iconUrl =
|
||||
|
||||
@@ -4,13 +4,14 @@ import 'dart:convert';
|
||||
class MangaHere extends MProvider {
|
||||
MangaHere();
|
||||
|
||||
final Client client = Client();
|
||||
|
||||
@override
|
||||
Future<MPages> getPopular(MSource source, int page) async {
|
||||
final headers = getHeader(source.baseUrl);
|
||||
final url = "${source.baseUrl}/directory/$page.htm";
|
||||
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await http('POST', json.encode(data));
|
||||
final res = (await client.get(
|
||||
Uri.parse("${source.baseUrl}/directory/$page.htm"),
|
||||
headers: getHeader(source.baseUrl)))
|
||||
.body;
|
||||
|
||||
List<MManga> mangaList = [];
|
||||
final names =
|
||||
@@ -33,11 +34,10 @@ class MangaHere extends MProvider {
|
||||
|
||||
@override
|
||||
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||
final headers = getHeader(source.baseUrl);
|
||||
final url = "${source.baseUrl}/directory/$page.htm?latest";
|
||||
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await http('POST', json.encode(data));
|
||||
final res = (await client.get(
|
||||
Uri.parse("${source.baseUrl}/directory/$page.htm?latest"),
|
||||
headers: getHeader(source.baseUrl)))
|
||||
.body;
|
||||
|
||||
List<MManga> mangaList = [];
|
||||
final names =
|
||||
@@ -61,8 +61,6 @@ class MangaHere extends MProvider {
|
||||
@override
|
||||
Future<MPages> search(
|
||||
MSource source, String query, int page, FilterList filterList) async {
|
||||
final headers = getHeader(source.baseUrl);
|
||||
|
||||
final filters = filterList.filters;
|
||||
String url = "${source.baseUrl}/search";
|
||||
|
||||
@@ -108,8 +106,9 @@ class MangaHere extends MProvider {
|
||||
}
|
||||
}
|
||||
url += "${ll(url)}title=$query&page=$page";
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await http('POST', json.encode(data));
|
||||
final res =
|
||||
(await client.get(Uri.parse(url), headers: getHeader(source.baseUrl)))
|
||||
.body;
|
||||
|
||||
List<MManga> mangaList = [];
|
||||
final names =
|
||||
@@ -135,9 +134,9 @@ class MangaHere extends MProvider {
|
||||
final statusList = [
|
||||
{"Ongoing": 0, "Completed": 1}
|
||||
];
|
||||
final headers = getHeader(source.baseUrl);
|
||||
final data = {"url": "${source.baseUrl}/$url", "headers": headers};
|
||||
final res = await http('GET', json.encode(data));
|
||||
final res = (await client.get(Uri.parse("${source.baseUrl}/$url"),
|
||||
headers: headers))
|
||||
.body;
|
||||
MManga manga = MManga();
|
||||
manga.author =
|
||||
xpath(res, '//*[@class="detail-info-right-say"]/a/text()').first;
|
||||
@@ -172,8 +171,7 @@ class MangaHere extends MProvider {
|
||||
Future<List<String>> getPageList(MSource source, String url) async {
|
||||
final headers = getHeader(source.baseUrl);
|
||||
final urll = "${source.baseUrl}$url";
|
||||
final data = {"url": urll, "headers": headers};
|
||||
final res = await http('GET', json.encode(data));
|
||||
final res = (await client.get(Uri.parse(urll), headers: headers)).body;
|
||||
final pages = xpath(res, "//body/div/div/span/a/text()");
|
||||
List<String> pageUrls = [];
|
||||
if (pages.isEmpty) {
|
||||
@@ -221,8 +219,9 @@ class MangaHere extends MProvider {
|
||||
"Host": "www.mangahere.cc",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
};
|
||||
final data = {"url": pageLink, "headers": headers};
|
||||
final ress = await http('GET', json.encode(data));
|
||||
|
||||
final ress =
|
||||
(await client.get(Uri.parse(pageLink), headers: headers)).body;
|
||||
|
||||
responseText = ress;
|
||||
|
||||
@@ -231,7 +230,8 @@ class MangaHere extends MProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
String deobfuscatedScript = unpackJs(responseText.replaceAll("eval", ""));
|
||||
String deobfuscatedScript =
|
||||
unpackJs(responseText.replaceAll("eval", ""));
|
||||
|
||||
int baseLinkStartPos = deobfuscatedScript.indexOf("pix=") + 5;
|
||||
int baseLinkEndPos =
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import '../../../../model/source.dart';
|
||||
|
||||
Source get mangahereSource => _mangahereSource;
|
||||
const _mangahereVersion = "0.0.55";
|
||||
const _mangahereVersion = "0.0.6";
|
||||
const _mangahereSourceCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/manga/src/en/mangahere/mangahere.dart";
|
||||
Source _mangahereSource = Source(
|
||||
|
||||
Reference in New Issue
Block a user