mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
Catch http error response
This commit is contained in:
@@ -3,10 +3,11 @@ import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
getPopularAnime(MManga anime) async {
|
||||
final data = {"url": "https://www.okanime.xyz"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
anime.urls = MBridge.xpath(res,
|
||||
'//div[@class="section" and contains(text(),"افضل انميات")]/div[@class="section-content"]/div/div/div[contains(@class,"anime-card")]/div[@class="anime-title")]/h4/a/@href');
|
||||
|
||||
@@ -24,10 +25,11 @@ getAnimeDetail(MManga anime) async {
|
||||
{"يعرض الان": 0, "مكتمل": 1}
|
||||
];
|
||||
final data = {"url": anime.link};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
|
||||
final status = MBridge.xpath(res,
|
||||
'//*[@class="full-list-info" and contains(text(),"حالة الأنمي")]/small/a/text()');
|
||||
@@ -56,10 +58,11 @@ getLatestUpdatesAnime(MManga anime) async {
|
||||
final data = {
|
||||
"url": "https://www.okanime.xyz/espisode-list?page=${anime.page}"
|
||||
};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
anime.urls = MBridge.xpath(res,
|
||||
'//*[contains(@class,"anime-card")]/div[@class="anime-title")]/h4/a/@href');
|
||||
|
||||
@@ -84,10 +87,11 @@ searchAnime(MManga anime) async {
|
||||
url += "&page=${anime.page}";
|
||||
}
|
||||
final data = {"url": url};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
anime.urls = MBridge.xpath(res,
|
||||
'//*[contains(@class,"anime-card")]/div[@class="anime-title")]/h4/a/@href');
|
||||
|
||||
@@ -108,11 +112,12 @@ searchAnime(MManga anime) async {
|
||||
|
||||
getVideoList(MManga anime) async {
|
||||
final datas = {"url": anime.link};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
final response = await MBridge.http('GET', json.encode(datas));
|
||||
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
final urls = MBridge.xpath(res, '//*[@id="streamlinks"]/a/@data-src');
|
||||
final qualities = MBridge.xpath(res, '//*[@id="streamlinks"]/a/span/text()');
|
||||
|
||||
|
||||
@@ -4,15 +4,19 @@ import 'package:bridge_lib/bridge_lib.dart';
|
||||
getPopularAnime(MManga anime) async {
|
||||
final data = {"url": "${anime.baseUrl}/most-popular?page=${anime.page}"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
|
||||
return animeElementM(res, anime);
|
||||
if (res.hasError) {
|
||||
return res;
|
||||
}
|
||||
return animeElementM(res.body, anime);
|
||||
}
|
||||
|
||||
getLatestUpdatesAnime(MManga anime) async {
|
||||
final data = {"url": "${anime.baseUrl}/top-airing?page=${anime.page}"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
|
||||
return animeElementM(res, anime);
|
||||
if (res.hasError) {
|
||||
return res;
|
||||
}
|
||||
return animeElementM(res.body, anime);
|
||||
}
|
||||
|
||||
getAnimeDetail(MManga anime) async {
|
||||
@@ -24,11 +28,11 @@ getAnimeDetail(MManga anime) async {
|
||||
];
|
||||
final url = "${anime.baseUrl}${anime.link}";
|
||||
final data = {"url": url, "headers": null};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
|
||||
String res = response.body;
|
||||
final status = MBridge.xpath(res,
|
||||
'//*[@class="anisc-info"]/div[contains(text(),"Status:")]/span[2]/text()')
|
||||
.first;
|
||||
@@ -70,7 +74,7 @@ getAnimeDetail(MManga anime) async {
|
||||
};
|
||||
final resEp = await MBridge.http('GET', json.encode(dataEp));
|
||||
|
||||
final html = json.decode(resEp)["html"];
|
||||
final html = json.decode(resEp.body)["html"];
|
||||
|
||||
final epUrls = MBridge.querySelectorAll(html,
|
||||
selector: "a.ep-item", typeElement: 3, attributes: "href", typeRegExp: 0);
|
||||
@@ -107,8 +111,10 @@ searchAnime(MManga anime) async {
|
||||
"url": "${anime.baseUrl}/search?keyword=${anime.query}&page=${anime.page}"
|
||||
};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
|
||||
return animeElementM(res, anime);
|
||||
if (res.hasError) {
|
||||
return res;
|
||||
}
|
||||
return animeElementM(res.body, anime);
|
||||
}
|
||||
|
||||
getVideoList(MManga anime) async {
|
||||
@@ -122,10 +128,10 @@ getVideoList(MManga anime) async {
|
||||
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
if (res.hasError) {
|
||||
return res;
|
||||
}
|
||||
final html = json.decode(res)["html"];
|
||||
final html = json.decode(res.body)["html"];
|
||||
|
||||
final names = MBridge.querySelectorAll(html,
|
||||
selector: "div.server-item",
|
||||
@@ -159,7 +165,7 @@ getVideoList(MManga anime) async {
|
||||
|
||||
final resE = await MBridge.http('GET', json.encode(datasE));
|
||||
String url = MBridge.substringBefore(
|
||||
MBridge.substringAfter(resE, "\"link\":\""), "\"");
|
||||
MBridge.substringAfter(resE.body, "\"link\":\""), "\"");
|
||||
print(url);
|
||||
List<MVideo> a = [];
|
||||
if (name.contains("Vidstreaming")) {
|
||||
|
||||
@@ -3,10 +3,11 @@ import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
getPopularAnime(MManga anime) async {
|
||||
final data = {"url": "${anime.baseUrl}/popular.html?page=${anime.page}"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
anime.urls = MBridge.xpath(res, '//*[@class="img"]/a/@href');
|
||||
anime.names = MBridge.xpath(res, '//*[@class="img"]/a/@title');
|
||||
anime.images = MBridge.xpath(res, '//*[@class="img"]/a/img/@src');
|
||||
@@ -17,10 +18,11 @@ getLatestUpdatesAnime(MManga anime) async {
|
||||
final url =
|
||||
"https://ajax.gogo-load.com/ajax/page-recent-release-ongoing.html?page=${anime.page}&type=1";
|
||||
final data = {"url": url};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
anime.urls = MBridge.xpath(
|
||||
res, '//*[@class="added_series_body popular"]/ul/li/a[1]/@href');
|
||||
anime.names = MBridge.xpath(
|
||||
@@ -46,10 +48,11 @@ getAnimeDetail(MManga anime) async {
|
||||
];
|
||||
|
||||
final data = {"url": "${anime.baseUrl}${anime.link}"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
|
||||
final status = MBridge.xpath(
|
||||
res, '//*[@class="anime_info_body_bg"]/p[@class="type"][5]/text()')
|
||||
@@ -70,7 +73,11 @@ getAnimeDetail(MManga anime) async {
|
||||
final urlEp =
|
||||
"https://ajax.gogo-load.com/ajax/load-list-episode?ep_start=0&ep_end=4000&id=$id";
|
||||
final dataEp = {"url": urlEp};
|
||||
final resEp = await MBridge.http('GET', json.encode(dataEp));
|
||||
final responseresEp = await MBridge.http('GET', json.encode(dataEp));
|
||||
if (responseresEp.hasError) {
|
||||
return response;
|
||||
}
|
||||
String resEp = responseresEp.body;
|
||||
anime.urls = MBridge.xpath(resEp, '//*[@id="episode_related"]/li/a/@href');
|
||||
final names = MBridge.xpath(
|
||||
resEp, '//*[@id="episode_related"]/li/a/div[@class="name"]/text()');
|
||||
@@ -88,11 +95,12 @@ getAnimeDetail(MManga anime) async {
|
||||
getVideoList(MManga anime) async {
|
||||
final datas = {"url": "${anime.baseUrl}${anime.link}"};
|
||||
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
final response = await MBridge.http('GET', json.encode(datas));
|
||||
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
|
||||
final serverUrls =
|
||||
MBridge.xpath(res, '//*[@class="anime_muti_link"]/ul/li/a/@data-video');
|
||||
@@ -128,10 +136,11 @@ searchAnime(MManga anime) async {
|
||||
final url =
|
||||
"${anime.baseUrl}/search.html?keyword=${anime.query}&page=${anime.page}";
|
||||
final data = {"url": url};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
anime.urls = MBridge.xpath(res, '//*[@class="img"]/a/@href');
|
||||
anime.names = MBridge.xpath(res, '//*[@class="img"]/a/@title');
|
||||
anime.images = MBridge.xpath(res, '//*[@class="img"]/a/img/@src');
|
||||
|
||||
@@ -6,10 +6,11 @@ getPopularAnime(MManga anime) async {
|
||||
"url":
|
||||
"${anime.baseUrl}/api/DramaList/List?page=${anime.page}&type=0&sub=0&country=0&status=0&order=1&pageSize=40"
|
||||
};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
final jsonRes = json.decode(res);
|
||||
final datas = jsonRes["data"] as List;
|
||||
anime.names = datas.map((e) => e["title"]).toList();
|
||||
@@ -29,10 +30,11 @@ getLatestUpdatesAnime(MManga anime) async {
|
||||
"url":
|
||||
"${anime.baseUrl}/api/DramaList/List?page=${anime.page}&type=0&sub=0&country=0&status=0&order=12&pageSize=40"
|
||||
};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
final jsonRes = json.decode(res);
|
||||
final datas = jsonRes["data"] as List;
|
||||
anime.names = datas.map((e) => e["title"]).toList();
|
||||
@@ -57,10 +59,11 @@ getAnimeDetail(MManga anime) async {
|
||||
];
|
||||
|
||||
final data = {"url": anime.link};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
final jsonRes = json.decode(res);
|
||||
final status = jsonRes["status"] ?? "";
|
||||
print(status);
|
||||
@@ -99,17 +102,18 @@ getAnimeDetail(MManga anime) async {
|
||||
getVideoList(MManga anime) async {
|
||||
final datas = {"url": anime.link};
|
||||
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
final response = await MBridge.http('GET', json.encode(datas));
|
||||
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
final id = MBridge.substringAfter(
|
||||
MBridge.substringBefore(anime.link, ".png"), "Episode/");
|
||||
final jsonRes = json.decode(res);
|
||||
final subRes = await MBridge.http(
|
||||
'GET', json.encode({"url": "${anime.baseUrl}/api/Sub/$id"}));
|
||||
var jsonSubRes = json.decode(subRes);
|
||||
var jsonSubRes = json.decode(subRes.body);
|
||||
|
||||
List<MTrack> subtitles = [];
|
||||
|
||||
@@ -143,10 +147,11 @@ searchAnime(MManga anime) async {
|
||||
final data = {
|
||||
"url": "${anime.baseUrl}/api/DramaList/Search?q=${anime.query}&type=0"
|
||||
};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
var jsonRes = json.decode(res) as List;
|
||||
anime.names = jsonRes.map((e) => e["title"]).toList();
|
||||
anime.images = jsonRes.map((e) => e["thumbnail"] ?? "").toList();
|
||||
|
||||
@@ -3,10 +3,11 @@ import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
getPopularAnime(MManga anime) async {
|
||||
final data = {"url": "${anime.baseUrl}/"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
anime.urls = MBridge.xpath(res,
|
||||
'//*[contains(@class,"swiper-slide item-qtip")]/div[@class="item"]/a/@href');
|
||||
anime.names = MBridge.xpath(res,
|
||||
@@ -19,10 +20,11 @@ getPopularAnime(MManga anime) async {
|
||||
|
||||
getLatestUpdatesAnime(MManga anime) async {
|
||||
final data = {"url": "${anime.baseUrl}/"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
|
||||
anime.urls = MBridge.xpath(res,
|
||||
'//*[@class="block_area block_area_home"]/div[@class="tab-content"]/div[contains(@class,"block_area-content block_area-list")]/div[@class="film_list-wrap"]/div[@class="flw-item"]/div[@class="film-poster"]/a/@href');
|
||||
@@ -38,10 +40,11 @@ searchAnime(MManga anime) async {
|
||||
final url =
|
||||
"${anime.baseUrl}/?story=${anime.query}&do=search&subaction=search";
|
||||
final data = {"url": url};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
anime.urls = MBridge.xpath(res, '//*[@class="film-poster"]/a/@href');
|
||||
anime.names = MBridge.xpath(res, '//*[@class="film-poster"]/a/@title');
|
||||
anime.images = MBridge.xpath(res, '//*[@class="film-poster"]/img/@data-src');
|
||||
@@ -58,10 +61,11 @@ getAnimeDetail(MManga anime) async {
|
||||
];
|
||||
final url = anime.link;
|
||||
final data = {"url": url};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
anime.description =
|
||||
MBridge.xpath(res, '//*[@class="film-description m-hide"]/text()').first;
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
Future<String> dataBase(int sourceId) async {
|
||||
Future<MHttpResponse> dataBase(int sourceId) async {
|
||||
final data = {
|
||||
"url": "https://api.franime.fr/api/animes/",
|
||||
"headers": {"Referer": "https://franime.fr/"}
|
||||
};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
return res;
|
||||
|
||||
return await MBridge.http('GET', json.encode(data));
|
||||
}
|
||||
|
||||
getPopularAnime(MManga anime) async {
|
||||
@@ -16,10 +16,10 @@ getPopularAnime(MManga anime) async {
|
||||
"headers": {"Referer": "https://franime.fr/"}
|
||||
};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
if (res.hasError) {
|
||||
return res;
|
||||
}
|
||||
List<MManga> animeList = animeResList(res);
|
||||
List<MManga> animeList = animeResList(res.body);
|
||||
|
||||
return animeList;
|
||||
}
|
||||
@@ -115,10 +115,10 @@ getAnimeDetail(MManga anime) async {
|
||||
String stem =
|
||||
MBridge.substringBefore(MBridge.substringAfterLast(anime.link, "/"), "?");
|
||||
final res = await dataBase(anime.sourceId);
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
if (res.hasError) {
|
||||
return res;
|
||||
}
|
||||
final animeByTitleOJson = databaseAnimeByTitleO(res, stem);
|
||||
final animeByTitleOJson = databaseAnimeByTitleO(res.body, stem);
|
||||
if (animeByTitleOJson.isEmpty) {
|
||||
return anime;
|
||||
}
|
||||
@@ -168,10 +168,10 @@ getAnimeDetail(MManga anime) async {
|
||||
getLatestUpdatesAnime(MManga anime) async {
|
||||
final res = await dataBase(anime.sourceId);
|
||||
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
if (res.hasError) {
|
||||
return res;
|
||||
}
|
||||
List list = json.decode(res);
|
||||
List list = json.decode(res.body);
|
||||
List reversedList = list.reversed.toList();
|
||||
List<MManga> animeList = animeResList(json.encode(reversedList));
|
||||
|
||||
@@ -181,10 +181,10 @@ getLatestUpdatesAnime(MManga anime) async {
|
||||
searchAnime(MManga anime) async {
|
||||
final res = await dataBase(anime.sourceId);
|
||||
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
if (res.hasError) {
|
||||
return res;
|
||||
}
|
||||
List<MManga> animeList = animeSeachFetch(res, anime.query);
|
||||
List<MManga> animeList = animeSeachFetch(res.body, anime.query);
|
||||
return animeList;
|
||||
}
|
||||
|
||||
@@ -298,10 +298,10 @@ getVideoList(MManga anime) async {
|
||||
String stem =
|
||||
MBridge.substringBefore(MBridge.substringAfterLast(anime.link, "/"), "?");
|
||||
final res = await dataBase(anime.sourceId);
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
if (res.hasError) {
|
||||
return res;
|
||||
}
|
||||
final animeByTitleOJson = databaseAnimeByTitleO(res, stem);
|
||||
final animeByTitleOJson = databaseAnimeByTitleO(res.body, stem);
|
||||
if (animeByTitleOJson.isEmpty) {
|
||||
return anime;
|
||||
}
|
||||
@@ -358,7 +358,11 @@ getVideoList(MManga anime) async {
|
||||
"headers": {"Referer": "https://franime.fr/"},
|
||||
"sourceId": anime.sourceId
|
||||
};
|
||||
final playerUrl = await MBridge.http('GET', json.encode(data));
|
||||
final requestPlayerUrl = await MBridge.http('GET', json.encode(data));
|
||||
if (requestPlayerUrl.hasError) {
|
||||
return requestPlayerUrl;
|
||||
}
|
||||
String playerUrl = requestPlayerUrl.body;
|
||||
List<MVideo> a = [];
|
||||
if (playerName.contains("franime_myvi")) {
|
||||
videos.add(video
|
||||
|
||||
@@ -5,10 +5,11 @@ getPopularAnime(MManga anime) async {
|
||||
final data = {
|
||||
"url": "${anime.baseUrl}/toute-la-liste-affiches/page/${anime.page}/?q=."
|
||||
};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
anime.urls =
|
||||
MBridge.xpath(res, '//*[@class="list"]/article/div/div/figure/a/@href');
|
||||
anime.names = MBridge.xpath(
|
||||
@@ -26,10 +27,11 @@ getPopularAnime(MManga anime) async {
|
||||
|
||||
getLatestUpdatesAnime(MManga anime) async {
|
||||
final data = {"url": "${anime.baseUrl}/page/${anime.page}/"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
anime.urls = MBridge.xpath(res, '//*[@class="episode"]/div/a/@href');
|
||||
final namess = MBridge.xpath(res, '//*[@class="episode"]/div/a/text()');
|
||||
List<String> names = [];
|
||||
@@ -72,17 +74,22 @@ getAnimeDetail(MManga anime) async {
|
||||
];
|
||||
final url = anime.link;
|
||||
final data = {"url": url};
|
||||
String res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
|
||||
final originalUrl = MBridge.xpath(res,
|
||||
'//*[@class="breadcrumb"]/li[@class="breadcrumb-item"][2]/a/@href')
|
||||
.first;
|
||||
if (originalUrl.isNotEmpty) {
|
||||
final newData = {"url": originalUrl};
|
||||
res = await MBridge.http('GET', json.encode(newData));
|
||||
final newResponse = await MBridge.http('GET', json.encode(newData));
|
||||
if (newResponse.hasError) {
|
||||
return newResponse;
|
||||
}
|
||||
res = newResponse.body;
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
}
|
||||
@@ -124,10 +131,11 @@ searchAnime(MManga anime) async {
|
||||
"url":
|
||||
"${anime.baseUrl}/toute-la-liste-affiches/page/${anime.page}/?q=${anime.query}"
|
||||
};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
|
||||
anime.urls =
|
||||
MBridge.xpath(res, '//*[@class="list"]/article/div/div/figure/a/@href');
|
||||
@@ -150,11 +158,11 @@ getVideoList(MManga anime) async {
|
||||
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
if (res.hasError) {
|
||||
return res;
|
||||
}
|
||||
final servers =
|
||||
MBridge.xpath(res, '//*[@id="nav-tabContent"]/div/iframe/@src');
|
||||
MBridge.xpath(res.body, '//*[@id="nav-tabContent"]/div/iframe/@src');
|
||||
List<MVideo> videos = [];
|
||||
for (var url in servers) {
|
||||
final datasServer = {
|
||||
@@ -162,7 +170,9 @@ getVideoList(MManga anime) async {
|
||||
"headers": {"X-Requested-With": "XMLHttpRequest"}
|
||||
};
|
||||
|
||||
final resServer = await MBridge.http('GET', json.encode(datasServer));
|
||||
final responseResServer =
|
||||
await MBridge.http('GET', json.encode(datasServer));
|
||||
String resServer = responseResServer.body;
|
||||
final serverUrl =
|
||||
fixUrl(MBridge.regExp(resServer, r"data-url='([^']+)'", '', 1, 1));
|
||||
List<MVideo> a = [];
|
||||
|
||||
@@ -3,33 +3,28 @@ import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
searchManga(MManga manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
|
||||
String res = "".toString();
|
||||
MHttpResponse response = MHttpResponse();
|
||||
if (!useNewQueryEndpoint(manga.source)) {
|
||||
final url = "${manga.apiUrl}/series/search";
|
||||
final body = {"term": manga.query};
|
||||
final data = {"url": url, "headers": headers, "body": body};
|
||||
res = await MBridge.http('POST', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
response = await MBridge.http('POST', json.encode(data));
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
response = await MBridge.http('GET', json.encode(newEndpointData));
|
||||
}
|
||||
|
||||
return MMangaRes(res, manga);
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
return mMangaRes(response, manga);
|
||||
}
|
||||
|
||||
getPopularManga(MManga manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
String res = "".toString();
|
||||
MHttpResponse response = MHttpResponse();
|
||||
if (!useNewQueryEndpoint(manga.source)) {
|
||||
final url = "${manga.apiUrl}/series/querysearch";
|
||||
print(url);
|
||||
@@ -47,8 +42,7 @@ getPopularManga(MManga manga) async {
|
||||
"sourceId": manga.sourceId,
|
||||
"body": body
|
||||
};
|
||||
|
||||
res = await MBridge.http('POST', json.encode(data));
|
||||
response = await MBridge.http('POST', json.encode(data));
|
||||
} else {
|
||||
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";
|
||||
@@ -58,17 +52,14 @@ getPopularManga(MManga manga) async {
|
||||
"headers": headers,
|
||||
"sourceId": manga.sourceId
|
||||
};
|
||||
res = await MBridge.http('GET', json.encode(newEndpointData));
|
||||
response = await MBridge.http('GET', json.encode(newEndpointData));
|
||||
}
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
return MMangaRes(res, manga);
|
||||
return mMangaRes(response, manga);
|
||||
}
|
||||
|
||||
getLatestUpdatesManga(MManga manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
String res = "".toString();
|
||||
MHttpResponse response = MHttpResponse();
|
||||
if (!useNewQueryEndpoint(manga.source)) {
|
||||
final url = "${manga.apiUrl}/series/querysearch";
|
||||
final body = {
|
||||
@@ -84,20 +75,16 @@ getLatestUpdatesManga(MManga manga) async {
|
||||
"sourceId": manga.sourceId,
|
||||
"body": body
|
||||
};
|
||||
res = await MBridge.http('POST', json.encode(data));
|
||||
response = await MBridge.http('POST', json.encode(data));
|
||||
} else {
|
||||
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);
|
||||
response = await MBridge.http('GET', json.encode(newEndpointData));
|
||||
}
|
||||
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
return MMangaRes(res, manga);
|
||||
return mMangaRes(response, manga);
|
||||
}
|
||||
|
||||
getMangaDetail(MManga manga) async {
|
||||
@@ -105,11 +92,11 @@ getMangaDetail(MManga manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
final url = "${manga.apiUrl}/series/$currentSlug";
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
print("${manga.apiUrl}/series/$currentSlug");
|
||||
String res = response.body;
|
||||
manga.author = MBridge.getMapValue(res, "author");
|
||||
|
||||
manga.description = MBridge.getMapValue(res, "description");
|
||||
@@ -159,18 +146,24 @@ getMangaDetail(MManga manga) async {
|
||||
}
|
||||
|
||||
getChapterPages(MManga manga) async {
|
||||
String res = "".toString();
|
||||
MHttpResponse response = MHttpResponse();
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
|
||||
String res = "".toString();
|
||||
if (!useslugStrategy(manga.source)) {
|
||||
String chapterId = MBridge.substringAfter(manga.link, '#');
|
||||
|
||||
final url = "${manga.apiUrl}/series/chapter/$chapterId";
|
||||
final data = {"url": url, "headers": headers};
|
||||
res = await MBridge.http('GET', json.encode(data));
|
||||
response = await MBridge.http('GET', json.encode(data));
|
||||
res = response.body;
|
||||
} else {
|
||||
final url = "${manga.baseUrl}${manga.link}";
|
||||
final data = {"url": url, "headers": headers};
|
||||
res = await MBridge.http('GET', json.encode(data));
|
||||
response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
res = response.body;
|
||||
List<String> pageUrls = [];
|
||||
var imagesRes = MBridge.querySelectorAll(res,
|
||||
selector: "div.min-h-screen > div.container > p.items-center",
|
||||
@@ -183,9 +176,8 @@ getChapterPages(MManga manga) async {
|
||||
|
||||
return pageUrls.where((e) => e.isNotEmpty).toList();
|
||||
}
|
||||
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
final pages = MBridge.jsonPathToList(res, r"$.content.images[*]", 0);
|
||||
List<String> pageUrls = [];
|
||||
@@ -220,11 +212,11 @@ bool useslugStrategy(String sourceName) {
|
||||
return sources.contains(sourceName);
|
||||
}
|
||||
|
||||
MManga MMangaRes(String res, MManga manga) {
|
||||
MManga mMangaRes(MHttpResponse response, MManga manga) {
|
||||
String res = response.body;
|
||||
List<String> names = [];
|
||||
List<String> urls = [];
|
||||
List<String> images = [];
|
||||
|
||||
if (res.startsWith("{")) {
|
||||
for (var a in json.decode(res)["data"]) {
|
||||
String thumbnail = a["thumbnail"];
|
||||
|
||||
@@ -4,10 +4,11 @@ import 'package:bridge_lib/bridge_lib.dart';
|
||||
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));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
manga.urls = MBridge.xpath(res, '//*[@class^="post-title"]/h3/a/@href');
|
||||
var images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-src');
|
||||
if (images.isEmpty) {
|
||||
@@ -70,12 +71,13 @@ getMangaDetail(MManga manga) async {
|
||||
"Cancelado": 3,
|
||||
}
|
||||
];
|
||||
|
||||
MHttpResponse response = MHttpResponse();
|
||||
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
response = await MBridge.http('GET', json.encode(datas));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
manga.author = MBridge.querySelectorAll(res,
|
||||
selector: "div.author-content > a",
|
||||
typeElement: 0,
|
||||
@@ -126,21 +128,23 @@ getMangaDetail(MManga manga) async {
|
||||
"${baseUrl}wp-admin/admin-ajax.php?action=manga_get_chapters&manga=$mangaId";
|
||||
final datasP = {"url": url, "headers": headers, "sourceId": manga.sourceId};
|
||||
|
||||
String resP = await MBridge.http('POST', json.encode(datasP));
|
||||
if (resP == "400") {
|
||||
response = await MBridge.http('POST', json.encode(datasP));
|
||||
if (response.statusCode != 200) {
|
||||
final urlP = "${manga.link}ajax/chapters";
|
||||
final datasP = {
|
||||
"url": urlP,
|
||||
"headers": headers,
|
||||
"sourceId": manga.sourceId
|
||||
};
|
||||
resP = await MBridge.http('POST', json.encode(datasP));
|
||||
response = await MBridge.http('POST', json.encode(datasP));
|
||||
}
|
||||
|
||||
String resP = response.body;
|
||||
manga.urls = MBridge.xpath(resP, "//li/a/@href");
|
||||
var chaptersNames = MBridge.xpath(resP, "//li/a/text()");
|
||||
|
||||
var dateF = MBridge.xpath(resP, "//li/span/i/text()");
|
||||
if (MBridge.xpath(resP, "//li/a/text()", "").isEmpty) {
|
||||
if (dateF.isEmpty) {
|
||||
final resWebview = await MBridge.getHtmlViaWebview(manga.link,
|
||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/@href");
|
||||
manga.urls = MBridge.xpath(resWebview,
|
||||
@@ -176,10 +180,11 @@ getMangaDetail(MManga 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) {
|
||||
return [];
|
||||
final response = await MBridge.http('GET', json.encode(datas));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
final pagesSelectorRes = MBridge.querySelectorAll(res,
|
||||
selector:
|
||||
"div.page-break, li.blocks-gallery-item, .reading-content, .text-left img",
|
||||
@@ -225,10 +230,11 @@ getChapterPages(MManga 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));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(datas));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
manga.urls = MBridge.xpath(res, '//*[@class^="post-title"]/h3/a/@href');
|
||||
var images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-src');
|
||||
if (images.isEmpty) {
|
||||
@@ -248,10 +254,11 @@ getLatestUpdatesManga(MManga 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));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(datas));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
manga.urls =
|
||||
MBridge.xpath(res, '//*[@class^="tab-thumb c-image-hover"]/a/@href');
|
||||
var images = MBridge.xpath(
|
||||
|
||||
@@ -2,28 +2,38 @@ import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
getPopularManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}${getMangaUrlDirectory(manga.source)}/?page=${manga.page}&order=popular";
|
||||
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));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
manga.urls = MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href');
|
||||
manga.names = MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title');
|
||||
manga.images = MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src');
|
||||
String res = response.body;
|
||||
manga.urls =
|
||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href');
|
||||
manga.names =
|
||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title');
|
||||
manga.images = MBridge.xpath(
|
||||
res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src');
|
||||
return manga;
|
||||
}
|
||||
|
||||
getLatestUpdatesManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}${getMangaUrlDirectory(manga.source)}/?page=${manga.page}&order=update";
|
||||
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));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
manga.urls = MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href');
|
||||
manga.names = MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title');
|
||||
manga.images = MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src');
|
||||
String res = response.body;
|
||||
manga.urls =
|
||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href');
|
||||
manga.names =
|
||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title');
|
||||
manga.images = MBridge.xpath(
|
||||
res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src');
|
||||
return manga;
|
||||
}
|
||||
|
||||
@@ -81,11 +91,11 @@ getMangaDetail(MManga manga) async {
|
||||
];
|
||||
|
||||
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(datas));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
manga.author = MBridge.xpath(
|
||||
res,
|
||||
'//*[@class="imptdt" and contains(text(), "Author") or @class="infotable" and contains(text(), "Author") or @class="infotable" and contains(text(), "Auteur") or @class="fmed" and contains(text(), "Auteur") or @class="infotable" and contains(text(), "Autor")]/text()',
|
||||
@@ -97,7 +107,10 @@ getMangaDetail(MManga manga) async {
|
||||
.replaceAll("[Add, ]", "");
|
||||
|
||||
manga.description = MBridge.querySelectorAll(res,
|
||||
selector: ".desc, .entry-content[itemprop=description]", typeElement: 0, attributes: "", typeRegExp: 0)
|
||||
selector: ".desc, .entry-content[itemprop=description]",
|
||||
typeElement: 0,
|
||||
attributes: "",
|
||||
typeRegExp: 0)
|
||||
.first;
|
||||
|
||||
final status = MBridge.xpath(
|
||||
@@ -111,7 +124,8 @@ getMangaDetail(MManga manga) async {
|
||||
|
||||
manga.status = MBridge.parseStatus(status, statusList);
|
||||
|
||||
manga.genre = MBridge.xpath(res, '//*[@class="gnr" or @class="mgen" or @class="seriestugenre" ]/a/text()');
|
||||
manga.genre = MBridge.xpath(res,
|
||||
'//*[@class="gnr" or @class="mgen" or @class="seriestugenre" ]/a/text()');
|
||||
manga.urls = MBridge.xpath(res,
|
||||
'//*[@class="bxcl" or @class="cl" or @class="chbox" or @class="eph-num" or @id="chapterlist"]/div/a[not(@href="#/chapter-{{number}}")]/@href');
|
||||
manga.names = MBridge.xpath(res,
|
||||
@@ -120,32 +134,37 @@ getMangaDetail(MManga manga) async {
|
||||
final chaptersDateUploads = MBridge.xpath(res,
|
||||
'//*[@class="bxcl" or @class="cl" or @class="chbox" or @class="eph-num" or @id="chapterlist"]/div/a/span[@class="chapterdate" and not(text()="{{date}}")]/text()');
|
||||
|
||||
manga.chaptersDateUploads = MBridge.listParseDateTime(chaptersDateUploads, manga.dateFormat, manga.dateFormatLocale);
|
||||
manga.chaptersDateUploads = MBridge.listParseDateTime(
|
||||
chaptersDateUploads, manga.dateFormat, manga.dateFormatLocale);
|
||||
|
||||
return manga;
|
||||
}
|
||||
|
||||
searchManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}${getMangaUrlDirectory(manga.source)}/?&title=${manga.query}&page=${manga.page}";
|
||||
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));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
manga.urls = MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href');
|
||||
manga.names = MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title');
|
||||
manga.images = MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src');
|
||||
String res = response.body;
|
||||
manga.urls =
|
||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href');
|
||||
manga.names =
|
||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title');
|
||||
manga.images = MBridge.xpath(
|
||||
res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src');
|
||||
return manga;
|
||||
}
|
||||
|
||||
getChapterPages(MManga manga) async {
|
||||
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
||||
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
final response = await MBridge.http('GET', json.encode(datas));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
var pages = [];
|
||||
List<String> pagesUrl = [];
|
||||
pages = MBridge.xpath(res, '//*[@id="readerarea"]/p/img/@src');
|
||||
@@ -153,7 +172,8 @@ getChapterPages(MManga manga) async {
|
||||
pages = MBridge.xpath(res, '//*[@id="readerarea"]/img/@src');
|
||||
}
|
||||
if (pages.isEmpty || pages.length == 1) {
|
||||
final images = MBridge.regExp(res, "\"images\"\\s*:\\s*(\\[.*?])", "", 1, 1);
|
||||
final images =
|
||||
MBridge.regExp(res, "\"images\"\\s*:\\s*(\\[.*?])", "", 1, 1);
|
||||
final pages = MBridge.jsonDecodeToList(images, 0);
|
||||
for (var page in pages) {
|
||||
pagesUrl.add(page);
|
||||
|
||||
@@ -4,10 +4,11 @@ import 'package:bridge_lib/bridge_lib.dart';
|
||||
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));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
final jsonList = json.decode(res)["suggestions"];
|
||||
List<String> urls = [];
|
||||
List<String> names = [];
|
||||
@@ -26,7 +27,8 @@ searchManga(MManga manga) async {
|
||||
if (manga.source == "Manga-FR") {
|
||||
images.add("${manga.baseUrl}/uploads/manga/$data.jpg");
|
||||
} else {
|
||||
images.add("${manga.baseUrl}/uploads/manga/$data/cover/cover_250x350.jpg");
|
||||
images
|
||||
.add("${manga.baseUrl}/uploads/manga/$data/cover/cover_250x350.jpg");
|
||||
}
|
||||
}
|
||||
manga.names = names;
|
||||
@@ -36,12 +38,14 @@ searchManga(MManga manga) async {
|
||||
}
|
||||
|
||||
getPopularManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}/filterList?page=${manga.page}&sortBy=views&asc=false";
|
||||
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));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
manga.urls = MBridge.xpath(res, '//*[ @class="chart-title"]/@href');
|
||||
manga.names = MBridge.xpath(res, '//*[ @class="chart-title"]/text()');
|
||||
List<String> images = [];
|
||||
@@ -50,7 +54,8 @@ getPopularManga(MManga manga) async {
|
||||
if (manga.source == "Manga-FR") {
|
||||
images.add("${manga.baseUrl}/uploads/manga/${slug}.jpg");
|
||||
} else {
|
||||
images.add("${manga.baseUrl}/uploads/manga/${slug}/cover/cover_250x350.jpg");
|
||||
images.add(
|
||||
"${manga.baseUrl}/uploads/manga/${slug}/cover/cover_250x350.jpg");
|
||||
}
|
||||
}
|
||||
manga.images = images;
|
||||
@@ -77,10 +82,11 @@ getMangaDetail(MManga manga) async {
|
||||
];
|
||||
|
||||
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(datas));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
manga.author = MBridge.xpath(res,
|
||||
'//*[@class="dl-horizontal"]/dt[contains(text(), "Auteur(s)") or contains(text(), "Author(s)") or contains(text(), "Autor(es)") or contains(text(), "Yazar(lar) or contains(text(), "Mangaka(lar)")]//following-sibling::dd[1]/text()')
|
||||
.first;
|
||||
@@ -88,13 +94,17 @@ getMangaDetail(MManga manga) async {
|
||||
'//*[@class="dl-horizontal"]/dt[contains(text(), "Statut") or contains(text(), "Status") or contains(text(), "Estado") or contains(text(), "Durum")]/following-sibling::dd[1]/text()')
|
||||
.first;
|
||||
manga.status = MBridge.parseStatus(status, statusList);
|
||||
manga.description = MBridge.xpath(res, '//*[@class="well" or @class="manga well"]/p/text()').first;
|
||||
manga.description =
|
||||
MBridge.xpath(res, '//*[@class="well" or @class="manga well"]/p/text()')
|
||||
.first;
|
||||
manga.genre = MBridge.xpath(res,
|
||||
'//*[@class="dl-horizontal"]/dt[contains(text(), "Categories") or contains(text(), "Categorias") or contains(text(), "Categorías") or contains(text(), "Catégories") or contains(text(), "Kategoriler" or contains(text(), "Kategorie") or contains(text(), "Kategori") or contains(text(), "Tagi"))]/following-sibling::dd[1]/text()');
|
||||
manga.names = MBridge.xpath(res, '//*[@class="chapter-title-rtl"]/a/text()');
|
||||
manga.urls = MBridge.xpath(res, '//*[@class="chapter-title-rtl"]/a/@href');
|
||||
final date = MBridge.xpath(res, '//*[@class="date-chapter-title-rtl"]/text()');
|
||||
manga.chaptersDateUploads = MBridge.listParseDateTime(date, "d MMM. yyyy", "en_US");
|
||||
final date =
|
||||
MBridge.xpath(res, '//*[@class="date-chapter-title-rtl"]/text()');
|
||||
manga.chaptersDateUploads =
|
||||
MBridge.listParseDateTime(date, "d MMM. yyyy", "en_US");
|
||||
|
||||
return manga;
|
||||
}
|
||||
@@ -102,10 +112,11 @@ getMangaDetail(MManga 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));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
manga.urls = MBridge.xpath(res, '//*[@class="manga-item"]/h3/a/@href');
|
||||
manga.names = MBridge.xpath(res, '//*[@class="manga-item"]/h3/a/text()');
|
||||
List<String> images = [];
|
||||
@@ -114,7 +125,8 @@ getLatestUpdatesManga(MManga manga) async {
|
||||
if (manga.source == "Manga-FR") {
|
||||
images.add("${manga.baseUrl}/uploads/manga/${slug}.jpg");
|
||||
} else {
|
||||
images.add("${manga.baseUrl}/uploads/manga/${slug}/cover/cover_250x350.jpg");
|
||||
images.add(
|
||||
"${manga.baseUrl}/uploads/manga/${slug}/cover/cover_250x350.jpg");
|
||||
}
|
||||
}
|
||||
manga.images = images;
|
||||
@@ -123,12 +135,14 @@ getLatestUpdatesManga(MManga 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) {
|
||||
return [];
|
||||
final response = await MBridge.http('GET', json.encode(datas));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
List<String> pagesUrl = [];
|
||||
final pages = MBridge.xpath(res, '//*[@id="all"]/img[@class="img-responsive"]/@data-src');
|
||||
final pages = MBridge.xpath(
|
||||
res, '//*[@id="all"]/img[@class="img-responsive"]/@data-src');
|
||||
for (var page in pages) {
|
||||
if (page.startsWith('//')) {
|
||||
pagesUrl.add(page.replaceAll('//', 'https://'));
|
||||
|
||||
@@ -3,10 +3,11 @@ import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
getPopularManga(MManga manga) async {
|
||||
final data = {"url": "${manga.baseUrl}/search/"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
final directory = directoryFromDocument(res);
|
||||
final resSort = MBridge.sortMapList(json.decode(directory), "vm", 1);
|
||||
|
||||
@@ -15,10 +16,11 @@ getPopularManga(MManga manga) async {
|
||||
|
||||
getLatestUpdatesManga(MManga manga) async {
|
||||
final data = {"url": "${manga.baseUrl}/search/"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
final directory = directoryFromDocument(res);
|
||||
final resSort = MBridge.sortMapList(json.decode(directory), "lt", 1);
|
||||
|
||||
@@ -27,10 +29,11 @@ getLatestUpdatesManga(MManga manga) async {
|
||||
|
||||
searchManga(MManga manga) async {
|
||||
final data = {"url": "${manga.baseUrl}/search/"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
final directory = directoryFromDocument(res);
|
||||
final resSort = MBridge.sortMapList(json.decode(directory), "lt", 1);
|
||||
final datas = json.decode(resSort) as List;
|
||||
@@ -52,10 +55,11 @@ getMangaDetail(MManga manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
final url = '${manga.baseUrl}/manga/${manga.link}';
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
manga.author = MBridge.xpath(res,
|
||||
'//li[contains(@class,"list-group-item") and contains(text(),"Author")]/a/text()')
|
||||
.first;
|
||||
@@ -99,7 +103,12 @@ getChapterPages(MManga manga) async {
|
||||
final url = '${manga.baseUrl}${manga.link}';
|
||||
List<String> pages = [];
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
|
||||
final script =
|
||||
MBridge.xpath(res, '//script[contains(text(), "MainFunction")]/text()')
|
||||
.first;
|
||||
|
||||
@@ -2,9 +2,14 @@ import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
getPopularManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}/browse?${lang(manga.lang)}&sort=views_a&page=${manga.page}";
|
||||
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));
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
return mangaElementM(res, manga);
|
||||
}
|
||||
|
||||
@@ -17,15 +22,27 @@ String lang(String lang) {
|
||||
}
|
||||
|
||||
getLatestUpdatesManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}/browse?${lang(manga.lang)}&sort=update&page=${manga.page}";
|
||||
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));
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
return mangaElementM(res, manga);
|
||||
}
|
||||
|
||||
searchManga(MManga 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));
|
||||
final data = {
|
||||
"url": "${manga.baseUrl}/search?word=${manga.query}&page=${manga.page}",
|
||||
"sourceId": manga.sourceId
|
||||
};
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
return mangaElementM(res, manga);
|
||||
}
|
||||
|
||||
@@ -41,39 +58,46 @@ getMangaDetail(MManga manga) async {
|
||||
|
||||
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 response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
|
||||
final workStatus = MBridge.xpath(
|
||||
res, '//*[@class="attr-item"]/b[contains(text(),"Original work")]/following-sibling::span[1]/text()')
|
||||
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;
|
||||
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> 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 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;
|
||||
final time =
|
||||
MBridge.xpath(element, '//*[@class="extra"]/i[@class="ps-3"]/text()')
|
||||
.first;
|
||||
times.add(time);
|
||||
chapsUrls.add(url);
|
||||
scanlators.add(group);
|
||||
@@ -83,26 +107,35 @@ getMangaDetail(MManga manga) async {
|
||||
manga.urls = chapsUrls;
|
||||
manga.names = chapsNames;
|
||||
manga.chaptersScanlators = scanlators;
|
||||
manga.chaptersDateUploads = MBridge.listParseDateTime(times, "MMM dd,yyyy", "en");
|
||||
manga.chaptersDateUploads =
|
||||
MBridge.listParseDateTime(times, "MMM dd,yyyy", "en");
|
||||
|
||||
return manga;
|
||||
}
|
||||
|
||||
getChapterPages(MManga 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 datas = {
|
||||
"url": "${manga.baseUrl}${manga.link}",
|
||||
"sourceId": manga.sourceId
|
||||
};
|
||||
final response = await MBridge.http('GET', json.encode(datas));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
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 ='), ';');
|
||||
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 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);
|
||||
final imgAccListString =
|
||||
MBridge.decryptAESCryptoJS(batoWord.replaceAll('"', ""), evaluatedPass);
|
||||
var imgAccList = json.decode(imgAccListString);
|
||||
List<String> pagesUrl = [];
|
||||
for (int i = 0; i < imgHttpLis.length; i++) {
|
||||
@@ -115,12 +148,14 @@ getChapterPages(MManga manga) async {
|
||||
}
|
||||
|
||||
MManga mangaElementM(String res, MManga 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);
|
||||
|
||||
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 = [];
|
||||
@@ -129,30 +164,36 @@ MManga mangaElementM(String res, MManga manga) async {
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
final nextPage = MBridge.xpath(res,
|
||||
'//li[@class="page-item disabled"]/a/span[contains(text(),"»")]/text()');
|
||||
manga.hasNextPage = true;
|
||||
|
||||
return manga;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ getLatestUpdatesManga(MManga manga) async {
|
||||
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('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
|
||||
String res = response.body;
|
||||
manga.names = MBridge.jsonPathToList(res, r'$.title', 0);
|
||||
List<String> ids = MBridge.jsonPathToList(res, r'$.hid', 0);
|
||||
List<String> mangaUrls = [];
|
||||
@@ -36,10 +36,11 @@ getMangaDetail(MManga manga) async {
|
||||
final urll =
|
||||
"${manga.apiUrl}${manga.link.replaceAll("#", '')}?tachiyomi=true";
|
||||
final data = {"url": urll, "headers": headers};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
manga.author = MBridge.jsonPathToString(res, r'$.authors[*].name', '');
|
||||
manga.genre =
|
||||
MBridge.jsonPathToString(res, r'$.genres[*].name', "_.").split("_.");
|
||||
@@ -50,32 +51,38 @@ getMangaDetail(MManga manga) async {
|
||||
"${manga.apiUrl}${manga.link.replaceAll("#", '')}chapters?lang=${manga.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', '');
|
||||
if (request.hasError) {
|
||||
return response;
|
||||
}
|
||||
var total = MBridge.jsonPathToString(request.body, 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('GET', json.encode(newDataReq));
|
||||
|
||||
manga.urls = MBridge.jsonPathToString(newRequest, r'$.chapters[*].hid', "_.")
|
||||
.split("_.");
|
||||
final chapDate =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].created_at', "_.")
|
||||
if (newRequest.hasError) {
|
||||
return response;
|
||||
}
|
||||
manga.urls =
|
||||
MBridge.jsonPathToString(newRequest.body, r'$.chapters[*].hid', "_.")
|
||||
.split("_.");
|
||||
final chapDate = MBridge.jsonPathToString(
|
||||
newRequest.body, 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', "_.")
|
||||
MBridge.jsonPathToString(newRequest.body, r'$.chapters[*].vol', "_.")
|
||||
.split("_.");
|
||||
manga.chaptersScanlators = MBridge.jsonPathToString(
|
||||
newRequest.body, r'$.chapters[*].group_name', "_.")
|
||||
.split("_.");
|
||||
manga.names =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].title', "_.")
|
||||
MBridge.jsonPathToString(newRequest.body, r'$.chapters[*].title', "_.")
|
||||
.split("_.");
|
||||
manga.chaptersChaps =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].chap', "_.")
|
||||
MBridge.jsonPathToString(newRequest.body, r'$.chapters[*].chap', "_.")
|
||||
.split("_.");
|
||||
|
||||
return manga;
|
||||
@@ -85,10 +92,11 @@ getPopularManga(MManga manga) async {
|
||||
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('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
manga.names = MBridge.jsonPathToList(res, r'$.title', 0);
|
||||
List<String> ids = MBridge.jsonPathToList(res, r'$.hid', 0);
|
||||
List<String> mangaUrls = [];
|
||||
@@ -103,10 +111,11 @@ getPopularManga(MManga manga) async {
|
||||
searchManga(MManga 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('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
manga.names = MBridge.jsonPathToList(res, r'$.title', 0);
|
||||
List<String> ids = MBridge.jsonPathToList(res, r'$.hid', 0);
|
||||
List<String> mangaUrls = [];
|
||||
@@ -121,10 +130,11 @@ searchManga(MManga manga) async {
|
||||
getChapterPages(MManga manga) async {
|
||||
final url = "${manga.apiUrl}/chapter/${manga.link}?tachiyomi=true";
|
||||
final data = {"url": url, "headers": getHeader(url)};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
return MBridge.jsonPathToString(res, r'$.chapter.images[*].url', '_.')
|
||||
.split('_.');
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@ getPopularManga(MManga 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};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
|
||||
return parseManga(res, manga);
|
||||
final response = await MBridge.http('GET', json.encode(datas));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
return parseManga(response.body, manga);
|
||||
}
|
||||
|
||||
getLatestUpdatesManga(MManga manga) async {
|
||||
@@ -16,10 +18,11 @@ getLatestUpdatesManga(MManga 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};
|
||||
final ress = await MBridge.http('GET', json.encode(datas));
|
||||
if (ress.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(datas));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String ress = response.body;
|
||||
|
||||
final mangaIds = MBridge.listParse(
|
||||
MBridge.jsonPathToString(ress, r'$.data[*].relationships[*].id', '.--')
|
||||
@@ -33,7 +36,10 @@ getLatestUpdatesManga(MManga manga) async {
|
||||
"https://api.mangadex.org/manga?includes[]=cover_art&limit=${mangaIds.length}${getMDXContentRating()}$mangaa";
|
||||
final datass = {"url": newUrl};
|
||||
final res = await MBridge.http('GET', json.encode(datass));
|
||||
return parseManga(res, manga);
|
||||
if (res.hasError) {
|
||||
return res;
|
||||
}
|
||||
return parseManga(res.body, manga);
|
||||
}
|
||||
|
||||
searchManga(MManga manga) async {
|
||||
@@ -41,10 +47,10 @@ searchManga(MManga manga) async {
|
||||
"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};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
if (res.hasError) {
|
||||
return res;
|
||||
}
|
||||
return parseManga(res, manga);
|
||||
return parseManga(res.body, manga);
|
||||
}
|
||||
|
||||
getMangaDetail(MManga manga) async {
|
||||
@@ -59,11 +65,11 @@ getMangaDetail(MManga manga) async {
|
||||
final url =
|
||||
"https://api.mangadex.org${manga.link}?includes[]=cover_art&includes[]=author&includes[]=artist";
|
||||
final datas = {"url": url};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(datas));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
|
||||
String res = response.body;
|
||||
manga.author = MBridge.jsonPathToString(
|
||||
res, r'$..data.relationships[*].attributes.name', ', ');
|
||||
|
||||
@@ -175,11 +181,11 @@ getMangaDetail(MManga manga) async {
|
||||
getChapterPages(MManga manga) async {
|
||||
final url = "https://api.mangadex.org/at-home/server/${manga.link}";
|
||||
final data = {"url": url};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
final dataRes = json.decode(res);
|
||||
final dataRes = json.decode(response.body);
|
||||
final host = dataRes["baseUrl"];
|
||||
final hash = dataRes["chapter"]["hash"];
|
||||
final chapterDatas = dataRes["chapter"]["data"] as List;
|
||||
@@ -280,7 +286,8 @@ 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};
|
||||
return await MBridge.http('GET', json.encode(datas));
|
||||
final response = await MBridge.http('GET', json.encode(datas));
|
||||
return response.body;
|
||||
}
|
||||
|
||||
String findTitle(Map<String, dynamic> dataRes, String lang) {
|
||||
|
||||
@@ -6,11 +6,11 @@ searchManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}/search?title=${manga.query}&page=${manga.page}";
|
||||
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await MBridge.http('POST', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('POST', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
|
||||
String res = response.body;
|
||||
manga.names = MBridge.xpath(
|
||||
res, '//*[contains(@class, "manga-list-4-list")]/li/a/@title');
|
||||
manga.images = MBridge.xpath(res,
|
||||
@@ -25,11 +25,11 @@ getLatestUpdatesManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}/directory/${manga.page}.htm?latest";
|
||||
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await MBridge.http('POST', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('POST', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
|
||||
String res = response.body;
|
||||
manga.names = MBridge.xpath(
|
||||
res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@title');
|
||||
manga.images = MBridge.xpath(res,
|
||||
@@ -49,10 +49,11 @@ getMangaDetail(MManga manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
final url = "${manga.baseUrl}/${manga.link}";
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
manga.author =
|
||||
MBridge.xpath(res, '//*[@class="detail-info-right-say"]/a/text()').first;
|
||||
manga.description =
|
||||
@@ -79,10 +80,11 @@ getPopularManga(MManga manga) async {
|
||||
final url = "${manga.baseUrl}/directory/${manga.page}.htm";
|
||||
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await MBridge.http('POST', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
final response = await MBridge.http('POST', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
|
||||
manga.names = MBridge.xpath(
|
||||
res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@title');
|
||||
@@ -97,10 +99,11 @@ getChapterPages(MManga manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
final url = "${manga.baseUrl}${manga.link}";
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
final response = await MBridge.http('GET', json.encode(data));
|
||||
if (response.hasError) {
|
||||
return response;
|
||||
}
|
||||
String res = response.body;
|
||||
final pages = MBridge.xpath(res, "//body/div/div/span/a/text()");
|
||||
List<String> pageUrls = [];
|
||||
if (pages.isEmpty) {
|
||||
@@ -150,7 +153,11 @@ getChapterPages(MManga manga) async {
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
};
|
||||
final data = {"url": pageLink, "headers": headers};
|
||||
responseText = await MBridge.http('GET', json.encode(data));
|
||||
final ress = await MBridge.http('GET', json.encode(data));
|
||||
if (ress.hasError) {
|
||||
return response;
|
||||
}
|
||||
responseText = ress.body;
|
||||
|
||||
if (responseText.isEmpty) {
|
||||
secretKey = "";
|
||||
|
||||
Reference in New Issue
Block a user