mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 02:41:39 +00:00
code refactor
This commit is contained in:
@@ -4,7 +4,7 @@ import 'dart:io';
|
|||||||
import '../model/source.dart';
|
import '../model/source.dart';
|
||||||
import 'src/en/aniwatch/sources.dart';
|
import 'src/en/aniwatch/sources.dart';
|
||||||
import 'src/en/gogoanime/source.dart';
|
import 'src/en/gogoanime/source.dart';
|
||||||
import 'src/en/wcostream/source.dart';
|
// import 'src/en/wcostream/source.dart';
|
||||||
import 'src/fr/animesultra/source.dart';
|
import 'src/fr/animesultra/source.dart';
|
||||||
import 'src/fr/franime/source.dart';
|
import 'src/fr/franime/source.dart';
|
||||||
import 'src/fr/otakufr/source.dart';
|
import 'src/fr/otakufr/source.dart';
|
||||||
@@ -16,7 +16,7 @@ void main() {
|
|||||||
franimeSource,
|
franimeSource,
|
||||||
universanimeSource,
|
universanimeSource,
|
||||||
otakufr,
|
otakufr,
|
||||||
wcostreamSource,
|
// wcostreamSource,
|
||||||
animesultraSource,
|
animesultraSource,
|
||||||
...aniwatchSourcesList
|
...aniwatchSourcesList
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,228 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
getPopularAnime(MangaModel anime) async {
|
|
||||||
final data = {
|
|
||||||
"url": "${anime.baseUrl}/most-popular?page=${anime.page}",
|
|
||||||
"headers": null,
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
return animeElementM(res, anime);
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesAnime(MangaModel anime) async {
|
|
||||||
final data = {
|
|
||||||
"url": "${anime.baseUrl}/top-airing?page=${anime.page}",
|
|
||||||
"headers": null,
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
return animeElementM(res, anime);
|
|
||||||
}
|
|
||||||
|
|
||||||
getAnimeDetail(MangaModel anime) async {
|
|
||||||
final statusList = [
|
|
||||||
{
|
|
||||||
"Currently Airing": 0,
|
|
||||||
"Finished Airing": 1,
|
|
||||||
}
|
|
||||||
];
|
|
||||||
final url = "${anime.baseUrl}${anime.link}";
|
|
||||||
final data = {"url": url, "headers": null};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
final status = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="anisc-info"]/div[contains(text(),"Status:")]/span[2]/text()',
|
|
||||||
'');
|
|
||||||
anime.status = MBridge.parseStatus(status, statusList);
|
|
||||||
anime.author = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="anisc-info"]/div[contains(text(),"Studios:")]/span/text()',
|
|
||||||
'')
|
|
||||||
.replaceAll("Studios:", "");
|
|
||||||
final aired = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="anisc-info"]/div[contains(text(),"Aired:")]/span/text()',
|
|
||||||
' ');
|
|
||||||
final japanese = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="anisc-info"]/div[contains(text(),"Japanese:")]/span/text()',
|
|
||||||
' ');
|
|
||||||
final synonyms = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="anisc-info"]/div[contains(text(),"Synonyms:")]/span/text()',
|
|
||||||
' ');
|
|
||||||
final premiered = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="anisc-info"]/div[contains(text(),"Premiered:")]/span/text()',
|
|
||||||
' ');
|
|
||||||
final overview = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="anisc-info"]/div[contains(text(),"Overview:")]/text()',
|
|
||||||
' ')
|
|
||||||
.replaceAll("Overview:", "");
|
|
||||||
String description = "$overview\n\n$japanese\n$synonyms\n$aired\n$premiered";
|
|
||||||
anime.description = description;
|
|
||||||
final genre = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="anisc-info"]/div[contains(text(),"Genres:")]/a/text()',
|
|
||||||
'_..')
|
|
||||||
.split("_..");
|
|
||||||
|
|
||||||
anime.genre = genre;
|
|
||||||
|
|
||||||
final id = MBridge.subString(anime.link, '-', 1);
|
|
||||||
final urlEp =
|
|
||||||
"${anime.baseUrl}/ajax${ajaxRoute('${anime.baseUrl}')}/episode/list/$id";
|
|
||||||
|
|
||||||
final dataEp = {
|
|
||||||
"url": urlEp,
|
|
||||||
"headers": {"referer": url}
|
|
||||||
};
|
|
||||||
final resEp = await MBridge.http(json.encode(dataEp), 0);
|
|
||||||
final html = MBridge.getMapValue(resEp, "html", 0);
|
|
||||||
final epUrls =
|
|
||||||
MBridge.querySelectorAll(html, "a.ep-item", 3, "href", 0, 0, '._')
|
|
||||||
.split("._");
|
|
||||||
anime.urls = MBridge.listParse(epUrls, 5);
|
|
||||||
|
|
||||||
List<String> numbers =
|
|
||||||
MBridge.querySelectorAll(html, "a.ep-item", 3, "data-number", 0, 0, '._')
|
|
||||||
.split("._");
|
|
||||||
List<String> titles =
|
|
||||||
MBridge.querySelectorAll(html, "a.ep-item", 3, "title", 0, 0, '._')
|
|
||||||
.split("._");
|
|
||||||
|
|
||||||
List<String> episodes = [];
|
|
||||||
|
|
||||||
for (var i = 0; i < titles.length; i++) {
|
|
||||||
final number = MBridge.listParse(numbers, 0)[i];
|
|
||||||
final title = MBridge.listParse(titles, 0)[i];
|
|
||||||
episodes.add("Episode ${number}: $title");
|
|
||||||
}
|
|
||||||
|
|
||||||
anime.names = MBridge.listParse(episodes, 5);
|
|
||||||
anime.chaptersDateUploads = [];
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
searchAnime(MangaModel anime) async {
|
|
||||||
final data = {
|
|
||||||
"url":
|
|
||||||
"${anime.baseUrl}/search?keyword=${anime.query}&page=${anime.page}",
|
|
||||||
"headers": null,
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
return animeElementM(res, anime);
|
|
||||||
}
|
|
||||||
|
|
||||||
getVideoList(MangaModel anime) async {
|
|
||||||
final id = MBridge.subString(anime.link, '?ep=', 1);
|
|
||||||
final datas = {
|
|
||||||
"url":
|
|
||||||
"${anime.baseUrl}/ajax${ajaxRoute('${anime.baseUrl}')}/episode/servers?episodeId=$id",
|
|
||||||
"headers": {"referer": "${anime.baseUrl}/${anime.link}"},
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
|
|
||||||
final res = await MBridge.http(json.encode(datas), 0);
|
|
||||||
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
final html = MBridge.getMapValue(res, "html", 0);
|
|
||||||
final names =
|
|
||||||
MBridge.querySelectorAll(html, "div.server-item", 0, "", 0, 0, '._')
|
|
||||||
.split("._");
|
|
||||||
|
|
||||||
final ids = MBridge.querySelectorAll(
|
|
||||||
html, "div.server-item", 3, "data-id", 0, 0, '._')
|
|
||||||
.split("._");
|
|
||||||
final subDubs = MBridge.querySelectorAll(
|
|
||||||
html, "div.server-item", 3, "data-type", 0, 0, '._')
|
|
||||||
.split("._");
|
|
||||||
|
|
||||||
List<VideoModel> videos = [];
|
|
||||||
|
|
||||||
for (var i = 0; i < names.length; i++) {
|
|
||||||
final name = MBridge.listParse(names, 0)[i].toString();
|
|
||||||
final id = MBridge.listParse(ids, 0)[i].toString();
|
|
||||||
final subDub = MBridge.listParse(subDubs, 0)[i].toString();
|
|
||||||
final datasE = {
|
|
||||||
"url":
|
|
||||||
"${anime.baseUrl}/ajax${ajaxRoute('${anime.baseUrl}')}/episode/sources?id=$id",
|
|
||||||
"headers": {"referer": "${anime.baseUrl}/${anime.link}"},
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
|
|
||||||
final resE = await MBridge.http(json.encode(datasE), 0);
|
|
||||||
String url =
|
|
||||||
MBridge.subString(MBridge.subString(resE, "\"link\":\"", 2), "\"", 0);
|
|
||||||
print(url);
|
|
||||||
List<VideoModel> a = [];
|
|
||||||
if (name.contains("Vidstreaming")) {
|
|
||||||
a = await MBridge.rapidCloudExtractor(url, "Vidstreaming - $subDub");
|
|
||||||
} else if (name.contains("Vidcloud")) {
|
|
||||||
a = await MBridge.rapidCloudExtractor(url, "Vidcloud - $subDub");
|
|
||||||
} else if (name.contains("StreamTape")) {
|
|
||||||
a = await MBridge.streamTapeExtractor(url,"StreamTape - $subDub");
|
|
||||||
}
|
|
||||||
for (var vi in a) {
|
|
||||||
videos.add(vi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return videos;
|
|
||||||
}
|
|
||||||
|
|
||||||
MangaModel animeElementM(String res, MangaModel anime) async {
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
anime.urls = MBridge.xpath(res,
|
|
||||||
'//*[@class^="flw-item"]/div[@class="film-detail"]/h3/a/@href', '._')
|
|
||||||
.split('._');
|
|
||||||
|
|
||||||
anime.names = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class^="flw-item"]/div[@class="film-detail"]/h3/a/@data-jname',
|
|
||||||
'._')
|
|
||||||
.split('._');
|
|
||||||
|
|
||||||
anime.images = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class^="flw-item"]/div[@class="film-poster"]/img/@data-src',
|
|
||||||
'._')
|
|
||||||
.split('._');
|
|
||||||
final nextPage =
|
|
||||||
MBridge.xpath(res, '//li[@class="page-item"]/a[@title="Next"]/@href', "");
|
|
||||||
if (nextPage.isEmpty) {
|
|
||||||
anime.hasNextPage = false;
|
|
||||||
} else {
|
|
||||||
anime.hasNextPage = true;
|
|
||||||
}
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
String ajaxRoute(String baseUrl) {
|
|
||||||
if (baseUrl == "https://kaido.to") {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return "/v2";
|
|
||||||
}
|
|
||||||
214
anime/src/en/aniwatch/aniwatch-v0.0.2.dart
Normal file
214
anime/src/en/aniwatch/aniwatch-v0.0.2.dart
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'package:bridge_lib/bridge_lib.dart';
|
||||||
|
|
||||||
|
getPopularAnime(MangaModel anime) async {
|
||||||
|
final data = {"url": "${anime.baseUrl}/most-popular?page=${anime.page}"};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
return animeElementM(res, anime);
|
||||||
|
}
|
||||||
|
|
||||||
|
getLatestUpdatesAnime(MangaModel anime) async {
|
||||||
|
final data = {"url": "${anime.baseUrl}/top-airing?page=${anime.page}"};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
return animeElementM(res, anime);
|
||||||
|
}
|
||||||
|
|
||||||
|
getAnimeDetail(MangaModel anime) async {
|
||||||
|
final statusList = [
|
||||||
|
{
|
||||||
|
"Currently Airing": 0,
|
||||||
|
"Finished Airing": 1,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
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 status = MBridge.xpath(res,
|
||||||
|
'//*[@class="anisc-info"]/div[contains(text(),"Status:")]/span[2]/text()')
|
||||||
|
.first;
|
||||||
|
anime.status = MBridge.parseStatus(status, statusList);
|
||||||
|
anime.author = MBridge.xpath(res,
|
||||||
|
'//*[@class="anisc-info"]/div[contains(text(),"Studios:")]/span/text()')
|
||||||
|
.first
|
||||||
|
.replaceAll("Studios:", "");
|
||||||
|
final aired = MBridge.xpath(res,
|
||||||
|
'//*[@class="anisc-info"]/div[contains(text(),"Aired:")]/span/text()')
|
||||||
|
.first;
|
||||||
|
final japanese = MBridge.xpath(res,
|
||||||
|
'//*[@class="anisc-info"]/div[contains(text(),"Japanese:")]/span/text()')
|
||||||
|
.first;
|
||||||
|
final synonyms = MBridge.xpath(res,
|
||||||
|
'//*[@class="anisc-info"]/div[contains(text(),"Synonyms:")]/span/text()')
|
||||||
|
.first;
|
||||||
|
final premiered = MBridge.xpath(res,
|
||||||
|
'//*[@class="anisc-info"]/div[contains(text(),"Premiered:")]/span/text()')
|
||||||
|
.first;
|
||||||
|
final overview = MBridge.xpath(res,
|
||||||
|
'//*[@class="anisc-info"]/div[contains(text(),"Overview:")]/text()')
|
||||||
|
.first
|
||||||
|
.replaceAll("Overview:", "");
|
||||||
|
String description = "$overview\n\n$japanese\n$synonyms\n$aired\n$premiered";
|
||||||
|
anime.description = description;
|
||||||
|
final genre = MBridge.xpath(
|
||||||
|
res, '//*[@class="anisc-info"]/div[contains(text(),"Genres:")]/a/text()');
|
||||||
|
|
||||||
|
anime.genre = genre;
|
||||||
|
|
||||||
|
final id = MBridge.substringAfterLast(anime.link, '-');
|
||||||
|
final urlEp =
|
||||||
|
"${anime.baseUrl}/ajax${ajaxRoute('${anime.baseUrl}')}/episode/list/$id";
|
||||||
|
|
||||||
|
final dataEp = {
|
||||||
|
"url": urlEp,
|
||||||
|
"headers": {"referer": url}
|
||||||
|
};
|
||||||
|
final resEp = await MBridge.http('GET', json.encode(dataEp));
|
||||||
|
|
||||||
|
final html = json.decode(resEp)["html"];
|
||||||
|
|
||||||
|
final epUrls = MBridge.querySelectorAll(html,
|
||||||
|
selector: "a.ep-item", typeElement: 3, attributes: "href", typeRegExp: 0);
|
||||||
|
|
||||||
|
anime.urls = epUrls.reversed.toList();
|
||||||
|
|
||||||
|
final numbers = MBridge.querySelectorAll(html,
|
||||||
|
selector: "a.ep-item",
|
||||||
|
typeElement: 3,
|
||||||
|
attributes: "data-number",
|
||||||
|
typeRegExp: 0);
|
||||||
|
|
||||||
|
final titles = MBridge.querySelectorAll(html,
|
||||||
|
selector: "a.ep-item",
|
||||||
|
typeElement: 3,
|
||||||
|
attributes: "title",
|
||||||
|
typeRegExp: 0);
|
||||||
|
|
||||||
|
List<String> episodes = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < titles.length; i++) {
|
||||||
|
final number = numbers[i];
|
||||||
|
final title = titles[i];
|
||||||
|
episodes.add("Episode $number: $title");
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.names = episodes.reversed.toList();
|
||||||
|
anime.chaptersDateUploads = [];
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
searchAnime(MangaModel anime) async {
|
||||||
|
final data = {
|
||||||
|
"url": "${anime.baseUrl}/search?keyword=${anime.query}&page=${anime.page}"
|
||||||
|
};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
return animeElementM(res, anime);
|
||||||
|
}
|
||||||
|
|
||||||
|
getVideoList(MangaModel anime) async {
|
||||||
|
final id = MBridge.substringAfterLast(anime.link, '?ep=');
|
||||||
|
final datas = {
|
||||||
|
"url":
|
||||||
|
"${anime.baseUrl}/ajax${ajaxRoute('${anime.baseUrl}')}/episode/servers?episodeId=$id",
|
||||||
|
"headers": {"referer": "${anime.baseUrl}/${anime.link}"},
|
||||||
|
"sourceId": anime.sourceId
|
||||||
|
};
|
||||||
|
|
||||||
|
final res = await MBridge.http('GET', json.encode(datas));
|
||||||
|
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
final html = json.decode(res)["html"];
|
||||||
|
|
||||||
|
final names = MBridge.querySelectorAll(html,
|
||||||
|
selector: "div.server-item",
|
||||||
|
typeElement: 0,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0);
|
||||||
|
|
||||||
|
final ids = MBridge.querySelectorAll(html,
|
||||||
|
selector: "div.server-item",
|
||||||
|
typeElement: 3,
|
||||||
|
attributes: "data-id",
|
||||||
|
typeRegExp: 0);
|
||||||
|
|
||||||
|
final subDubs = MBridge.querySelectorAll(html,
|
||||||
|
selector: "div.server-item",
|
||||||
|
typeElement: 3,
|
||||||
|
attributes: "data-type",
|
||||||
|
typeRegExp: 0);
|
||||||
|
|
||||||
|
List<VideoModel> videos = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
final name = names[i];
|
||||||
|
final id = ids[i];
|
||||||
|
final subDub = subDubs[i];
|
||||||
|
final datasE = {
|
||||||
|
"url":
|
||||||
|
"${anime.baseUrl}/ajax${ajaxRoute('${anime.baseUrl}')}/episode/sources?id=$id",
|
||||||
|
"headers": {"referer": "${anime.baseUrl}/${anime.link}"}
|
||||||
|
};
|
||||||
|
|
||||||
|
final resE = await MBridge.http('GET', json.encode(datasE));
|
||||||
|
String url = MBridge.substringBefore(
|
||||||
|
MBridge.substringAfter(resE, "\"link\":\""), "\"");
|
||||||
|
print(url);
|
||||||
|
List<VideoModel> a = [];
|
||||||
|
if (name.contains("Vidstreaming")) {
|
||||||
|
a = await MBridge.rapidCloudExtractor(url, "Vidstreaming - $subDub");
|
||||||
|
} else if (name.contains("Vidcloud")) {
|
||||||
|
a = await MBridge.rapidCloudExtractor(url, "Vidcloud - $subDub");
|
||||||
|
} else if (name.contains("StreamTape")) {
|
||||||
|
a = await MBridge.streamTapeExtractor(url, "StreamTape - $subDub");
|
||||||
|
}
|
||||||
|
for (var vi in a) {
|
||||||
|
videos.add(vi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return videos;
|
||||||
|
}
|
||||||
|
|
||||||
|
MangaModel animeElementM(String res, MangaModel anime) async {
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
anime.urls = MBridge.xpath(
|
||||||
|
res, '//*[@class^="flw-item"]/div[@class="film-detail"]/h3/a/@href');
|
||||||
|
|
||||||
|
anime.names = MBridge.xpath(res,
|
||||||
|
'//*[@class^="flw-item"]/div[@class="film-detail"]/h3/a/@data-jname');
|
||||||
|
|
||||||
|
anime.images = MBridge.xpath(
|
||||||
|
res, '//*[@class^="flw-item"]/div[@class="film-poster"]/img/@data-src');
|
||||||
|
final nextPage =
|
||||||
|
MBridge.xpath(res, '//li[@class="page-item"]/a[@title="Next"]/@href', "");
|
||||||
|
if (nextPage.isEmpty) {
|
||||||
|
anime.hasNextPage = false;
|
||||||
|
} else {
|
||||||
|
anime.hasNextPage = true;
|
||||||
|
}
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
String ajaxRoute(String baseUrl) {
|
||||||
|
if (baseUrl == "https://kaido.to") {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return "/v2";
|
||||||
|
}
|
||||||
@@ -1,171 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
getPopularAnime(MangaModel anime) async {
|
|
||||||
final data = {
|
|
||||||
"url": "${anime.baseUrl}/popular.html?page=${anime.page}",
|
|
||||||
"headers": null,
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
anime.urls =
|
|
||||||
MBridge.xpath(res, '//*[@class="img"]/a/@href', '._').split('._');
|
|
||||||
|
|
||||||
anime.names =
|
|
||||||
MBridge.xpath(res, '//*[@class="img"]/a/@title', '._').split('._');
|
|
||||||
|
|
||||||
anime.images =
|
|
||||||
MBridge.xpath(res, '//*[@class="img"]/a/img/@src', '._').split('._');
|
|
||||||
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesAnime(MangaModel anime) async {
|
|
||||||
final url =
|
|
||||||
"https://ajax.gogo-load.com/ajax/page-recent-release-ongoing.html?page=${anime.page}&type=1";
|
|
||||||
final data = {"url": url, "headers": null, "sourceId": anime.sourceId};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
anime.urls = MBridge.xpath(
|
|
||||||
res, '//*[@class="added_series_body popular"]/ul/li/a[1]/@href', '._')
|
|
||||||
.split('._');
|
|
||||||
|
|
||||||
anime.names = MBridge.xpath(res,
|
|
||||||
'//*[//*[@class="added_series_body popular"]/ul/li/a[1]/@title', '._')
|
|
||||||
.split('._');
|
|
||||||
List<String> images = [];
|
|
||||||
List<String> imagess = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[//*[@class="added_series_body popular"]/ul/li/a/div[@class="thumbnail-popular"]/@style',
|
|
||||||
'._')
|
|
||||||
.split('._');
|
|
||||||
for (var url in MBridge.listParse(imagess, 0)) {
|
|
||||||
images.add(url.replaceAll("background: url('", "").replaceAll("');", ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
anime.images = images;
|
|
||||||
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getAnimeDetail(MangaModel anime) async {
|
|
||||||
final statusList = [
|
|
||||||
{
|
|
||||||
"Ongoing": 0,
|
|
||||||
"Completed": 1,
|
|
||||||
}
|
|
||||||
];
|
|
||||||
final url = "${anime.baseUrl}${anime.link}";
|
|
||||||
final data = {"url": url, "headers": null};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
final status = MBridge.xpath(res,
|
|
||||||
'//*[@class="anime_info_body_bg"]/p[@class="type"][5]/text()', '')
|
|
||||||
.replaceAll("Status: ", "");
|
|
||||||
|
|
||||||
anime.description = MBridge.xpath(res,
|
|
||||||
'//*[@class="anime_info_body_bg"]/p[@class="type"][2]/text()', '')
|
|
||||||
.replaceAll("Plot Summary: ", "");
|
|
||||||
|
|
||||||
anime.status = MBridge.parseStatus(status, statusList);
|
|
||||||
anime.genre = MBridge.listParse(
|
|
||||||
MBridge.xpath(res,
|
|
||||||
'//*[@class="anime_info_body_bg"]/p[@class="type"][3]/text()', '')
|
|
||||||
.replaceAll("Genre: ", "")
|
|
||||||
.split(","),
|
|
||||||
4);
|
|
||||||
|
|
||||||
final id = MBridge.xpath(res, '//*[@id="movie_id"]/@value', '');
|
|
||||||
final urlEp =
|
|
||||||
"https://ajax.gogo-load.com/ajax/load-list-episode?ep_start=0&ep_end=4000&id=$id";
|
|
||||||
final dataEp = {"url": urlEp, "headers": null};
|
|
||||||
final resEp = await MBridge.http(json.encode(dataEp), 0);
|
|
||||||
anime.urls =
|
|
||||||
MBridge.xpath(resEp, '//*[@id="episode_related"]/li/a/@href', '._')
|
|
||||||
.split("._");
|
|
||||||
List<String> names = MBridge.xpath(resEp,
|
|
||||||
'//*[@id="episode_related"]/li/a/div[@class="name"]/text()', '._')
|
|
||||||
.split("._");
|
|
||||||
|
|
||||||
List<String> episodes = [];
|
|
||||||
for (var a in MBridge.listParse(names, 0)) {
|
|
||||||
episodes.add("Episode ${MBridge.subString(a, ' ', 1)}");
|
|
||||||
}
|
|
||||||
|
|
||||||
anime.names = episodes;
|
|
||||||
anime.chaptersDateUploads = [];
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getVideoList(MangaModel anime) async {
|
|
||||||
final datas = {
|
|
||||||
"url": "${anime.baseUrl}${anime.link}",
|
|
||||||
"headers": null,
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
|
|
||||||
final res = await MBridge.http(json.encode(datas), 0);
|
|
||||||
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
final serverUrls = MBridge.xpath(
|
|
||||||
res, '//*[@class="anime_muti_link"]/ul/li/a/@data-video', ".-")
|
|
||||||
.split(".-");
|
|
||||||
List<String> classNames =
|
|
||||||
MBridge.xpath(res, '//*[@class="anime_muti_link"]/ul/li/@class', ".-")
|
|
||||||
.split(".-");
|
|
||||||
print(serverUrls);
|
|
||||||
List<VideoModel> videos = [];
|
|
||||||
for (var i = 0; i < classNames.length; i++) {
|
|
||||||
final name = MBridge.listParse(classNames, 0)[i].toString();
|
|
||||||
final url = MBridge.listParse(serverUrls, 0)[i].toString();
|
|
||||||
print(url);
|
|
||||||
List<VideoModel> a = [];
|
|
||||||
if (name.contains("anime")) {
|
|
||||||
a = await MBridge.gogoCdnExtractor(url);
|
|
||||||
} else if (name.contains("vidcdn")) {
|
|
||||||
a = await MBridge.gogoCdnExtractor(url);
|
|
||||||
} else if (name.contains("doodstream")) {
|
|
||||||
a = await MBridge.doodExtractor(url);
|
|
||||||
} else if (name.contains("mp4upload")) {
|
|
||||||
a = await MBridge.mp4UploadExtractor(url, null, "", "");
|
|
||||||
} else if (name.contains("streamsb")) {
|
|
||||||
// print("streamsb");
|
|
||||||
// print(url);
|
|
||||||
}
|
|
||||||
for (var vi in a) {
|
|
||||||
videos.add(vi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return videos;
|
|
||||||
}
|
|
||||||
|
|
||||||
searchAnime(MangaModel anime) async {
|
|
||||||
final url =
|
|
||||||
"${anime.baseUrl}/search.html?keyword=${anime.query}&page=${anime.page}";
|
|
||||||
final data = {"url": url, "headers": null, "sourceId": anime.sourceId};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
anime.urls =
|
|
||||||
MBridge.xpath(res, '//*[@class="img"]/a/@href', '._').split('._');
|
|
||||||
|
|
||||||
anime.names =
|
|
||||||
MBridge.xpath(res, '//*[@class="img"]/a/@title', '._').split('._');
|
|
||||||
|
|
||||||
anime.images =
|
|
||||||
MBridge.xpath(res, '//*[@class="img"]/a/img/@src', '._').split('._');
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
148
anime/src/en/gogoanime/gogoanime-v0.0.2.dart
Normal file
148
anime/src/en/gogoanime/gogoanime-v0.0.2.dart
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'package:bridge_lib/bridge_lib.dart';
|
||||||
|
|
||||||
|
getPopularAnime(MangaModel 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;
|
||||||
|
}
|
||||||
|
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');
|
||||||
|
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
getLatestUpdatesAnime(MangaModel 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;
|
||||||
|
}
|
||||||
|
anime.urls = MBridge.xpath(
|
||||||
|
res, '//*[@class="added_series_body popular"]/ul/li/a[1]/@href');
|
||||||
|
|
||||||
|
anime.names = MBridge.xpath(
|
||||||
|
res, '//*[//*[@class="added_series_body popular"]/ul/li/a[1]/@title');
|
||||||
|
List<String> images = [];
|
||||||
|
List<String> imagess = MBridge.xpath(res,
|
||||||
|
'//*[//*[@class="added_series_body popular"]/ul/li/a/div[@class="thumbnail-popular"]/@style');
|
||||||
|
for (var url in imagess) {
|
||||||
|
images.add(url.replaceAll("background: url('", "").replaceAll("');", ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.images = images;
|
||||||
|
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
getAnimeDetail(MangaModel anime) async {
|
||||||
|
final statusList = [
|
||||||
|
{
|
||||||
|
"Ongoing": 0,
|
||||||
|
"Completed": 1,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
final data = {"url": "${anime.baseUrl}${anime.link}"};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
final status = MBridge.xpath(
|
||||||
|
res, '//*[@class="anime_info_body_bg"]/p[@class="type"][5]/text()')
|
||||||
|
.first
|
||||||
|
.replaceAll("Status: ", "");
|
||||||
|
|
||||||
|
anime.description = MBridge.xpath(
|
||||||
|
res, '//*[@class="anime_info_body_bg"]/p[@class="type"][2]/text()')
|
||||||
|
.first
|
||||||
|
.replaceAll("Plot Summary: ", "");
|
||||||
|
|
||||||
|
anime.status = MBridge.parseStatus(status, statusList);
|
||||||
|
anime.genre = MBridge.xpath(
|
||||||
|
res, '//*[@class="anime_info_body_bg"]/p[@class="type"][3]/text()')
|
||||||
|
.first
|
||||||
|
.replaceAll("Genre: ", "")
|
||||||
|
.split(",");
|
||||||
|
|
||||||
|
final id = MBridge.xpath(res, '//*[@id="movie_id"]/@value').first;
|
||||||
|
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));
|
||||||
|
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()');
|
||||||
|
|
||||||
|
List<String> episodes = [];
|
||||||
|
for (var a in names) {
|
||||||
|
episodes.add("Episode ${MBridge.substringAfterLast(a, ' ')}");
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.names = episodes;
|
||||||
|
anime.chaptersDateUploads = [];
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
getVideoList(MangaModel anime) async {
|
||||||
|
final datas = {"url": "${anime.baseUrl}${anime.link}"};
|
||||||
|
|
||||||
|
final res = await MBridge.http('GET', json.encode(datas));
|
||||||
|
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
final serverUrls =
|
||||||
|
MBridge.xpath(res, '//*[@class="anime_muti_link"]/ul/li/a/@data-video');
|
||||||
|
final classNames =
|
||||||
|
MBridge.xpath(res, '//*[@class="anime_muti_link"]/ul/li/@class');
|
||||||
|
print(serverUrls);
|
||||||
|
List<VideoModel> videos = [];
|
||||||
|
for (var i = 0; i < classNames.length; i++) {
|
||||||
|
final name = classNames[i];
|
||||||
|
final url = serverUrls[i];
|
||||||
|
print(url);
|
||||||
|
List<VideoModel> a = [];
|
||||||
|
if (name.contains("anime")) {
|
||||||
|
a = await MBridge.gogoCdnExtractor(url);
|
||||||
|
} else if (name.contains("vidcdn")) {
|
||||||
|
a = await MBridge.gogoCdnExtractor(url);
|
||||||
|
} else if (name.contains("doodstream")) {
|
||||||
|
a = await MBridge.doodExtractor(url);
|
||||||
|
} else if (name.contains("mp4upload")) {
|
||||||
|
a = await MBridge.mp4UploadExtractor(url, null, "", "");
|
||||||
|
} else if (name.contains("streamsb")) {
|
||||||
|
// print("streamsb");
|
||||||
|
// print(url);
|
||||||
|
}
|
||||||
|
for (var vi in a) {
|
||||||
|
videos.add(vi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return videos;
|
||||||
|
}
|
||||||
|
|
||||||
|
searchAnime(MangaModel 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;
|
||||||
|
}
|
||||||
|
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');
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
@@ -1,175 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
getPopularAnime(MangaModel anime) async {
|
|
||||||
final data = {"url": "${anime.baseUrl}/", "headers": null};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
anime.urls = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[contains(@class,"swiper-slide item-qtip")]/div[@class="item"]/a/@href',
|
|
||||||
'._')
|
|
||||||
.split('._');
|
|
||||||
|
|
||||||
anime.names = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[contains(@class,"swiper-slide item-qtip")]/div[@class="item"]/a/img/@title',
|
|
||||||
'._')
|
|
||||||
.split('._');
|
|
||||||
|
|
||||||
anime.images = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[contains(@class,"swiper-slide item-qtip")]/div[@class="item"]/a/img/@data-src',
|
|
||||||
'._')
|
|
||||||
.split('._');
|
|
||||||
anime.hasNextPage = false;
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesAnime(MangaModel anime) async {
|
|
||||||
final data = {
|
|
||||||
"url": "${anime.baseUrl}/",
|
|
||||||
"headers": null,
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
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',
|
|
||||||
'._')
|
|
||||||
.split('._');
|
|
||||||
|
|
||||||
anime.names = 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/@title',
|
|
||||||
'._')
|
|
||||||
.split('._');
|
|
||||||
|
|
||||||
anime.images = 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"]/img/@data-src',
|
|
||||||
'._')
|
|
||||||
.split('._');
|
|
||||||
anime.hasNextPage = false;
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
searchAnime(MangaModel anime) async {
|
|
||||||
final url =
|
|
||||||
"${anime.baseUrl}/?story=${anime.query}&do=search&subaction=search";
|
|
||||||
final data = {"url": url, "headers": null};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
anime.urls =
|
|
||||||
MBridge.xpath(res, '//*[@class="film-poster"]/a/@href', '._').split('._');
|
|
||||||
|
|
||||||
anime.names = MBridge.xpath(res, '//*[@class="film-poster"]/a/@title', '._')
|
|
||||||
.split('._');
|
|
||||||
anime.images =
|
|
||||||
MBridge.xpath(res, '//*[@class="film-poster"]/img/@data-src', '._')
|
|
||||||
.split('._');
|
|
||||||
anime.hasNextPage = false;
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getAnimeDetail(MangaModel anime) async {
|
|
||||||
final statusList = [
|
|
||||||
{
|
|
||||||
"En cours": 0,
|
|
||||||
"Terminé": 1,
|
|
||||||
}
|
|
||||||
];
|
|
||||||
final url = anime.link;
|
|
||||||
final data = {"url": url, "headers": null};
|
|
||||||
String res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
anime.description =
|
|
||||||
MBridge.xpath(res, '//*[@class="film-description m-hide"]/text()', '');
|
|
||||||
|
|
||||||
final status = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="item item-title" and contains(text(),"Status:")]/span[2]/text()',
|
|
||||||
'');
|
|
||||||
|
|
||||||
anime.status = MBridge.parseStatus(status, statusList);
|
|
||||||
|
|
||||||
anime.genre = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="item item-list" and contains(text(),"Genres:")]/a/text()',
|
|
||||||
'._')
|
|
||||||
.split('._');
|
|
||||||
anime.author = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="item item-title" and contains(text(),"Studio:")]/span[2]/text()',
|
|
||||||
'');
|
|
||||||
final urlEp = anime.link.replaceAll('.html', '/episode-1.html');
|
|
||||||
final resEpWebview =
|
|
||||||
await MBridge.getHtmlViaWebview(urlEp, '//*[@class="ss-list"]/a/@href');
|
|
||||||
anime.urls = MBridge.listParse(
|
|
||||||
MBridge.xpath(resEpWebview, '//*[@class="ss-list"]/a/@href', '._')
|
|
||||||
.split("._"),
|
|
||||||
5);
|
|
||||||
|
|
||||||
anime.names = MBridge.listParse(
|
|
||||||
MBridge.xpath(
|
|
||||||
resEpWebview,
|
|
||||||
'//*[@class="ss-list"]/a/div[@class="ssli-detail"]/div/text()',
|
|
||||||
'._')
|
|
||||||
.split("._"),
|
|
||||||
5);
|
|
||||||
anime.chaptersDateUploads = [];
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getVideoList(MangaModel anime) async {
|
|
||||||
final resWebview = await MBridge.getHtmlViaWebview(
|
|
||||||
anime.link, '//*[@class="ps__-list"]/div/@data-server-id');
|
|
||||||
|
|
||||||
final serverIds = MBridge.xpath(
|
|
||||||
resWebview, '//*[@class="ps__-list"]/div/@data-server-id', ".-")
|
|
||||||
.split(".-");
|
|
||||||
final serverNames =
|
|
||||||
MBridge.xpath(resWebview, '//*[@class="ps__-list"]/div/a/text()', ".-")
|
|
||||||
.split(".-");
|
|
||||||
List<String> serverUrls = [];
|
|
||||||
for (var id in MBridge.listParse(serverIds, 0)) {
|
|
||||||
final serversUrls =
|
|
||||||
MBridge.xpath(resWebview, '//*[@id="content_player_${id}"]/text()', "");
|
|
||||||
serverUrls.add(serversUrls);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<VideoModel> videos = [];
|
|
||||||
for (var i = 0; i < serverNames.length; i++) {
|
|
||||||
final name = MBridge.listParse(serverNames, 0)[i].toString();
|
|
||||||
final url = MBridge.listParse(serverUrls, 0)[i].toString();
|
|
||||||
|
|
||||||
List<VideoModel> a = [];
|
|
||||||
if (name.contains("Sendvid")) {
|
|
||||||
a = await MBridge.sendVidExtractor(
|
|
||||||
url.replaceAll("https:////", "https://"),
|
|
||||||
json.encode({"Referer": "${anime.baseUrl}/"}),
|
|
||||||
"");
|
|
||||||
} else if (name.contains("Sibnet")) {
|
|
||||||
a = await MBridge.sibnetExtractor(
|
|
||||||
"https://video.sibnet.ru/shell.php?videoid=$url");
|
|
||||||
} else if (name.contains("Mytv")) {
|
|
||||||
a = await MBridge.myTvExtractor("https://www.myvi.tv/embed/$url");
|
|
||||||
}
|
|
||||||
for (var vi in a) {
|
|
||||||
videos.add(vi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return videos;
|
|
||||||
}
|
|
||||||
139
anime/src/fr/animesultra/animesultra-v0.0.2.dart
Normal file
139
anime/src/fr/animesultra/animesultra-v0.0.2.dart
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'package:bridge_lib/bridge_lib.dart';
|
||||||
|
|
||||||
|
getPopularAnime(MangaModel anime) async {
|
||||||
|
final data = {"url": "${anime.baseUrl}/"};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
anime.urls = MBridge.xpath(res,
|
||||||
|
'//*[contains(@class,"swiper-slide item-qtip")]/div[@class="item"]/a/@href');
|
||||||
|
|
||||||
|
anime.names = MBridge.xpath(res,
|
||||||
|
'//*[contains(@class,"swiper-slide item-qtip")]/div[@class="item"]/a/img/@title');
|
||||||
|
|
||||||
|
anime.images = MBridge.xpath(res,
|
||||||
|
'//*[contains(@class,"swiper-slide item-qtip")]/div[@class="item"]/a/img/@data-src');
|
||||||
|
anime.hasNextPage = false;
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
getLatestUpdatesAnime(MangaModel anime) async {
|
||||||
|
final data = {"url": "${anime.baseUrl}/"};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
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');
|
||||||
|
|
||||||
|
anime.names = 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/@title');
|
||||||
|
|
||||||
|
anime.images = 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"]/img/@data-src');
|
||||||
|
anime.hasNextPage = false;
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
searchAnime(MangaModel 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;
|
||||||
|
}
|
||||||
|
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');
|
||||||
|
anime.hasNextPage = false;
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
getAnimeDetail(MangaModel anime) async {
|
||||||
|
final statusList = [
|
||||||
|
{
|
||||||
|
"En cours": 0,
|
||||||
|
"Terminé": 1,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
final url = anime.link;
|
||||||
|
final data = {"url": url};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.description =
|
||||||
|
MBridge.xpath(res, '//*[@class="film-description m-hide"]/text()').first;
|
||||||
|
|
||||||
|
final status = MBridge.xpath(res,
|
||||||
|
'//*[@class="item item-title" and contains(text(),"Status:")]/span[2]/text()')
|
||||||
|
.first;
|
||||||
|
|
||||||
|
anime.status = MBridge.parseStatus(status, statusList);
|
||||||
|
|
||||||
|
anime.genre = MBridge.xpath(res,
|
||||||
|
'//*[@class="item item-list" and contains(text(),"Genres:")]/a/text()');
|
||||||
|
anime.author = MBridge.xpath(res,
|
||||||
|
'//*[@class="item item-title" and contains(text(),"Studio:")]/span[2]/text()')
|
||||||
|
.first;
|
||||||
|
final urlEp = anime.link.replaceAll('.html', '/episode-1.html');
|
||||||
|
final resEpWebview =
|
||||||
|
await MBridge.getHtmlViaWebview(urlEp, '//*[@class="ss-list"]/a/@href');
|
||||||
|
anime.urls = MBridge.xpath(resEpWebview, '//*[@class="ss-list"]/a/@href')
|
||||||
|
.reversed
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
anime.names = MBridge.xpath(resEpWebview,
|
||||||
|
'//*[@class="ss-list"]/a/div[@class="ssli-detail"]/div/text()')
|
||||||
|
.reversed
|
||||||
|
.toList();
|
||||||
|
anime.chaptersDateUploads = [];
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
getVideoList(MangaModel anime) async {
|
||||||
|
final resWebview = await MBridge.getHtmlViaWebview(
|
||||||
|
anime.link, '//*[@class="ps__-list"]/div/@data-server-id');
|
||||||
|
|
||||||
|
final serverIds =
|
||||||
|
MBridge.xpath(resWebview, '//*[@class="ps__-list"]/div/@data-server-id');
|
||||||
|
final serverNames =
|
||||||
|
MBridge.xpath(resWebview, '//*[@class="ps__-list"]/div/a/text()');
|
||||||
|
List<String> serverUrls = [];
|
||||||
|
for (var id in serverIds) {
|
||||||
|
final serversUrls =
|
||||||
|
MBridge.xpath(resWebview, '//*[@id="content_player_${id}"]/text()')
|
||||||
|
.first;
|
||||||
|
serverUrls.add(serversUrls);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<VideoModel> videos = [];
|
||||||
|
for (var i = 0; i < serverNames.length; i++) {
|
||||||
|
final name = serverNames[i];
|
||||||
|
final url = serverUrls[i];
|
||||||
|
|
||||||
|
List<VideoModel> a = [];
|
||||||
|
if (name.contains("Sendvid")) {
|
||||||
|
a = await MBridge.sendVidExtractor(
|
||||||
|
url.replaceAll("https:////", "https://"),
|
||||||
|
json.encode({"Referer": "${anime.baseUrl}/"}),
|
||||||
|
"");
|
||||||
|
} else if (name.contains("Sibnet")) {
|
||||||
|
a = await MBridge.sibnetExtractor(
|
||||||
|
"https://video.sibnet.ru/shell.php?videoid=$url");
|
||||||
|
} else if (name.contains("Mytv")) {
|
||||||
|
a = await MBridge.myTvExtractor("https://www.myvi.tv/embed/$url");
|
||||||
|
}
|
||||||
|
for (var vi in a) {
|
||||||
|
videos.add(vi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return videos;
|
||||||
|
}
|
||||||
@@ -1,407 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
Future<String> dataBase(int sourceId) async {
|
|
||||||
final data = {
|
|
||||||
"url": "https://api.franime.fr/api/animes/",
|
|
||||||
"headers": {"Referer": "https://franime.fr/"},
|
|
||||||
"sourceId": sourceId
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
getPopularAnime(MangaModel anime) async {
|
|
||||||
final data = {
|
|
||||||
"url": "https://api.franime.fr/api/animes/",
|
|
||||||
"headers": {"Referer": "https://franime.fr/"},
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
List<MangaModel> animeList = animeResList(res);
|
|
||||||
|
|
||||||
return animeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<MangaModel> animeResList(String res) {
|
|
||||||
final statusList = [
|
|
||||||
{"EN COURS": 0, "TERMINÉ": 1}
|
|
||||||
];
|
|
||||||
List<MangaModel> animeList = [];
|
|
||||||
final langs =
|
|
||||||
MBridge.jsonPathToList(res, r'$..saisons[*].episodes[*].lang', 1);
|
|
||||||
int index = 0;
|
|
||||||
List<String> jsonResList = MBridge.jsonDecodeToList(res, 1);
|
|
||||||
for (var animeJson in jsonResList) {
|
|
||||||
MangaModel anime = MangaModel();
|
|
||||||
List<String> seasons = MBridge.jsonDecodeToList(
|
|
||||||
MBridge.getMapValue(animeJson, "saisons", 1), 1);
|
|
||||||
final titleO = MBridge.getMapValue(animeJson, "titleO", 0);
|
|
||||||
final vo = MBridge.getMapValue(MBridge.listParse(langs, 0)[index], "vo", 1);
|
|
||||||
final vf = MBridge.getMapValue(MBridge.listParse(langs, 0)[index], "vf", 1);
|
|
||||||
final hasVostfr = MBridge.isEmptyOrIsNotEmpty(
|
|
||||||
MBridge.jsonDecodeToList(MBridge.getMapValue(vo, "lecteurs", 1), 0), 1);
|
|
||||||
final hasVf = MBridge.isEmptyOrIsNotEmpty(
|
|
||||||
MBridge.jsonDecodeToList(MBridge.getMapValue(vf, "lecteurs", 1), 0), 1);
|
|
||||||
String title = MBridge.getMapValue(animeJson, "title", 0);
|
|
||||||
final genre = MBridge.jsonDecodeToList(
|
|
||||||
MBridge.getMapValue(animeJson, "themes", 1), 0);
|
|
||||||
final description = MBridge.getMapValue(animeJson, "description", 0);
|
|
||||||
final status = MBridge.parseStatus(
|
|
||||||
MBridge.getMapValue(animeJson, "status", 0), statusList);
|
|
||||||
final imageUrl = MBridge.getMapValue(animeJson, "affiche", 0);
|
|
||||||
if (hasVostfr) {
|
|
||||||
for (int i = 0; i < seasons.length; i++) {
|
|
||||||
int ind = i + 1;
|
|
||||||
|
|
||||||
anime.genre = genre;
|
|
||||||
|
|
||||||
anime.description = description;
|
|
||||||
String seasonTitle = title;
|
|
||||||
if (seasons.length > 1) {
|
|
||||||
seasonTitle += " S$ind";
|
|
||||||
}
|
|
||||||
if (hasVostfr) {
|
|
||||||
seasonTitle += " VOSTFR";
|
|
||||||
}
|
|
||||||
anime.status = status;
|
|
||||||
anime.name = seasonTitle;
|
|
||||||
anime.imageUrl = imageUrl;
|
|
||||||
anime.link =
|
|
||||||
"/anime/${MBridge.regExp(titleO, "[^A-Za-z0-9 ]", "", 0, 0).replaceAll(" ", "-").toLowerCase()}?lang=vo&s=$ind";
|
|
||||||
ind++;
|
|
||||||
}
|
|
||||||
} else if (hasVf) {
|
|
||||||
for (int i = 0; i < seasons.length; i++) {
|
|
||||||
int ind = i + 1;
|
|
||||||
anime.genre = genre;
|
|
||||||
anime.description = description;
|
|
||||||
String seasonTitle = title;
|
|
||||||
if (seasons.length > 1) {
|
|
||||||
seasonTitle += " S$ind";
|
|
||||||
}
|
|
||||||
if (hasVf) {
|
|
||||||
seasonTitle += " VF";
|
|
||||||
}
|
|
||||||
anime.status = status;
|
|
||||||
anime.name = seasonTitle;
|
|
||||||
anime.imageUrl = imageUrl;
|
|
||||||
anime.link =
|
|
||||||
"/anime/${MBridge.regExp(titleO, "[^A-Za-z0-9 ]", "", 0, 0).replaceAll(" ", "-").toLowerCase()}?lang=vo&s=$ind";
|
|
||||||
ind++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
animeList.add(anime);
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
return animeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
String databaseAnimeByTitleO(String res, String titleO) {
|
|
||||||
print(titleO);
|
|
||||||
List<String> datas = MBridge.jsonDecodeToList(res, 1);
|
|
||||||
for (var data in datas) {
|
|
||||||
if (MBridge.regExp(MBridge.getMapValue(data, "titleO", 0), "[^A-Za-z0-9 ]",
|
|
||||||
"", 0, 0)
|
|
||||||
.replaceAll(" ", "-")
|
|
||||||
.toLowerCase() ==
|
|
||||||
"${titleO}") {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
getAnimeDetail(MangaModel anime) async {
|
|
||||||
String language = "vo".toString();
|
|
||||||
if (anime.link.contains("lang=")) {
|
|
||||||
language = MBridge.listParse(
|
|
||||||
MBridge.listParse(anime.link.split("lang="), 2)[0].split("&"), 1)[0];
|
|
||||||
print(language);
|
|
||||||
}
|
|
||||||
String stem = MBridge.listParse(
|
|
||||||
MBridge.listParse(anime.link.split("/"), 2)[0].split("?"), 1)[0];
|
|
||||||
final res = await dataBase(anime.sourceId);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
final animeByTitleOJson = databaseAnimeByTitleO(res, stem);
|
|
||||||
if (animeByTitleOJson.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
String seasonsJson =
|
|
||||||
MBridge.jsonPathToList(animeByTitleOJson, r'$..saisons', 1)[0];
|
|
||||||
List<String> seasons = MBridge.jsonDecodeToList(seasonsJson, 1);
|
|
||||||
|
|
||||||
if (anime.link.contains("s=")) {
|
|
||||||
int seasonNumber =
|
|
||||||
MBridge.intParse(MBridge.listParse(anime.link.split("s="), 2)[0]);
|
|
||||||
seasonsJson = MBridge.listParse(seasons, 0)[seasonNumber - 1];
|
|
||||||
} else {
|
|
||||||
seasonsJson = MBridge.listParse(seasons, 0)[0];
|
|
||||||
}
|
|
||||||
final episodesJson =
|
|
||||||
MBridge.jsonPathToList(seasonsJson, r'$..episodes', 1)[0];
|
|
||||||
List<String> episodes = MBridge.jsonDecodeToList(episodesJson, 1);
|
|
||||||
List<String> episodesNames = [];
|
|
||||||
List<String> episodesUrls = [];
|
|
||||||
for (int i = 0; i < episodes.length; i++) {
|
|
||||||
String episode = MBridge.listParse(episodes, 0)[i];
|
|
||||||
final lang = MBridge.getMapValue(episode, "lang", 1);
|
|
||||||
final vo = MBridge.getMapValue(lang, "vo", 1);
|
|
||||||
final vf = MBridge.getMapValue(lang, "vf", 1);
|
|
||||||
final hasVostfr = MBridge.isEmptyOrIsNotEmpty(
|
|
||||||
MBridge.jsonDecodeToList(MBridge.getMapValue(vo, "lecteurs", 1), 0), 1);
|
|
||||||
final hasVf = MBridge.isEmptyOrIsNotEmpty(
|
|
||||||
MBridge.jsonDecodeToList(MBridge.getMapValue(vf, "lecteurs", 1), 0), 1);
|
|
||||||
bool playerIsNotEmpty = false;
|
|
||||||
if (language == "vo" && hasVostfr) {
|
|
||||||
playerIsNotEmpty = true;
|
|
||||||
} else if (language == "vf" && hasVf) {
|
|
||||||
playerIsNotEmpty = true;
|
|
||||||
}
|
|
||||||
if (playerIsNotEmpty) {
|
|
||||||
episodesUrls.add("${anime.link}&ep=${i + 1}");
|
|
||||||
final title = MBridge.getMapValue(episode, "title", 1);
|
|
||||||
episodesNames.add(title.replaceAll('"', ""));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
anime.urls = MBridge.listParse(episodesUrls, 5);
|
|
||||||
anime.names = MBridge.listParse(episodesNames, 5);
|
|
||||||
anime.chaptersDateUploads = [];
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesAnime(MangaModel anime) async {
|
|
||||||
final res = await dataBase(anime.sourceId);
|
|
||||||
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
List<String> reversed =
|
|
||||||
MBridge.listParse(MBridge.jsonDecodeToList(res, 1), 5);
|
|
||||||
String reversedJson = "".toString();
|
|
||||||
for (int i = 0; i < reversed.length; i++) {
|
|
||||||
final va = MBridge.listParse(reversed, 0)[i];
|
|
||||||
String vg = "".toString();
|
|
||||||
if (reversedJson.isNotEmpty) {
|
|
||||||
vg = ",".toString();
|
|
||||||
}
|
|
||||||
reversedJson += "$vg$va";
|
|
||||||
}
|
|
||||||
List<MangaModel> animeList = animeResList("[${reversedJson}]");
|
|
||||||
|
|
||||||
return animeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
searchAnime(MangaModel anime) async {
|
|
||||||
final res = await dataBase(anime.sourceId);
|
|
||||||
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
List<MangaModel> animeList = animeSeachFetch(res, anime.query);
|
|
||||||
return animeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<MangaModel> animeSeachFetch(String res, query) {
|
|
||||||
final statusList = [
|
|
||||||
{"EN COURS": 0, "TERMINÉ": 1}
|
|
||||||
];
|
|
||||||
List<MangaModel> animeList = [];
|
|
||||||
final langs =
|
|
||||||
MBridge.jsonPathToList(res, r'$..saisons[*].episodes[*].lang', 1);
|
|
||||||
int index = 0;
|
|
||||||
List<String> jsonResList = MBridge.jsonDecodeToList(res, 1);
|
|
||||||
for (var animeJson in jsonResList) {
|
|
||||||
MangaModel anime = MangaModel();
|
|
||||||
|
|
||||||
final titleO = MBridge.getMapValue(animeJson, "titleO", 0);
|
|
||||||
|
|
||||||
final titleAlt = MBridge.getMapValue(animeJson, "titles", 1);
|
|
||||||
final enContains = MBridge.getMapValue(titleAlt, "en", 0)
|
|
||||||
.toString()
|
|
||||||
.toLowerCase()
|
|
||||||
.contains(query);
|
|
||||||
final enJpContains = MBridge.getMapValue(titleAlt, "en_jp", 0)
|
|
||||||
.toString()
|
|
||||||
.toLowerCase()
|
|
||||||
.contains(query);
|
|
||||||
final jaJpContains = MBridge.getMapValue(titleAlt, "ja_jp", 0)
|
|
||||||
.toString()
|
|
||||||
.toLowerCase()
|
|
||||||
.contains(query);
|
|
||||||
final titleOContains = titleO.toLowerCase().contains(query);
|
|
||||||
bool contains = false;
|
|
||||||
if (enContains) {
|
|
||||||
contains = true;
|
|
||||||
}
|
|
||||||
if (enJpContains) {
|
|
||||||
contains = true;
|
|
||||||
}
|
|
||||||
if (jaJpContains) {
|
|
||||||
contains = true;
|
|
||||||
}
|
|
||||||
if (titleOContains) {
|
|
||||||
contains = true;
|
|
||||||
}
|
|
||||||
if (contains) {
|
|
||||||
List<String> seasons = MBridge.jsonDecodeToList(
|
|
||||||
MBridge.getMapValue(animeJson, "saisons", 1), 1);
|
|
||||||
final vo =
|
|
||||||
MBridge.getMapValue(MBridge.listParse(langs, 0)[index], "vo", 1);
|
|
||||||
final vf =
|
|
||||||
MBridge.getMapValue(MBridge.listParse(langs, 0)[index], "vf", 1);
|
|
||||||
final hasVostfr = MBridge.isEmptyOrIsNotEmpty(
|
|
||||||
MBridge.jsonDecodeToList(MBridge.getMapValue(vo, "lecteurs", 1), 0),
|
|
||||||
1);
|
|
||||||
final hasVf = MBridge.isEmptyOrIsNotEmpty(
|
|
||||||
MBridge.jsonDecodeToList(MBridge.getMapValue(vf, "lecteurs", 1), 0),
|
|
||||||
1);
|
|
||||||
String title = MBridge.getMapValue(animeJson, "title", 0);
|
|
||||||
final genre = MBridge.jsonDecodeToList(
|
|
||||||
MBridge.getMapValue(animeJson, "themes", 1), 0);
|
|
||||||
final description = MBridge.getMapValue(animeJson, "description", 0);
|
|
||||||
final status = MBridge.parseStatus(
|
|
||||||
MBridge.getMapValue(animeJson, "status", 0), statusList);
|
|
||||||
final imageUrl = MBridge.getMapValue(animeJson, "affiche", 0);
|
|
||||||
if (hasVostfr) {
|
|
||||||
for (int i = 0; i < seasons.length; i++) {
|
|
||||||
int ind = i + 1;
|
|
||||||
|
|
||||||
anime.genre = genre;
|
|
||||||
anime.description = description;
|
|
||||||
String seasonTitle = title;
|
|
||||||
if (seasons.length > 1) {
|
|
||||||
seasonTitle += " S$ind";
|
|
||||||
}
|
|
||||||
if (hasVostfr) {
|
|
||||||
seasonTitle += " VOSTFR";
|
|
||||||
}
|
|
||||||
anime.status = status;
|
|
||||||
anime.name = seasonTitle;
|
|
||||||
anime.imageUrl = imageUrl;
|
|
||||||
anime.link =
|
|
||||||
"/anime/${MBridge.regExp(titleO, "[^A-Za-z0-9 ]", "", 0, 0).replaceAll(" ", "-").toLowerCase()}?lang=vo&s=$ind";
|
|
||||||
ind++;
|
|
||||||
}
|
|
||||||
} else if (hasVf) {
|
|
||||||
for (int i = 0; i < seasons.length; i++) {
|
|
||||||
int ind = i + 1;
|
|
||||||
anime.genre = genre;
|
|
||||||
anime.description = description;
|
|
||||||
String seasonTitle = title;
|
|
||||||
if (seasons.length > 1) {
|
|
||||||
seasonTitle += " S$ind";
|
|
||||||
}
|
|
||||||
if (hasVf) {
|
|
||||||
seasonTitle += " VF";
|
|
||||||
}
|
|
||||||
anime.status = status;
|
|
||||||
anime.name = seasonTitle;
|
|
||||||
anime.imageUrl = imageUrl;
|
|
||||||
anime.link =
|
|
||||||
"/anime/${MBridge.regExp(titleO, "[^A-Za-z0-9 ]", "", 0, 0).replaceAll(" ", "-").toLowerCase()}?lang=vf&s=$ind";
|
|
||||||
ind++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
animeList.add(anime);
|
|
||||||
}
|
|
||||||
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
return animeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
getVideoList(MangaModel anime) async {
|
|
||||||
String language = "vo".toString();
|
|
||||||
String videoBaseUrl = "https://api.franime.fr/api/anime".toString();
|
|
||||||
if (anime.link.contains("lang=")) {
|
|
||||||
language = MBridge.listParse(
|
|
||||||
MBridge.listParse(anime.link.split("lang="), 2)[0].split("&"), 1)[0];
|
|
||||||
print(language);
|
|
||||||
}
|
|
||||||
String stem = MBridge.listParse(
|
|
||||||
MBridge.listParse(anime.link.split("/"), 2)[0].split("?"), 1)[0];
|
|
||||||
final res = await dataBase(anime.sourceId);
|
|
||||||
final animeByTitleOJson = databaseAnimeByTitleO(res, stem);
|
|
||||||
final animeId = MBridge.getMapValue(animeByTitleOJson, "id", 0);
|
|
||||||
videoBaseUrl += "/$animeId/";
|
|
||||||
|
|
||||||
String seasonsJson =
|
|
||||||
MBridge.jsonPathToList(animeByTitleOJson, r'$..saisons', 1)[0];
|
|
||||||
List<String> seasons = MBridge.jsonDecodeToList(seasonsJson, 1);
|
|
||||||
if (anime.link.contains("s=")) {
|
|
||||||
int seasonNumber = MBridge.intParse(MBridge.listParse(
|
|
||||||
MBridge.listParse(anime.link.split("s="), 2)[0].split("&"), 1)[0]);
|
|
||||||
print(seasonNumber);
|
|
||||||
videoBaseUrl += "${seasonNumber - 1}/";
|
|
||||||
seasonsJson = MBridge.listParse(seasons, 0)[seasonNumber - 1];
|
|
||||||
} else {
|
|
||||||
seasonsJson = MBridge.listParse(seasons, 0)[0];
|
|
||||||
videoBaseUrl += "0/";
|
|
||||||
}
|
|
||||||
final episodesJson =
|
|
||||||
MBridge.jsonPathToList(seasonsJson, r'$..episodes', 1)[0];
|
|
||||||
List<String> episodes = MBridge.jsonDecodeToList(episodesJson, 1);
|
|
||||||
String episode = "".toString();
|
|
||||||
if (anime.link.contains("ep=")) {
|
|
||||||
int episodeNumber =
|
|
||||||
MBridge.intParse(MBridge.listParse(anime.link.split("ep="), 2)[0]);
|
|
||||||
print(episodeNumber);
|
|
||||||
episode = MBridge.listParse(episodes, 0)[episodeNumber - 1];
|
|
||||||
videoBaseUrl += "${episodeNumber - 1}";
|
|
||||||
} else {
|
|
||||||
episode = MBridge.listParse(episodes, 0)[0];
|
|
||||||
videoBaseUrl += "0";
|
|
||||||
}
|
|
||||||
final lang = MBridge.getMapValue(episode, "lang", 1);
|
|
||||||
final vo = MBridge.getMapValue(lang, "vo", 1);
|
|
||||||
final vf = MBridge.getMapValue(lang, "vf", 1);
|
|
||||||
final vostfrPlayers =
|
|
||||||
MBridge.jsonDecodeToList(MBridge.getMapValue(vo, "lecteurs", 1), 0);
|
|
||||||
final vfPlayers =
|
|
||||||
MBridge.jsonDecodeToList(MBridge.getMapValue(vf, "lecteurs", 1), 0);
|
|
||||||
final hasVostfr = MBridge.isEmptyOrIsNotEmpty(vostfrPlayers, 1);
|
|
||||||
final hasVf = MBridge.isEmptyOrIsNotEmpty(vfPlayers, 1);
|
|
||||||
List<String> players = [];
|
|
||||||
if (language == "vo" && hasVostfr) {
|
|
||||||
players = vostfrPlayers;
|
|
||||||
print(players);
|
|
||||||
} else if (language == "vf" && hasVf) {
|
|
||||||
players = vfPlayers;
|
|
||||||
print(players);
|
|
||||||
}
|
|
||||||
List<VideoModel> videos = [];
|
|
||||||
for (int i = 0; i < players.length; i++) {
|
|
||||||
String apiUrl = "$videoBaseUrl/$language/$i";
|
|
||||||
String playerName = MBridge.listParse(players, 0)[i];
|
|
||||||
final data = {
|
|
||||||
"url": apiUrl,
|
|
||||||
"headers": {"Referer": "https://franime.fr/"},
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
final playerUrl = await MBridge.http(json.encode(data), 0);
|
|
||||||
List<VideoModel> a = [];
|
|
||||||
if (playerName.contains("franime_myvi")) {
|
|
||||||
videos.add(
|
|
||||||
MBridge.toVideo(playerUrl, "FRAnime", playerUrl, null, null, null));
|
|
||||||
} else if (playerName.contains("myvi")) {
|
|
||||||
a = await MBridge.myTvExtractor(playerUrl);
|
|
||||||
} else if (playerName.contains("sendvid")) {
|
|
||||||
a = await MBridge.sendVidExtractor(
|
|
||||||
playerUrl, json.encode({"Referer": "https://franime.fr/"}), "");
|
|
||||||
} else if (playerName.contains("sibnet")) {
|
|
||||||
a = await MBridge.sibnetExtractor(playerUrl);
|
|
||||||
} else if (playerName.contains("sbfull")) {}
|
|
||||||
for (var vi in a) {
|
|
||||||
videos.add(vi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return videos;
|
|
||||||
}
|
|
||||||
387
anime/src/fr/franime/franime-v0.0.2.dart
Normal file
387
anime/src/fr/franime/franime-v0.0.2.dart
Normal file
@@ -0,0 +1,387 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'package:bridge_lib/bridge_lib.dart';
|
||||||
|
|
||||||
|
Future<String> 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
getPopularAnime(MangaModel anime) async {
|
||||||
|
final data = {
|
||||||
|
"url": "https://api.franime.fr/api/animes/",
|
||||||
|
"headers": {"Referer": "https://franime.fr/"}
|
||||||
|
};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
List<MangaModel> animeList = animeResList(res);
|
||||||
|
|
||||||
|
return animeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MangaModel> animeResList(String res) {
|
||||||
|
final statusList = [
|
||||||
|
{"EN COURS": 0, "TERMINÉ": 1}
|
||||||
|
];
|
||||||
|
List<MangaModel> animeList = [];
|
||||||
|
|
||||||
|
final jsonResList = json.decode(res);
|
||||||
|
|
||||||
|
for (var animeJson in jsonResList) {
|
||||||
|
MangaModel anime = MangaModel();
|
||||||
|
final seasons = animeJson["saisons"];
|
||||||
|
List vostfrListName = [];
|
||||||
|
List vfListName = [];
|
||||||
|
for (var season in seasons) {
|
||||||
|
for (var episode in season["episodes"]) {
|
||||||
|
final lang = episode["lang"];
|
||||||
|
final vo = lang["vo"];
|
||||||
|
final vf = lang["vf"];
|
||||||
|
vostfrListName.add(vo["lecteurs"].isNotEmpty);
|
||||||
|
vfListName.add(vf["lecteurs"].isNotEmpty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final titleO = animeJson["titleO"];
|
||||||
|
final title = animeJson["title"];
|
||||||
|
final genre = animeJson["themes"];
|
||||||
|
final description = animeJson["description"];
|
||||||
|
final status = MBridge.parseStatus(animeJson["status"], statusList);
|
||||||
|
final imageUrl = animeJson["affiche"];
|
||||||
|
|
||||||
|
if (vostfrListName.contains(true)) {
|
||||||
|
for (int i = 0; i < seasons.length; i++) {
|
||||||
|
int ind = i + 1;
|
||||||
|
anime.genre = genre;
|
||||||
|
anime.description = description;
|
||||||
|
String seasonTitle = title.isEmpty ? titleO : title;
|
||||||
|
if (seasons.length > 1) {
|
||||||
|
seasonTitle += " S$ind";
|
||||||
|
}
|
||||||
|
if (vostfrListName.contains(true)) {
|
||||||
|
seasonTitle += " VOSTFR";
|
||||||
|
}
|
||||||
|
anime.status = status;
|
||||||
|
anime.name = seasonTitle;
|
||||||
|
anime.imageUrl = imageUrl;
|
||||||
|
anime.link =
|
||||||
|
"/anime/${MBridge.regExp(titleO, "[^A-Za-z0-9 ]", "", 0, 0).replaceAll(" ", "-").toLowerCase()}?lang=vo&s=$ind";
|
||||||
|
ind++;
|
||||||
|
}
|
||||||
|
} else if (vfListName.contains(true)) {
|
||||||
|
for (int i = 0; i < seasons.length; i++) {
|
||||||
|
int ind = i + 1;
|
||||||
|
anime.genre = genre;
|
||||||
|
anime.description = description;
|
||||||
|
String seasonTitle = title.isEmpty ? titleO : title;
|
||||||
|
if (seasons.length > 1) {
|
||||||
|
seasonTitle += " S$ind";
|
||||||
|
}
|
||||||
|
if (vfListName.contains(true)) {
|
||||||
|
seasonTitle += " VF";
|
||||||
|
}
|
||||||
|
anime.status = status;
|
||||||
|
anime.name = seasonTitle;
|
||||||
|
anime.imageUrl = imageUrl;
|
||||||
|
anime.link =
|
||||||
|
"/anime/${MBridge.regExp(titleO, "[^A-Za-z0-9 ]", "", 0, 0).replaceAll(" ", "-").toLowerCase()}?lang=vo&s=$ind";
|
||||||
|
ind++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
return animeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
String databaseAnimeByTitleO(String res, String titleO) {
|
||||||
|
final datas = MBridge.jsonDecodeToList(res, 1);
|
||||||
|
for (var data in datas) {
|
||||||
|
if (MBridge.regExp(
|
||||||
|
MBridge.getMapValue(data, "titleO"), "[^A-Za-z0-9 ]", "", 0, 0)
|
||||||
|
.replaceAll(" ", "-")
|
||||||
|
.toLowerCase() ==
|
||||||
|
"${titleO}") {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
getAnimeDetail(MangaModel anime) async {
|
||||||
|
String language = "vo".toString();
|
||||||
|
if (anime.link.contains("lang=")) {
|
||||||
|
language = MBridge.substringBefore(
|
||||||
|
MBridge.substringAfter(anime.link, "lang="), "&");
|
||||||
|
}
|
||||||
|
String stem =
|
||||||
|
MBridge.substringBefore(MBridge.substringAfterLast(anime.link, "/"), "?");
|
||||||
|
final res = await dataBase(anime.sourceId);
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
final animeByTitleOJson = databaseAnimeByTitleO(res, stem);
|
||||||
|
if (animeByTitleOJson.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
final seasons = json.decode(animeByTitleOJson)["saisons"];
|
||||||
|
|
||||||
|
var seasonsJson = seasons.first;
|
||||||
|
|
||||||
|
if (anime.link.contains("s=")) {
|
||||||
|
int seasonNumber = MBridge.intParse(
|
||||||
|
MBridge.substringBefore(MBridge.substringAfter(anime.link, "s="), "&"));
|
||||||
|
seasonsJson = seasons[seasonNumber - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
final episodes = seasonsJson["episodes"];
|
||||||
|
|
||||||
|
List<String> episodesNames = [];
|
||||||
|
List<String> episodesUrls = [];
|
||||||
|
for (int i = 0; i < episodes.length; i++) {
|
||||||
|
final episode = episodes[i];
|
||||||
|
|
||||||
|
final lang = episode["lang"];
|
||||||
|
|
||||||
|
final vo = lang["vo"];
|
||||||
|
final vf = lang["vf"];
|
||||||
|
bool hasVostfr = vo["lecteurs"].isNotEmpty;
|
||||||
|
bool hasVf = vf["lecteurs"].isNotEmpty;
|
||||||
|
bool playerIsNotEmpty = false;
|
||||||
|
|
||||||
|
if (language == "vo" && hasVostfr) {
|
||||||
|
playerIsNotEmpty = true;
|
||||||
|
} else if (language == "vf" && hasVf) {
|
||||||
|
playerIsNotEmpty = true;
|
||||||
|
}
|
||||||
|
if (playerIsNotEmpty) {
|
||||||
|
episodesUrls.add("${anime.link}&ep=${i + 1}");
|
||||||
|
String title = episode["title"];
|
||||||
|
episodesNames.add(title.replaceAll('"', ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.urls = episodesUrls.reversed.toList();
|
||||||
|
anime.names = episodesNames.reversed.toList();
|
||||||
|
anime.chaptersDateUploads = [];
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
getLatestUpdatesAnime(MangaModel anime) async {
|
||||||
|
final res = await dataBase(anime.sourceId);
|
||||||
|
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
List list = json.decode(res);
|
||||||
|
List reversedList = list.reversed.toList();
|
||||||
|
List<MangaModel> animeList = animeResList(json.encode(reversedList));
|
||||||
|
|
||||||
|
return animeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
searchAnime(MangaModel anime) async {
|
||||||
|
final res = await dataBase(anime.sourceId);
|
||||||
|
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
List<MangaModel> animeList = animeSeachFetch(res, anime.query);
|
||||||
|
return animeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MangaModel> animeSeachFetch(String res, query) {
|
||||||
|
final statusList = [
|
||||||
|
{"EN COURS": 0, "TERMINÉ": 1}
|
||||||
|
];
|
||||||
|
List<MangaModel> animeList = [];
|
||||||
|
final jsonResList = json.decode(res);
|
||||||
|
for (var animeJson in jsonResList) {
|
||||||
|
MangaModel anime = MangaModel();
|
||||||
|
|
||||||
|
final titleO = MBridge.getMapValue(json.encode(animeJson), "titleO");
|
||||||
|
final titleAlt =
|
||||||
|
MBridge.getMapValue(json.encode(animeJson), "titles", encode: true);
|
||||||
|
final enContains = MBridge.getMapValue(titleAlt, "en")
|
||||||
|
.toString()
|
||||||
|
.toLowerCase()
|
||||||
|
.contains(query);
|
||||||
|
final enJpContains = MBridge.getMapValue(titleAlt, "en_jp")
|
||||||
|
.toString()
|
||||||
|
.toLowerCase()
|
||||||
|
.contains(query);
|
||||||
|
final jaJpContains = MBridge.getMapValue(titleAlt, "ja_jp")
|
||||||
|
.toString()
|
||||||
|
.toLowerCase()
|
||||||
|
.contains(query);
|
||||||
|
final titleOContains = titleO.toLowerCase().contains(query);
|
||||||
|
bool contains = false;
|
||||||
|
if (enContains) {
|
||||||
|
contains = true;
|
||||||
|
}
|
||||||
|
if (enJpContains) {
|
||||||
|
contains = true;
|
||||||
|
}
|
||||||
|
if (jaJpContains) {
|
||||||
|
contains = true;
|
||||||
|
}
|
||||||
|
if (titleOContains) {
|
||||||
|
contains = true;
|
||||||
|
}
|
||||||
|
if (contains) {
|
||||||
|
final seasons = animeJson["saisons"];
|
||||||
|
List hasVostfr = [];
|
||||||
|
List hasVf = [];
|
||||||
|
for (var season in seasons) {
|
||||||
|
for (var episode in season["episodes"]) {
|
||||||
|
final lang = episode["lang"];
|
||||||
|
final vo = lang["vo"];
|
||||||
|
final vf = lang["vf"];
|
||||||
|
hasVostfr.add(vo["lecteurs"].isNotEmpty);
|
||||||
|
hasVf.add(vf["lecteurs"].isNotEmpty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final titleO = animeJson["titleO"];
|
||||||
|
final title = animeJson["title"];
|
||||||
|
final genre = animeJson["themes"];
|
||||||
|
final description = animeJson["description"];
|
||||||
|
final status = MBridge.parseStatus(animeJson["status"], statusList);
|
||||||
|
final imageUrl = animeJson["affiche"];
|
||||||
|
|
||||||
|
if (hasVostfr.contains(true)) {
|
||||||
|
for (int i = 0; i < seasons.length; i++) {
|
||||||
|
int ind = i + 1;
|
||||||
|
anime.genre = genre;
|
||||||
|
anime.description = description;
|
||||||
|
String seasonTitle = title.isEmpty ? titleO : title;
|
||||||
|
if (seasons.length > 1) {
|
||||||
|
seasonTitle += " S$ind";
|
||||||
|
}
|
||||||
|
if (hasVostfr.contains(true)) {
|
||||||
|
seasonTitle += " VOSTFR";
|
||||||
|
}
|
||||||
|
anime.status = status;
|
||||||
|
anime.name = seasonTitle;
|
||||||
|
anime.imageUrl = imageUrl;
|
||||||
|
anime.link =
|
||||||
|
"/anime/${MBridge.regExp(titleO, "[^A-Za-z0-9 ]", "", 0, 0).replaceAll(" ", "-").toLowerCase()}?lang=vo&s=$ind";
|
||||||
|
ind++;
|
||||||
|
}
|
||||||
|
} else if (hasVf.contains(true)) {
|
||||||
|
for (int i = 0; i < seasons.length; i++) {
|
||||||
|
int ind = i + 1;
|
||||||
|
anime.genre = genre;
|
||||||
|
anime.description = description;
|
||||||
|
String seasonTitle = title.isEmpty ? titleO : title;
|
||||||
|
if (seasons.length > 1) {
|
||||||
|
seasonTitle += " S$ind";
|
||||||
|
}
|
||||||
|
if (hasVf.contains(true)) {
|
||||||
|
seasonTitle += " VF";
|
||||||
|
}
|
||||||
|
anime.status = status;
|
||||||
|
anime.name = seasonTitle;
|
||||||
|
anime.imageUrl = imageUrl;
|
||||||
|
anime.link =
|
||||||
|
"/anime/${MBridge.regExp(titleO, "[^A-Za-z0-9 ]", "", 0, 0).replaceAll(" ", "-").toLowerCase()}?lang=vo&s=$ind";
|
||||||
|
ind++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return animeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
getVideoList(MangaModel anime) async {
|
||||||
|
String language = "vo".toString();
|
||||||
|
String videoBaseUrl = "https://api.franime.fr/api/anime".toString();
|
||||||
|
if (anime.link.contains("lang=")) {
|
||||||
|
language = MBridge.substringBefore(
|
||||||
|
MBridge.substringAfter(anime.link, "lang="), "&");
|
||||||
|
print(language);
|
||||||
|
}
|
||||||
|
String stem =
|
||||||
|
MBridge.substringBefore(MBridge.substringAfterLast(anime.link, "/"), "?");
|
||||||
|
final res = await dataBase(anime.sourceId);
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
final animeByTitleOJson = databaseAnimeByTitleO(res, stem);
|
||||||
|
if (animeByTitleOJson.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
final animeId = json.decode(animeByTitleOJson)["id"];
|
||||||
|
final seasons = json.decode(animeByTitleOJson)["saisons"];
|
||||||
|
|
||||||
|
var seasonsJson = seasons.first;
|
||||||
|
|
||||||
|
videoBaseUrl += "/$animeId/";
|
||||||
|
|
||||||
|
if (anime.link.contains("s=")) {
|
||||||
|
int seasonNumber = MBridge.intParse(
|
||||||
|
MBridge.substringBefore(MBridge.substringAfter(anime.link, "s="), "&"));
|
||||||
|
print(seasonNumber);
|
||||||
|
videoBaseUrl += "${seasonNumber - 1}/";
|
||||||
|
seasonsJson = seasons[seasonNumber - 1];
|
||||||
|
} else {
|
||||||
|
videoBaseUrl += "0/";
|
||||||
|
}
|
||||||
|
final episodesJson = seasonsJson["episodes"];
|
||||||
|
var episode = episodesJson.first;
|
||||||
|
if (anime.link.contains("ep=")) {
|
||||||
|
int episodeNumber =
|
||||||
|
MBridge.intParse(MBridge.substringAfter(anime.link, "ep="));
|
||||||
|
print(episodeNumber);
|
||||||
|
episode = episodesJson[episodeNumber - 1];
|
||||||
|
videoBaseUrl += "${episodeNumber - 1}";
|
||||||
|
} else {
|
||||||
|
videoBaseUrl += "0";
|
||||||
|
}
|
||||||
|
final lang = episode["lang"];
|
||||||
|
|
||||||
|
final vo = lang["vo"];
|
||||||
|
final vf = lang["vf"];
|
||||||
|
bool hasVostfr = vo["lecteurs"].isNotEmpty;
|
||||||
|
bool hasVf = vf["lecteurs"].isNotEmpty;
|
||||||
|
final vostfrPlayers = vo["lecteurs"];
|
||||||
|
final vfPlayers = vf["lecteurs"];
|
||||||
|
var players = [];
|
||||||
|
if (language == "vo" && hasVostfr) {
|
||||||
|
players = vostfrPlayers;
|
||||||
|
} else if (language == "vf" && hasVf) {
|
||||||
|
players = vfPlayers;
|
||||||
|
}
|
||||||
|
List<VideoModel> videos = [];
|
||||||
|
for (int i = 0; i < players.length; i++) {
|
||||||
|
String apiUrl = "$videoBaseUrl/$language/$i";
|
||||||
|
String playerName = players[i];
|
||||||
|
final data = {
|
||||||
|
"url": apiUrl,
|
||||||
|
"headers": {"Referer": "https://franime.fr/"},
|
||||||
|
"sourceId": anime.sourceId
|
||||||
|
};
|
||||||
|
final playerUrl = await MBridge.http('GET', json.encode(data));
|
||||||
|
List<VideoModel> a = [];
|
||||||
|
if (playerName.contains("franime_myvi")) {
|
||||||
|
videos.add(
|
||||||
|
MBridge.toVideo(playerUrl, "FRAnime", playerUrl, null, null, null));
|
||||||
|
} else if (playerName.contains("myvi")) {
|
||||||
|
a = await MBridge.myTvExtractor(playerUrl);
|
||||||
|
} else if (playerName.contains("sendvid")) {
|
||||||
|
a = await MBridge.sendVidExtractor(
|
||||||
|
playerUrl, json.encode({"Referer": "https://franime.fr/"}), "");
|
||||||
|
} else if (playerName.contains("sibnet")) {
|
||||||
|
a = await MBridge.sibnetExtractor(playerUrl);
|
||||||
|
} else if (playerName.contains("sbfull")) {}
|
||||||
|
for (var vi in a) {
|
||||||
|
videos.add(vi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return videos;
|
||||||
|
}
|
||||||
@@ -3,26 +3,21 @@ import 'package:bridge_lib/bridge_lib.dart';
|
|||||||
|
|
||||||
getPopularAnime(MangaModel anime) async {
|
getPopularAnime(MangaModel anime) async {
|
||||||
final data = {
|
final data = {
|
||||||
"url": "${anime.baseUrl}/toute-la-liste-affiches/page/${anime.page}/?q=.",
|
"url": "${anime.baseUrl}/toute-la-liste-affiches/page/${anime.page}/?q=."
|
||||||
"headers": null,
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
};
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
if (res.isEmpty) {
|
if (res.isEmpty) {
|
||||||
return anime;
|
return anime;
|
||||||
}
|
}
|
||||||
|
|
||||||
anime.urls = MBridge.xpath(
|
anime.urls =
|
||||||
res, '//*[@class="list"]/article/div/div/figure/a/@href', '._.._.._')
|
MBridge.xpath(res, '//*[@class="list"]/article/div/div/figure/a/@href');
|
||||||
.split('._.._.._');
|
|
||||||
|
|
||||||
anime.names = MBridge.xpath(res,
|
anime.names = MBridge.xpath(
|
||||||
'//*[@class="list"]/article/div/div/figure/a/img/@title', '._.._.._')
|
res, '//*[@class="list"]/article/div/div/figure/a/img/@title');
|
||||||
.split('._.._.._');
|
anime.images = MBridge.xpath(
|
||||||
anime.images = MBridge.xpath(res,
|
res, '//*[@class="list"]/article/div/div/figure/a/img/@src');
|
||||||
'//*[@class="list"]/article/div/div/figure/a/img/@src', '._.._.._')
|
final nextPage = MBridge.xpath(res, '//a[@class="next page-link"]/@href');
|
||||||
.split('._.._.._');
|
|
||||||
final nextPage = MBridge.xpath(res, '//a[@class="next page-link"]/@href', '');
|
|
||||||
if (nextPage.isEmpty) {
|
if (nextPage.isEmpty) {
|
||||||
anime.hasNextPage = false;
|
anime.hasNextPage = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -32,24 +27,16 @@ getPopularAnime(MangaModel anime) async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getLatestUpdatesAnime(MangaModel anime) async {
|
getLatestUpdatesAnime(MangaModel anime) async {
|
||||||
final data = {
|
final data = {"url": "${anime.baseUrl}/page/${anime.page}/"};
|
||||||
"url": "${anime.baseUrl}/page/${anime.page}/",
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
"headers": null,
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
if (res.isEmpty) {
|
||||||
return anime;
|
return anime;
|
||||||
}
|
}
|
||||||
|
|
||||||
anime.urls =
|
anime.urls = MBridge.xpath(res, '//*[@class="episode"]/div/a/@href');
|
||||||
MBridge.xpath(res, '//*[@class="episode"]/div/a/@href', '._.._.._')
|
final namess = MBridge.xpath(res, '//*[@class="episode"]/div/a/text()');
|
||||||
.split('._.._.._');
|
|
||||||
List<String> namess =
|
|
||||||
MBridge.xpath(res, '//*[@class="episode"]/div/a/text()', '._.._.._')
|
|
||||||
.split('._.._.._');
|
|
||||||
List<String> names = [];
|
List<String> names = [];
|
||||||
for (var name in MBridge.listParse(namess, 0)) {
|
for (var name in namess) {
|
||||||
names.add(MBridge.regExp(
|
names.add(MBridge.regExp(
|
||||||
name,
|
name,
|
||||||
r'(?<=\bS\d\s*|)\d{2}\s*(?=\b(Vostfr|vostfr|VF|Vf|vf|\(VF\)|\(vf\)|\(Vf\)|\(Vostfr\)\b))?',
|
r'(?<=\bS\d\s*|)\d{2}\s*(?=\b(Vostfr|vostfr|VF|Vf|vf|\(VF\)|\(vf\)|\(Vf\)|\(Vostfr\)\b))?',
|
||||||
@@ -68,12 +55,9 @@ getLatestUpdatesAnime(MangaModel anime) async {
|
|||||||
.replaceAll(' (Vostfr)', ''));
|
.replaceAll(' (Vostfr)', ''));
|
||||||
}
|
}
|
||||||
anime.names = names;
|
anime.names = names;
|
||||||
anime.images = MBridge.xpath(
|
anime.images =
|
||||||
res,
|
MBridge.xpath(res, '//*[@class="episode"]/div/figure/a/img/@src');
|
||||||
'//*[@class="episode"]/div/figure/a/img/@src',
|
final nextPage = MBridge.xpath(res, '//a[@class="next page-link"]/@href');
|
||||||
'._.._.._.._.._.._.._.._.._')
|
|
||||||
.split('._.._.._.._.._.._.._.._.._');
|
|
||||||
final nextPage = MBridge.xpath(res, '//a[@class="next page-link"]/@href', '');
|
|
||||||
if (nextPage.isEmpty) {
|
if (nextPage.isEmpty) {
|
||||||
anime.hasNextPage = false;
|
anime.hasNextPage = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -90,83 +74,72 @@ getAnimeDetail(MangaModel anime) async {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
final url = anime.link;
|
final url = anime.link;
|
||||||
final data = {"url": url, "headers": null};
|
final data = {"url": url};
|
||||||
String res = await MBridge.http(json.encode(data), 0);
|
String res = await MBridge.http('GET', json.encode(data));
|
||||||
if (res.isEmpty) {
|
if (res.isEmpty) {
|
||||||
return anime;
|
return anime;
|
||||||
}
|
}
|
||||||
|
|
||||||
final originalUrl = MBridge.xpath(res,
|
final originalUrl = MBridge.xpath(res,
|
||||||
'//*[@class="breadcrumb"]/li[@class="breadcrumb-item"][2]/a/@href', '');
|
'//*[@class="breadcrumb"]/li[@class="breadcrumb-item"][2]/a/@href')
|
||||||
if (originalUrl.isEmpty) {
|
.first;
|
||||||
} else {
|
if (originalUrl.isNotEmpty) {
|
||||||
final newData = {"url": originalUrl, "headers": null};
|
final newData = {"url": originalUrl};
|
||||||
res = await MBridge.http(json.encode(newData), 0);
|
res = await MBridge.http('GET', json.encode(newData));
|
||||||
if (res.isEmpty) {
|
if (res.isEmpty) {
|
||||||
return anime;
|
return anime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
anime.description =
|
anime.description =
|
||||||
MBridge.xpath(res, '//*[@class="episode fz-sm synop"]/p/text()', '')
|
MBridge.xpath(res, '//*[@class="episode fz-sm synop"]/p/text()')
|
||||||
|
.first
|
||||||
.replaceAll("Synopsis:", "");
|
.replaceAll("Synopsis:", "");
|
||||||
final status = MBridge.xpath(
|
final status = MBridge.xpath(res,
|
||||||
res,
|
'//*[@class="list-unstyled"]/li[contains(text(),"Statut")]/text()')
|
||||||
'//*[@class="list-unstyled"]/li[contains(text(),"Statut")]/text()',
|
.first
|
||||||
'')
|
|
||||||
.replaceAll("Statut: ", "");
|
.replaceAll("Statut: ", "");
|
||||||
anime.status = MBridge.parseStatus(status, statusList);
|
anime.status = MBridge.parseStatus(status, statusList);
|
||||||
anime.genre = MBridge.xpath(
|
anime.genre = MBridge.xpath(res,
|
||||||
res,
|
'//*[@class="list-unstyled"]/li[contains(text(),"Genre")]/ul/li/a/text()');
|
||||||
'//*[@class="list-unstyled"]/li[contains(text(),"Genre")]/ul/li/a/text()',
|
|
||||||
'._.._.._')
|
|
||||||
.split('._.._.._');
|
|
||||||
|
|
||||||
anime.urls = MBridge.xpath(
|
anime.urls =
|
||||||
res, '//*[@class="list-episodes list-group"]/a/@href', '._.._.._')
|
MBridge.xpath(res, '//*[@class="list-episodes list-group"]/a/@href');
|
||||||
.split("._.._.._");
|
final dates = MBridge.xpath(
|
||||||
List<String> dates = MBridge.xpath(res,
|
res, '//*[@class="list-episodes list-group"]/a/span/text()');
|
||||||
'//*[@class="list-episodes list-group"]/a/span/text()', '._.._.._')
|
final names =
|
||||||
.split("._.._.._");
|
MBridge.xpath(res, '//*[@class="list-episodes list-group"]/a/text()');
|
||||||
List<String> names = MBridge.xpath(
|
|
||||||
res, '//*[@class="list-episodes list-group"]/a/text()', '._.._.._')
|
|
||||||
.split("._.._.._");
|
|
||||||
|
|
||||||
List<String> episodes = [];
|
List<String> episodes = [];
|
||||||
for (var i = 0; i < names.length; i++) {
|
for (var i = 0; i < names.length; i++) {
|
||||||
final date = MBridge.listParse(dates, 0)[i];
|
final date = dates[i];
|
||||||
final name = MBridge.listParse(names, 0)[i];
|
final name = names[i];
|
||||||
episodes.add(
|
episodes.add(
|
||||||
"Episode ${MBridge.regExp(name.replaceAll(date, ""), r".* (\d*) [VvfF]{1,1}", '', 1, 1)}");
|
"Episode ${MBridge.regExp(name.replaceAll(date, ""), r".* (\d*) [VvfF]{1,1}", '', 1, 1)}");
|
||||||
}
|
}
|
||||||
anime.names = episodes;
|
anime.names = episodes;
|
||||||
anime.chaptersDateUploads = MBridge.listParse(
|
anime.chaptersDateUploads =
|
||||||
MBridge.listParseDateTime(dates, "dd MMMM yyyy", "fr"), 0);
|
MBridge.listParseDateTime(dates, "dd MMMM yyyy", "fr");
|
||||||
return anime;
|
return anime;
|
||||||
}
|
}
|
||||||
|
|
||||||
searchAnime(MangaModel anime) async {
|
searchAnime(MangaModel anime) async {
|
||||||
final data = {
|
final data = {
|
||||||
"url":
|
"url":
|
||||||
"${anime.baseUrl}/toute-la-liste-affiches/page/${anime.page}/?q=${anime.query}",
|
"${anime.baseUrl}/toute-la-liste-affiches/page/${anime.page}/?q=${anime.query}"
|
||||||
"headers": null,
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
};
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
if (res.isEmpty) {
|
if (res.isEmpty) {
|
||||||
return anime;
|
return anime;
|
||||||
}
|
}
|
||||||
|
|
||||||
anime.urls = MBridge.xpath(
|
anime.urls =
|
||||||
res, '//*[@class="list"]/article/div/div/figure/a/@href', '._.._.._')
|
MBridge.xpath(res, '//*[@class="list"]/article/div/div/figure/a/@href');
|
||||||
.split('._.._.._');
|
|
||||||
|
|
||||||
anime.names = MBridge.xpath(res,
|
anime.names = MBridge.xpath(
|
||||||
'//*[@class="list"]/article/div/div/figure/a/img/@title', '._.._.._')
|
res, '//*[@class="list"]/article/div/div/figure/a/img/@title');
|
||||||
.split('._.._.._');
|
anime.images = MBridge.xpath(
|
||||||
anime.images = MBridge.xpath(res,
|
res, '//*[@class="list"]/article/div/div/figure/a/img/@src');
|
||||||
'//*[@class="list"]/article/div/div/figure/a/img/@src', '._.._.._')
|
final nextPage = MBridge.xpath(res, '//a[@class="next page-link"]/@href');
|
||||||
.split('._.._.._');
|
|
||||||
final nextPage = MBridge.xpath(res, '//a[@class="next page-link"]/@href', '');
|
|
||||||
if (nextPage.isEmpty) {
|
if (nextPage.isEmpty) {
|
||||||
anime.hasNextPage = false;
|
anime.hasNextPage = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -176,29 +149,23 @@ searchAnime(MangaModel anime) async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getVideoList(MangaModel anime) async {
|
getVideoList(MangaModel anime) async {
|
||||||
final datas = {
|
final datas = {"url": anime.link};
|
||||||
"url": anime.link,
|
|
||||||
"headers": null,
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
|
|
||||||
final res = await MBridge.http(json.encode(datas), 0);
|
final res = await MBridge.http('GET', json.encode(datas));
|
||||||
|
|
||||||
if (res.isEmpty) {
|
if (res.isEmpty) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
final servers =
|
final servers =
|
||||||
MBridge.xpath(res, '//*[@id="nav-tabContent"]/div/iframe/@src', ".-")
|
MBridge.xpath(res, '//*[@id="nav-tabContent"]/div/iframe/@src');
|
||||||
.split(".-");
|
|
||||||
List<VideoModel> videos = [];
|
List<VideoModel> videos = [];
|
||||||
for (var url in MBridge.listParse(servers, 0)) {
|
for (var url in servers) {
|
||||||
final datasServer = {
|
final datasServer = {
|
||||||
"url": fixUrl(url),
|
"url": fixUrl(url),
|
||||||
"headers": {"X-Requested-With": "XMLHttpRequest"},
|
"headers": {"X-Requested-With": "XMLHttpRequest"}
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
};
|
||||||
|
|
||||||
final resServer = await MBridge.http(json.encode(datasServer), 0);
|
final resServer = await MBridge.http('GET', json.encode(datasServer));
|
||||||
final serverUrl =
|
final serverUrl =
|
||||||
fixUrl(MBridge.regExp(resServer, r"data-url='([^']+)'", '', 1, 1));
|
fixUrl(MBridge.regExp(resServer, r"data-url='([^']+)'", '', 1, 1));
|
||||||
List<VideoModel> a = [];
|
List<VideoModel> a = [];
|
||||||
@@ -7,7 +7,7 @@ const universanimeSourceCodeUrl =
|
|||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/fr/universanime/universanime-v$universanimeVersion.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/fr/universanime/universanime-v$universanimeVersion.dart";
|
||||||
Source _universanimeSource = Source(
|
Source _universanimeSource = Source(
|
||||||
name: "UniversAnime",
|
name: "UniversAnime",
|
||||||
baseUrl: "https://www.universanime.co",
|
baseUrl: "https://www.universanime.club",
|
||||||
lang: "fr",
|
lang: "fr",
|
||||||
typeSource: "single",
|
typeSource: "single",
|
||||||
iconUrl: getIconUrl("universanime", "fr"),
|
iconUrl: getIconUrl("universanime", "fr"),
|
||||||
|
|||||||
@@ -1,163 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
getVideoList(MangaModel anime) async {
|
|
||||||
final datas = {
|
|
||||||
"url": anime.link,
|
|
||||||
"headers": null,
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
|
|
||||||
final res = await MBridge.http(json.encode(datas), 0);
|
|
||||||
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
final serverUrls = MBridge.xpath(
|
|
||||||
res, '//*[@class="entry-content"]/div/div/iframe/@src', '._')
|
|
||||||
.split("._");
|
|
||||||
List<VideoModel> videos = [];
|
|
||||||
for (var i = 0; i < serverUrls.length; i++) {
|
|
||||||
final url = MBridge.listParse(serverUrls, 0)[i].toString();
|
|
||||||
print(url);
|
|
||||||
List<VideoModel> a = [];
|
|
||||||
if (url.startsWith("https://filemoon.")) {
|
|
||||||
a = await MBridge.filemoonExtractor(url, "");
|
|
||||||
} else if (url.startsWith("https://doodstream.")) {
|
|
||||||
a = await MBridge.doodExtractor(url);
|
|
||||||
} else if (url.startsWith("https://streamtape.")) {
|
|
||||||
a = await MBridge.streamTapeExtractor(url);
|
|
||||||
} else if (url.contains("streamsb")) {}
|
|
||||||
for (var vi in a) {
|
|
||||||
videos.add(vi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return videos;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<MangaModel> getLatestUpdatesAnime(MangaModel anime) async {
|
|
||||||
final data = {
|
|
||||||
"url": "${anime.baseUrl}/page/${anime.page}/",
|
|
||||||
"headers": null,
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
anime.urls = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="recent-posts"]/li/div[@class="post-thumb"]/a/@href',
|
|
||||||
'._')
|
|
||||||
.split('._');
|
|
||||||
anime.names = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="recent-posts"]/li/div[@class="post-thumb"]/a/@title',
|
|
||||||
'._')
|
|
||||||
.split('._');
|
|
||||||
anime.images = [];
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getAnimeDetail(MangaModel anime) async {
|
|
||||||
final url = anime.link;
|
|
||||||
final data = {"url": url, "headers": null};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
anime.description = MBridge.xpath(res,
|
|
||||||
'//*[@class="entry-content"]/p[contains(text(),"Synopsis")]/text()', '');
|
|
||||||
|
|
||||||
anime.status = 5;
|
|
||||||
|
|
||||||
final urls = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="entry-content"]/ul[@class="lcp_catlist" and contains(@id,"lcp_instance_")]/li/a/@href',
|
|
||||||
'._');
|
|
||||||
final names = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="entry-content"]/ul[@class="lcp_catlist" and contains(@id,"lcp_instance_")]/li/a/text()',
|
|
||||||
'._');
|
|
||||||
if (urls.isEmpty && names.isEmpty) {
|
|
||||||
anime.urls = [anime.link];
|
|
||||||
anime.names = ["Film"];
|
|
||||||
} else {
|
|
||||||
anime.urls = urls.split('._');
|
|
||||||
anime.names = names.split('._');
|
|
||||||
}
|
|
||||||
|
|
||||||
anime.chaptersDateUploads = [];
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getPopularAnime(MangaModel anime) async {
|
|
||||||
return await getLatestUpdatesAnime(anime);
|
|
||||||
}
|
|
||||||
|
|
||||||
searchAnime(MangaModel anime) async {
|
|
||||||
final data = {
|
|
||||||
"url": "${anime.baseUrl}/liste-des-animes-2/",
|
|
||||||
"headers": null,
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
final dataMovies = {
|
|
||||||
"url": "${anime.baseUrl}/films-mangas/",
|
|
||||||
"headers": null,
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
final resMovies = await MBridge.http(json.encode(dataMovies), 0);
|
|
||||||
List<String> urlsS = [];
|
|
||||||
List<String> namesS = [];
|
|
||||||
List<String> urls = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="lcp_catlist" and contains(@id,"lcp_instance_")]/li/a/@href',
|
|
||||||
'._')
|
|
||||||
.split('._');
|
|
||||||
|
|
||||||
List<String> names = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="lcp_catlist" and contains(@id,"lcp_instance_")]/li/a/text()',
|
|
||||||
'._')
|
|
||||||
.split('._');
|
|
||||||
List<String> urlsMovies = MBridge.xpath(
|
|
||||||
resMovies,
|
|
||||||
'//*[@class="recent-posts"]/li/div[@class="post-thumb"]/a/@href',
|
|
||||||
'._')
|
|
||||||
.split('._');
|
|
||||||
|
|
||||||
List<String> namesMovies = MBridge.xpath(
|
|
||||||
resMovies,
|
|
||||||
'//*[@class="recent-posts"]/li/div[@class="post-thumb"]/a/@title',
|
|
||||||
'._')
|
|
||||||
.split('._');
|
|
||||||
for (var i = 0; i < names.length; i++) {
|
|
||||||
String name = MBridge.listParse(names, 0)[i];
|
|
||||||
if (name.toLowerCase().contains(anime.query)) {
|
|
||||||
String url = MBridge.listParse(urls, 0)[i];
|
|
||||||
urlsS.add(url);
|
|
||||||
namesS.add(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (var i = 0; i < namesMovies.length; i++) {
|
|
||||||
String name = MBridge.listParse(namesMovies, 0)[i];
|
|
||||||
if (name.toLowerCase().contains(anime.query)) {
|
|
||||||
String url = MBridge.listParse(urlsMovies, 0)[i];
|
|
||||||
urlsS.add(url);
|
|
||||||
namesS.add(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
anime.urls = urlsS;
|
|
||||||
|
|
||||||
anime.names = namesS;
|
|
||||||
anime.images = [];
|
|
||||||
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
125
anime/src/fr/universanime/universanime-v0.0.2.dart
Normal file
125
anime/src/fr/universanime/universanime-v0.0.2.dart
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'package:bridge_lib/bridge_lib.dart';
|
||||||
|
|
||||||
|
getVideoList(MangaModel anime) async {
|
||||||
|
final datas = {"url": anime.link};
|
||||||
|
|
||||||
|
final res = await MBridge.http('GET', json.encode(datas));
|
||||||
|
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
final serverUrls =
|
||||||
|
MBridge.xpath(res, '//*[@class="entry-content"]/div/div/iframe/@src');
|
||||||
|
List<VideoModel> videos = [];
|
||||||
|
for (var i = 0; i < serverUrls.length; i++) {
|
||||||
|
final url = serverUrls[i];
|
||||||
|
print(url);
|
||||||
|
List<VideoModel> a = [];
|
||||||
|
if (url.startsWith("https://filemoon.")) {
|
||||||
|
a = await MBridge.filemoonExtractor(url, "");
|
||||||
|
} else if (url.startsWith("https://doodstream.")) {
|
||||||
|
a = await MBridge.doodExtractor(url);
|
||||||
|
} else if (url.startsWith("https://streamtape.")) {
|
||||||
|
a = await MBridge.streamTapeExtractor(url);
|
||||||
|
} else if (url.contains("streamsb")) {}
|
||||||
|
for (var vi in a) {
|
||||||
|
videos.add(vi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return videos;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<MangaModel> getLatestUpdatesAnime(MangaModel anime) async {
|
||||||
|
final data = {"url": "${anime.baseUrl}/page/${anime.page}/"};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
anime.urls = MBridge.xpath(
|
||||||
|
res, '//*[@class="recent-posts"]/li/div[@class="post-thumb"]/a/@href');
|
||||||
|
anime.names = MBridge.xpath(
|
||||||
|
res, '//*[@class="recent-posts"]/li/div[@class="post-thumb"]/a/@title');
|
||||||
|
anime.images = [];
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
getAnimeDetail(MangaModel anime) async {
|
||||||
|
final url = anime.link;
|
||||||
|
final data = {"url": url};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
anime.description = MBridge.xpath(res,
|
||||||
|
'//*[@class="entry-content"]/p[contains(text(),"Synopsis")]/text()')
|
||||||
|
.first;
|
||||||
|
|
||||||
|
anime.status = 5;
|
||||||
|
|
||||||
|
final urls = MBridge.xpath(res,
|
||||||
|
'//*[@class="entry-content"]/ul[@class="lcp_catlist" and contains(@id,"lcp_instance_")]/li/a/@href');
|
||||||
|
final names = MBridge.xpath(res,
|
||||||
|
'//*[@class="entry-content"]/ul[@class="lcp_catlist" and contains(@id,"lcp_instance_")]/li/a/text()');
|
||||||
|
if (urls.isEmpty && names.isEmpty) {
|
||||||
|
anime.urls = [anime.link];
|
||||||
|
anime.names = ["Film"];
|
||||||
|
} else {
|
||||||
|
anime.urls = urls;
|
||||||
|
anime.names = names;
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.chaptersDateUploads = [];
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
getPopularAnime(MangaModel anime) async {
|
||||||
|
return await getLatestUpdatesAnime(anime);
|
||||||
|
}
|
||||||
|
|
||||||
|
searchAnime(MangaModel anime) async {
|
||||||
|
final data = {"url": "${anime.baseUrl}/liste-des-animes-2/"};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
final dataMovies = {"url": "${anime.baseUrl}/films-mangas/"};
|
||||||
|
final resMovies = await MBridge.http('GET', json.encode(dataMovies));
|
||||||
|
List<String> urlsS = [];
|
||||||
|
List<String> namesS = [];
|
||||||
|
final urls = MBridge.xpath(res,
|
||||||
|
'//*[@class="lcp_catlist" and contains(@id,"lcp_instance_")]/li/a/@href');
|
||||||
|
|
||||||
|
final names = MBridge.xpath(res,
|
||||||
|
'//*[@class="lcp_catlist" and contains(@id,"lcp_instance_")]/li/a/text()');
|
||||||
|
final urlsMovies = MBridge.xpath(resMovies,
|
||||||
|
'//*[@class="recent-posts"]/li/div[@class="post-thumb"]/a/@href');
|
||||||
|
|
||||||
|
final namesMovies = MBridge.xpath(resMovies,
|
||||||
|
'//*[@class="recent-posts"]/li/div[@class="post-thumb"]/a/@title');
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
final name = names[i];
|
||||||
|
if (name.toLowerCase().contains(anime.query)) {
|
||||||
|
final url = urls[i];
|
||||||
|
urlsS.add(url);
|
||||||
|
namesS.add(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (var i = 0; i < namesMovies.length; i++) {
|
||||||
|
final name = namesMovies[i];
|
||||||
|
if (name.toLowerCase().contains(anime.query)) {
|
||||||
|
final url = urlsMovies[i];
|
||||||
|
urlsS.add(url);
|
||||||
|
namesS.add(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
anime.urls = urlsS;
|
||||||
|
|
||||||
|
anime.names = namesS;
|
||||||
|
anime.images = [];
|
||||||
|
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,203 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
searchManga(MangaModel manga) async {
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
final url = "${manga.apiUrl}/series/search";
|
|
||||||
final body = {"term": manga.query};
|
|
||||||
final data = {"url": url, "headers": headers, "body": body};
|
|
||||||
final res = await MBridge.http(json.encode(data), 1);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
List<String> jsonList = [];
|
|
||||||
List<String> names = [];
|
|
||||||
List<String> urls = [];
|
|
||||||
List<String> images = [];
|
|
||||||
if (res.startsWith("{")) {
|
|
||||||
jsonList = MBridge.jsonPathToList(res, r'$.data[*]', 0);
|
|
||||||
} else {
|
|
||||||
jsonList = MBridge.jsonDecodeToList(res,0);
|
|
||||||
}
|
|
||||||
for (var a in jsonList) {
|
|
||||||
final thumbnail = MBridge.getMapValue(a, "thumbnail", 0);
|
|
||||||
if (thumbnail.startsWith("https://")) {
|
|
||||||
images.add(thumbnail);
|
|
||||||
} else {
|
|
||||||
images.add("${manga.apiUrl}/cover/$thumbnail");
|
|
||||||
}
|
|
||||||
names.add(MBridge.getMapValue(a, "title", 0));
|
|
||||||
final seriesSlug = MBridge.regExp(
|
|
||||||
MBridge.getMapValue(a, "series_slug", 0), "-\\d+", "", 0, 0);
|
|
||||||
urls.add("/series/$seriesSlug");
|
|
||||||
}
|
|
||||||
manga.urls = urls;
|
|
||||||
manga.images = images;
|
|
||||||
manga.names = names;
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getPopularManga(MangaModel manga) async {
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
final url = "${manga.apiUrl}/series/querysearch";
|
|
||||||
final body = {
|
|
||||||
"page": manga.page,
|
|
||||||
"order": "desc",
|
|
||||||
"order_by": "total_views",
|
|
||||||
"series_status": "Ongoing",
|
|
||||||
"series_type": "Comic"
|
|
||||||
};
|
|
||||||
final data = {
|
|
||||||
"url": url,
|
|
||||||
"headers": headers,
|
|
||||||
"sourceId": manga.sourceId,
|
|
||||||
"body": body
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(data), 1);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
List<String> jsonList = [];
|
|
||||||
List<String> names = [];
|
|
||||||
List<String> urls = [];
|
|
||||||
List<String> images = [];
|
|
||||||
if (res.startsWith("{")) {
|
|
||||||
jsonList = MBridge.jsonPathToList(res, r'$.data[*]', 0);
|
|
||||||
} else {
|
|
||||||
jsonList = MBridge.jsonDecodeToList(res,0);
|
|
||||||
}
|
|
||||||
for (var a in jsonList) {
|
|
||||||
final thumbnail = MBridge.getMapValue(a, "thumbnail", 0);
|
|
||||||
if (thumbnail.startsWith("https://")) {
|
|
||||||
images.add(thumbnail);
|
|
||||||
} else {
|
|
||||||
images.add("${manga.apiUrl}/cover/$thumbnail");
|
|
||||||
}
|
|
||||||
names.add(MBridge.getMapValue(a, "title", 0));
|
|
||||||
final seriesSlug = MBridge.regExp(
|
|
||||||
MBridge.getMapValue(a, "series_slug", 0), "-\\d+", "", 0, 0);
|
|
||||||
urls.add("/series/$seriesSlug");
|
|
||||||
}
|
|
||||||
manga.urls = urls;
|
|
||||||
manga.images = images;
|
|
||||||
manga.names = names;
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesManga(MangaModel manga) async {
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
final url = "${manga.apiUrl}/series/querysearch";
|
|
||||||
final body = {
|
|
||||||
"page": manga.page,
|
|
||||||
"order": "desc",
|
|
||||||
"order_by": "latest",
|
|
||||||
"series_status": "Ongoing",
|
|
||||||
"series_type": "Comic"
|
|
||||||
};
|
|
||||||
final data = {
|
|
||||||
"url": url,
|
|
||||||
"headers": headers,
|
|
||||||
"sourceId": manga.sourceId,
|
|
||||||
"body": body
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(data), 1);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
List<String> jsonList = [];
|
|
||||||
List<String> names = [];
|
|
||||||
List<String> urls = [];
|
|
||||||
List<String> images = [];
|
|
||||||
if (res.startsWith("{")) {
|
|
||||||
jsonList = MBridge.jsonPathToList(res, r'$.data[*]', 0);
|
|
||||||
} else {
|
|
||||||
jsonList = MBridge.jsonDecodeToList(res,0);
|
|
||||||
}
|
|
||||||
for (var a in jsonList) {
|
|
||||||
final thumbnail = MBridge.getMapValue(a, "thumbnail", 0);
|
|
||||||
if (thumbnail.startsWith("https://")) {
|
|
||||||
images.add(thumbnail);
|
|
||||||
} else {
|
|
||||||
images.add("${manga.apiUrl}/cover/$thumbnail");
|
|
||||||
}
|
|
||||||
names.add(MBridge.getMapValue(a, "title", 0));
|
|
||||||
final seriesSlug = MBridge.regExp(
|
|
||||||
MBridge.getMapValue(a, "series_slug", 0), "-\\d+", "", 0, 0);
|
|
||||||
urls.add("/series/$seriesSlug");
|
|
||||||
}
|
|
||||||
manga.urls = urls;
|
|
||||||
manga.images = images;
|
|
||||||
manga.names = names;
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getMangaDetail(MangaModel manga) async {
|
|
||||||
String currentSlug = MBridge.listParse(manga.link.split('/'), 2)[0];
|
|
||||||
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
final url = "${manga.apiUrl}/series/$currentSlug";
|
|
||||||
final data = {"url": url, "headers": headers};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
manga.author = MBridge.getMapValue(res, "author", 0);
|
|
||||||
|
|
||||||
manga.description = MBridge.getMapValue(res, "description", 0);
|
|
||||||
manga.genre =
|
|
||||||
MBridge.jsonPathToString(res, r"$.tags[*].name", "._").split("._");
|
|
||||||
|
|
||||||
final chapters = MBridge.jsonPathToList(res, r"$.chapters[*]", 0);
|
|
||||||
List<String> chapterTitles = [];
|
|
||||||
List<String> chapterUrls = [];
|
|
||||||
List<String> chapterDates = [];
|
|
||||||
for (var chapter in chapters) {
|
|
||||||
final chapterName = MBridge.getMapValue(chapter, "chapter_name", 0);
|
|
||||||
final chapterSlug = MBridge.getMapValue(chapter, "chapter_slug", 0);
|
|
||||||
final chapterId = MBridge.getMapValue(chapter, "id", 0);
|
|
||||||
final createdAt = MBridge.getMapValue(chapter, "created_at", 0);
|
|
||||||
chapterUrls.add("/series/$currentSlug/$chapterSlug#$chapterId");
|
|
||||||
chapterTitles.add(chapterName);
|
|
||||||
chapterDates.add(createdAt);
|
|
||||||
}
|
|
||||||
manga.urls = MBridge.listParse(chapterUrls,5);
|
|
||||||
manga.names = MBridge.listParse(chapterTitles,5);
|
|
||||||
manga.chaptersDateUploads = MBridge.listParse(
|
|
||||||
MBridge.listParseDateTime(
|
|
||||||
chapterDates, manga.dateFormat, manga.dateFormatLocale),
|
|
||||||
5);
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getChapterUrl(MangaModel manga) async {
|
|
||||||
String chapterId = MBridge.listParse(manga.link.split('#'), 2)[0];
|
|
||||||
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
final url = "${manga.apiUrl}/series/chapter/$chapterId";
|
|
||||||
final data = {"url": url, "headers": headers};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
final pages = MBridge.jsonPathToList(res, r"$.content.images[*]", 0);
|
|
||||||
List<String> pageUrls = [];
|
|
||||||
for (var u in pages) {
|
|
||||||
final url = u.replaceAll('"', "");
|
|
||||||
if (url.startsWith("http")) {
|
|
||||||
pageUrls.add(url);
|
|
||||||
} else {
|
|
||||||
pageUrls.add("${manga.apiUrl}/$url");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return pageUrls;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, String> getHeader(String url) {
|
|
||||||
final headers = {
|
|
||||||
'Origin': url,
|
|
||||||
'Referer': '$url/',
|
|
||||||
'Accept': 'application/json, text/plain, */*',
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
};
|
|
||||||
return headers;
|
|
||||||
}
|
|
||||||
276
manga/multisrc/heancms/heancms-v0.0.2.dart
Normal file
276
manga/multisrc/heancms/heancms-v0.0.2.dart
Normal file
@@ -0,0 +1,276 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'package:bridge_lib/bridge_lib.dart';
|
||||||
|
|
||||||
|
searchManga(MangaModel manga) async {
|
||||||
|
final headers = getHeader(manga.baseUrl);
|
||||||
|
|
||||||
|
String res = "".toString();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final newEndpointUrl = "${manga.apiUrl}/query";
|
||||||
|
final newEndpointBody = {
|
||||||
|
"query_string": manga.query,
|
||||||
|
"series_status": "All",
|
||||||
|
"page": manga.page,
|
||||||
|
"order": "desc",
|
||||||
|
"order_by": "total_views",
|
||||||
|
"perPage": "12",
|
||||||
|
"tags_ids": "[]",
|
||||||
|
"series_type": "Comic"
|
||||||
|
};
|
||||||
|
final newEndpointData = {
|
||||||
|
"url": newEndpointUrl,
|
||||||
|
"headers": headers,
|
||||||
|
"newEndpointBody": newEndpointBody
|
||||||
|
};
|
||||||
|
res = await MBridge.http('GET', json.encode(newEndpointData));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mangaModelRes(res, manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
getPopularManga(MangaModel manga) async {
|
||||||
|
final headers = getHeader(manga.baseUrl);
|
||||||
|
String res = "".toString();
|
||||||
|
if (!useNewQueryEndpoint(manga.source)) {
|
||||||
|
final url = "${manga.apiUrl}/series/querysearch";
|
||||||
|
print(url);
|
||||||
|
|
||||||
|
final body = {
|
||||||
|
"page": manga.page,
|
||||||
|
"order": "desc",
|
||||||
|
"order_by": "total_views",
|
||||||
|
"series_status": "Ongoing",
|
||||||
|
"series_type": "Comic"
|
||||||
|
};
|
||||||
|
final data = {
|
||||||
|
"url": url,
|
||||||
|
"headers": headers,
|
||||||
|
"sourceId": manga.sourceId,
|
||||||
|
"body": body
|
||||||
|
};
|
||||||
|
res = await MBridge.http('POST', json.encode(data));
|
||||||
|
} else {
|
||||||
|
final newEndpointUrl = "${manga.apiUrl}/query";
|
||||||
|
final newEndpointBody = {
|
||||||
|
"query_string": "",
|
||||||
|
"series_status": "All",
|
||||||
|
"page": manga.page,
|
||||||
|
"order": "desc",
|
||||||
|
"order_by": "total_views",
|
||||||
|
"perPage": "12",
|
||||||
|
"tags_ids": "[]",
|
||||||
|
"series_type": "Comic"
|
||||||
|
};
|
||||||
|
final newEndpointData = {
|
||||||
|
"url": newEndpointUrl,
|
||||||
|
"headers": headers,
|
||||||
|
"sourceId": manga.sourceId,
|
||||||
|
"body": newEndpointBody
|
||||||
|
};
|
||||||
|
print("sssssssssssssssssssss");
|
||||||
|
res = await MBridge.http('GET', json.encode(newEndpointData));
|
||||||
|
print(res);
|
||||||
|
}
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
return mangaModelRes(res, manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
getLatestUpdatesManga(MangaModel manga) async {
|
||||||
|
final headers = getHeader(manga.baseUrl);
|
||||||
|
String res = "".toString();
|
||||||
|
if (!useNewQueryEndpoint(manga.source)) {
|
||||||
|
final url = "${manga.apiUrl}/series/querysearch";
|
||||||
|
final body = {
|
||||||
|
"page": manga.page,
|
||||||
|
"order": "desc",
|
||||||
|
"order_by": "latest",
|
||||||
|
"series_status": "Ongoing",
|
||||||
|
"series_type": "Comic"
|
||||||
|
};
|
||||||
|
final data = {
|
||||||
|
"url": url,
|
||||||
|
"headers": headers,
|
||||||
|
"sourceId": manga.sourceId,
|
||||||
|
"body": body
|
||||||
|
};
|
||||||
|
res = await MBridge.http('POST', json.encode(data));
|
||||||
|
} else {
|
||||||
|
final newEndpointUrl = "${manga.apiUrl}/query";
|
||||||
|
final newEndpointBody = {
|
||||||
|
"query_string": "",
|
||||||
|
"series_status": "All",
|
||||||
|
"page": manga.page,
|
||||||
|
"order": "desc",
|
||||||
|
"order_by": "latest",
|
||||||
|
"perPage": "12",
|
||||||
|
"tags_ids": "[]",
|
||||||
|
"series_type": "Comic"
|
||||||
|
};
|
||||||
|
final newEndpointData = {
|
||||||
|
"url": newEndpointUrl,
|
||||||
|
"headers": headers,
|
||||||
|
"sourceId": manga.sourceId,
|
||||||
|
"body": newEndpointBody
|
||||||
|
};
|
||||||
|
res = await MBridge.http('GET', json.encode(newEndpointData));
|
||||||
|
print(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
return mangaModelRes(res, manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
getMangaDetail(MangaModel manga) async {
|
||||||
|
String currentSlug = manga.link.split('/').last;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
manga.author = MBridge.getMapValue(res, "author");
|
||||||
|
|
||||||
|
manga.description = MBridge.getMapValue(res, "description");
|
||||||
|
manga.genre =
|
||||||
|
MBridge.jsonPathToString(res, r"$.tags[*].name", "._").split("._");
|
||||||
|
|
||||||
|
var chapters = [];
|
||||||
|
if (!useNewQueryEndpoint(manga.source)) {
|
||||||
|
chapters = json.decode(res)["chapters"];
|
||||||
|
} else {
|
||||||
|
final seasons = json.decode(res)["seasons"].first;
|
||||||
|
chapters = seasons["chapters"];
|
||||||
|
}
|
||||||
|
List<String> chapterTitles = [];
|
||||||
|
List<String> chapterUrls = [];
|
||||||
|
List<String> chapterDates = [];
|
||||||
|
for (var chapter in chapters) {
|
||||||
|
final chapterName = chapter["chapter_name"];
|
||||||
|
final chapterSlug = chapter["chapter_slug"];
|
||||||
|
final chapterId = chapter["id"];
|
||||||
|
final createdAt = chapter["created_at"];
|
||||||
|
chapterUrls.add("/series/$currentSlug/$chapterSlug#$chapterId");
|
||||||
|
chapterTitles.add(chapterName);
|
||||||
|
chapterDates.add(createdAt);
|
||||||
|
}
|
||||||
|
if (!useNewQueryEndpoint(manga.source)) {
|
||||||
|
manga.urls = chapterUrls.reversed.toList();
|
||||||
|
manga.names = chapterTitles.reversed.toList();
|
||||||
|
manga.chaptersDateUploads = MBridge.listParseDateTime(
|
||||||
|
chapterDates, manga.dateFormat, manga.dateFormatLocale)
|
||||||
|
.reversed
|
||||||
|
.toList();
|
||||||
|
} else {
|
||||||
|
manga.urls = chapterUrls;
|
||||||
|
manga.names = chapterTitles;
|
||||||
|
manga.chaptersDateUploads = MBridge.listParseDateTime(
|
||||||
|
chapterDates, manga.dateFormat, manga.dateFormatLocale);
|
||||||
|
}
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
getChapterUrl(MangaModel manga) async {
|
||||||
|
String res = "".toString();
|
||||||
|
final headers = getHeader(manga.baseUrl);
|
||||||
|
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));
|
||||||
|
} else {
|
||||||
|
final url = "${manga.baseUrl}${manga.link}";
|
||||||
|
final data = {"url": url, "headers": headers};
|
||||||
|
res = await MBridge.http('GET', json.encode(data));
|
||||||
|
List<String> pageUrls = [];
|
||||||
|
var imagesRes = MBridge.querySelectorAll(res,
|
||||||
|
selector: "div.min-h-screen > div.container > p.items-center",
|
||||||
|
typeElement: 1,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0);
|
||||||
|
pageUrls = MBridge.xpath(imagesRes.first, '//img/@src');
|
||||||
|
|
||||||
|
pageUrls.addAll(MBridge.xpath(imagesRes.first, '//img/@data-src'));
|
||||||
|
|
||||||
|
return pageUrls.where((e) => e.isNotEmpty).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
final pages = MBridge.jsonPathToList(res, r"$.content.images[*]", 0);
|
||||||
|
List<String> pageUrls = [];
|
||||||
|
for (var u in pages) {
|
||||||
|
final url = u.replaceAll('"', "");
|
||||||
|
if (url.startsWith("http")) {
|
||||||
|
pageUrls.add(url);
|
||||||
|
} else {
|
||||||
|
pageUrls.add("${manga.apiUrl}/$url");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pageUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> getHeader(String url) {
|
||||||
|
final headers = {
|
||||||
|
'Origin': url,
|
||||||
|
'Referer': '$url/',
|
||||||
|
'Accept': 'application/json, text/plain, */*',
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
};
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool useNewQueryEndpoint(String sourceName) {
|
||||||
|
List<String> sources = ["YugenMangas", "Perf Scan", "Reaper Scans"];
|
||||||
|
return sources.contains(sourceName);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool useslugStrategy(String sourceName) {
|
||||||
|
List<String> sources = ["YugenMangas", "Reaper Scans"];
|
||||||
|
return sources.contains(sourceName);
|
||||||
|
}
|
||||||
|
|
||||||
|
MangaModel mangaModelRes(String res, MangaModel manga) {
|
||||||
|
var jsonList = [];
|
||||||
|
List<String> names = [];
|
||||||
|
List<String> urls = [];
|
||||||
|
List<String> images = [];
|
||||||
|
if (res.startsWith("{")) {
|
||||||
|
jsonList = json.decode(res)["data"];
|
||||||
|
} else {
|
||||||
|
jsonList = json.decode(res);
|
||||||
|
}
|
||||||
|
for (var a in jsonList) {
|
||||||
|
String thumbnail = a["thumbnail"];
|
||||||
|
if (thumbnail.startsWith("https://")) {
|
||||||
|
images.add(thumbnail);
|
||||||
|
} else {
|
||||||
|
images.add("${manga.apiUrl}/cover/$thumbnail");
|
||||||
|
}
|
||||||
|
names.add(a["title"]);
|
||||||
|
final seriesSlug = MBridge.regExp(a["series_slug"], "-\\d+", "", 0, 0);
|
||||||
|
urls.add("/series/$seriesSlug");
|
||||||
|
}
|
||||||
|
manga.urls = urls;
|
||||||
|
manga.images = images;
|
||||||
|
manga.names = names;
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
@@ -10,8 +10,8 @@ List<Source> get heanCmsSourcesList => _heanCmsSourcesList;
|
|||||||
List<Source> _heanCmsSourcesList = [
|
List<Source> _heanCmsSourcesList = [
|
||||||
Source(
|
Source(
|
||||||
name: "YugenMangas",
|
name: "YugenMangas",
|
||||||
baseUrl: "https://yugenmangas.net",
|
baseUrl: "https://yugenmangas.lat",
|
||||||
apiUrl: "https://api.yugenmangas.net",
|
apiUrl: "https://api.yugenmangas.lat",
|
||||||
lang: "es",
|
lang: "es",
|
||||||
typeSource: "heancms",
|
typeSource: "heancms",
|
||||||
isNsfw: true,
|
isNsfw: true,
|
||||||
@@ -32,4 +32,40 @@ List<Source> _heanCmsSourcesList = [
|
|||||||
version: heancmsVersion,
|
version: heancmsVersion,
|
||||||
dateFormat: defaultDateFormat,
|
dateFormat: defaultDateFormat,
|
||||||
dateFormatLocale: defaultDateFormatLocale),
|
dateFormatLocale: defaultDateFormatLocale),
|
||||||
|
Source(
|
||||||
|
name: "Reaper Scans",
|
||||||
|
baseUrl: "https://reaperscans.net",
|
||||||
|
apiUrl: "https://api.reaperscans.net",
|
||||||
|
lang: "pt-BR",
|
||||||
|
typeSource: "heancms",
|
||||||
|
isNsfw: true,
|
||||||
|
iconUrl: getIconUrl("reaperscans", "pt-BR"),
|
||||||
|
sourceCodeUrl: heancmsSourceCodeUrl,
|
||||||
|
version: heancmsVersion,
|
||||||
|
dateFormat: defaultDateFormat,
|
||||||
|
dateFormatLocale: defaultDateFormatLocale),
|
||||||
|
Source(
|
||||||
|
name: "Perf Scan",
|
||||||
|
baseUrl: "https://perf-scan.fr",
|
||||||
|
apiUrl: "https://api.perf-scan.fr",
|
||||||
|
lang: "fr",
|
||||||
|
typeSource: "heancms",
|
||||||
|
isNsfw: true,
|
||||||
|
iconUrl: getIconUrl("perfscan", "fr"),
|
||||||
|
sourceCodeUrl: heancmsSourceCodeUrl,
|
||||||
|
version: heancmsVersion,
|
||||||
|
dateFormat: defaultDateFormat,
|
||||||
|
dateFormatLocale: defaultDateFormatLocale),
|
||||||
|
Source(
|
||||||
|
name: "Glorious Scan",
|
||||||
|
baseUrl: "https://gloriousscan.com",
|
||||||
|
apiUrl: "https://api.gloriousscan.com",
|
||||||
|
lang: "pt-BR",
|
||||||
|
typeSource: "heancms",
|
||||||
|
isNsfw: true,
|
||||||
|
iconUrl: getIconUrl("gloriousscan", "pt-BR"),
|
||||||
|
sourceCodeUrl: heancmsSourceCodeUrl,
|
||||||
|
version: heancmsVersion,
|
||||||
|
dateFormat: defaultDateFormat,
|
||||||
|
dateFormatLocale: defaultDateFormatLocale),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -3,28 +3,24 @@ import 'package:bridge_lib/bridge_lib.dart';
|
|||||||
|
|
||||||
getPopularManga(MangaModel manga) async {
|
getPopularManga(MangaModel manga) async {
|
||||||
final url = "${manga.baseUrl}/manga/page/${manga.page}/?m_orderby=views";
|
final url = "${manga.baseUrl}/manga/page/${manga.page}/?m_orderby=views";
|
||||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
final data = {"url": url, "sourceId": manga.sourceId};
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
if (res.isEmpty) {
|
if (res.isEmpty) {
|
||||||
return manga;
|
return manga;
|
||||||
}
|
}
|
||||||
manga.urls = MBridge.xpath(res, '//*[@class^="post-title"]/h3/a/@href', '-.')
|
manga.urls = MBridge.xpath(res, '//*[@class^="post-title"]/h3/a/@href');
|
||||||
.split("-.");
|
var images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-src');
|
||||||
String images =
|
|
||||||
MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-src', '-.');
|
|
||||||
if (images.isEmpty) {
|
if (images.isEmpty) {
|
||||||
images =
|
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-lazy-src');
|
||||||
MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-lazy-src', '-.');
|
|
||||||
if (images.isEmpty) {
|
if (images.isEmpty) {
|
||||||
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@srcset', '-.');
|
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@srcset');
|
||||||
if (images.isEmpty) {
|
if (images.isEmpty) {
|
||||||
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@src', '-.');
|
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@src');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
manga.images = images.split("-.");
|
manga.images = images;
|
||||||
manga.names =
|
manga.names = MBridge.xpath(res, '//*[@id^="manga-item"]/a/@title');
|
||||||
MBridge.xpath(res, '//*[@id^="manga-item"]/a/@title', '-.').split("-.");
|
|
||||||
|
|
||||||
return manga;
|
return manga;
|
||||||
}
|
}
|
||||||
@@ -75,36 +71,50 @@ getMangaDetail(MangaModel manga) async {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
final datas = {
|
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
||||||
"url": manga.link,
|
final res = await MBridge.http('GET', json.encode(datas));
|
||||||
"headers": null,
|
|
||||||
"sourceId": manga.sourceId
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(datas), 0);
|
|
||||||
if (res.isEmpty) {
|
if (res.isEmpty) {
|
||||||
return manga;
|
return manga;
|
||||||
}
|
}
|
||||||
manga.author =
|
manga.author = MBridge.querySelectorAll(res,
|
||||||
MBridge.querySelectorAll(res, "div.author-content > a", 0, "", 0, 0, "");
|
selector: "div.author-content > a",
|
||||||
manga.description = MBridge.querySelectorAll(
|
typeElement: 0,
|
||||||
res,
|
attributes: "",
|
||||||
"div.description-summary div.summary__content, div.summary_content div.post-content_item > h5 + div, div.summary_content div.manga-excerpt, div.sinopsis div.contenedor, .description-summary > p",
|
typeRegExp: 0)
|
||||||
0,
|
.first;
|
||||||
"",
|
manga.description = MBridge.querySelectorAll(res,
|
||||||
0,
|
selector:
|
||||||
0,
|
"div.description-summary div.summary__content, div.summary_content div.post-content_item > h5 + div, div.summary_content div.manga-excerpt, div.sinopsis div.contenedor, .description-summary > p",
|
||||||
"");
|
typeElement: 0,
|
||||||
manga.imageUrl =
|
attributes: "",
|
||||||
MBridge.querySelectorAll(res, "div.summary_image img", 2, "", 2, 1, "");
|
typeRegExp: 0)
|
||||||
final mangaId = MBridge.querySelectorAll(
|
.first;
|
||||||
res, "div[id^=manga-chapters-holder]", 3, "data-id", 0, 1, "");
|
manga.imageUrl = MBridge.querySelectorAll(res,
|
||||||
|
selector: "div.summary_image img",
|
||||||
|
typeElement: 2,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 2)
|
||||||
|
.first;
|
||||||
|
final mangaId = MBridge.querySelectorAll(res,
|
||||||
|
selector: "div[id^=manga-chapters-holder]",
|
||||||
|
typeElement: 3,
|
||||||
|
attributes: "data-id",
|
||||||
|
typeRegExp: 0)
|
||||||
|
.first;
|
||||||
manga.status = MBridge.parseStatus(
|
manga.status = MBridge.parseStatus(
|
||||||
MBridge.querySelectorAll(res, "div.summary-content", 0, "", 0, 2, ""),
|
MBridge.querySelectorAll(res,
|
||||||
|
selector: "div.summary-content",
|
||||||
|
typeElement: 0,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0)
|
||||||
|
.last,
|
||||||
statusList);
|
statusList);
|
||||||
|
|
||||||
manga.genre =
|
manga.genre = MBridge.querySelectorAll(res,
|
||||||
MBridge.querySelectorAll(res, "div.genres-content a", 0, "", 0, 0, "-.")
|
selector: "div.genres-content a",
|
||||||
.split("-.");
|
typeElement: 0,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0);
|
||||||
|
|
||||||
final baseUrl = "${manga.baseUrl}/";
|
final baseUrl = "${manga.baseUrl}/";
|
||||||
final headers = {
|
final headers = {
|
||||||
@@ -116,7 +126,7 @@ getMangaDetail(MangaModel manga) async {
|
|||||||
"${baseUrl}wp-admin/admin-ajax.php?action=manga_get_chapters&manga=$mangaId";
|
"${baseUrl}wp-admin/admin-ajax.php?action=manga_get_chapters&manga=$mangaId";
|
||||||
final datasP = {"url": url, "headers": headers, "sourceId": manga.sourceId};
|
final datasP = {"url": url, "headers": headers, "sourceId": manga.sourceId};
|
||||||
|
|
||||||
String resP = await MBridge.http(json.encode(datasP), 1);
|
String resP = await MBridge.http('POST', json.encode(datasP));
|
||||||
if (resP == "400") {
|
if (resP == "400") {
|
||||||
final urlP = "${manga.link}ajax/chapters";
|
final urlP = "${manga.link}ajax/chapters";
|
||||||
final datasP = {
|
final datasP = {
|
||||||
@@ -124,32 +134,24 @@ getMangaDetail(MangaModel manga) async {
|
|||||||
"headers": headers,
|
"headers": headers,
|
||||||
"sourceId": manga.sourceId
|
"sourceId": manga.sourceId
|
||||||
};
|
};
|
||||||
resP = await MBridge.http(json.encode(datasP), 1);
|
resP = await MBridge.http('POST', json.encode(datasP));
|
||||||
}
|
}
|
||||||
manga.urls = MBridge.xpath(resP, "//li/a/@href", '-.').split("-.");
|
manga.urls = MBridge.xpath(resP, "//li/a/@href");
|
||||||
List<dynamic> chaptersNames =
|
var chaptersNames = MBridge.xpath(resP, "//li/a/text()");
|
||||||
MBridge.xpath(resP, "//li/a/text()", '-.').split("-.");
|
|
||||||
|
|
||||||
List<dynamic> dateF =
|
var dateF = MBridge.xpath(resP, "//li/span/i/text()");
|
||||||
MBridge.xpath(resP, "//li/span/i/text()", '-.').split("-.");
|
|
||||||
if (MBridge.xpath(resP, "//li/a/text()", "").isEmpty) {
|
if (MBridge.xpath(resP, "//li/a/text()", "").isEmpty) {
|
||||||
final resWebview = await MBridge.getHtmlViaWebview(manga.link,
|
final resWebview = await MBridge.getHtmlViaWebview(manga.link,
|
||||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/@href");
|
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/@href");
|
||||||
manga.urls = MBridge.xpath(resWebview,
|
manga.urls = MBridge.xpath(resWebview,
|
||||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/@href", '-.')
|
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/@href");
|
||||||
.split("-.");
|
|
||||||
chaptersNames = MBridge.xpath(resWebview,
|
chaptersNames = MBridge.xpath(resWebview,
|
||||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/text()", '-.')
|
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/text()");
|
||||||
.split("-.");
|
dateF = MBridge.xpath(resWebview,
|
||||||
dateF = MBridge.xpath(
|
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/span/i/text()");
|
||||||
resWebview,
|
|
||||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/span/i/text()",
|
|
||||||
'-.')
|
|
||||||
.split("-.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
manga.names = chaptersNames;
|
manga.names = chaptersNames;
|
||||||
List<String> chapterDate = [];
|
|
||||||
if (dateF.length == chaptersNames.length) {
|
if (dateF.length == chaptersNames.length) {
|
||||||
manga.chaptersDateUploads = MBridge.listParseDateTime(
|
manga.chaptersDateUploads = MBridge.listParseDateTime(
|
||||||
dateF, manga.dateFormat, manga.dateFormatLocale);
|
dateF, manga.dateFormat, manga.dateFormatLocale);
|
||||||
@@ -162,7 +164,7 @@ getMangaDetail(MangaModel manga) async {
|
|||||||
|
|
||||||
final dateFF = MBridge.listParseDateTime(
|
final dateFF = MBridge.listParseDateTime(
|
||||||
dateF, manga.dateFormat, manga.dateFormatLocale);
|
dateF, manga.dateFormat, manga.dateFormatLocale);
|
||||||
List<String> chapterDate = MBridge.listParse(date.split('--..'), 0);
|
List<String> chapterDate = date.split('--..');
|
||||||
|
|
||||||
for (var date in dateFF) {
|
for (var date in dateFF) {
|
||||||
chapterDate.add(date);
|
chapterDate.add(date);
|
||||||
@@ -173,42 +175,45 @@ getMangaDetail(MangaModel manga) async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getChapterUrl(MangaModel manga) async {
|
getChapterUrl(MangaModel manga) async {
|
||||||
final datas = {
|
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
||||||
"url": manga.link,
|
final res = await MBridge.http('GET', json.encode(datas));
|
||||||
"headers": null,
|
|
||||||
"sourceId": manga.sourceId
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(datas), 0);
|
|
||||||
if (res.isEmpty) {
|
if (res.isEmpty) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
final pagesSelectorRes = MBridge.querySelector(
|
final pagesSelectorRes = MBridge.querySelectorAll(res,
|
||||||
res,
|
selector:
|
||||||
"div.page-break, li.blocks-gallery-item, .reading-content, .text-left img",
|
"div.page-break, li.blocks-gallery-item, .reading-content, .text-left img",
|
||||||
1,
|
typeElement: 1,
|
||||||
"");
|
attributes: "",
|
||||||
final imgs =
|
typeRegExp: 0)
|
||||||
MBridge.querySelectorAll(pagesSelectorRes, "img", 2, "", 2, 0, '-.')
|
.first;
|
||||||
.split('-.');
|
final imgs = MBridge.querySelectorAll(pagesSelectorRes,
|
||||||
List<dynamic> pageUrls = [];
|
selector: "img", typeElement: 2, attributes: "", typeRegExp: 2);
|
||||||
|
var pageUrls = [];
|
||||||
|
|
||||||
if (imgs.length == 1) {
|
if (imgs.length == 1) {
|
||||||
final pages = MBridge.querySelector(res, "#single-pager", 2, "");
|
final pages = MBridge.querySelectorAll(res,
|
||||||
|
selector: "#single-pager",
|
||||||
|
typeElement: 2,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0)
|
||||||
|
.first;
|
||||||
|
|
||||||
final pagesNumber =
|
final pagesNumber = MBridge.querySelectorAll(pages,
|
||||||
MBridge.querySelectorAll(pages, "option", 2, "", 0, 0, '-.')
|
selector: "option", typeElement: 2, attributes: "", typeRegExp: 0);
|
||||||
.split('-.');
|
|
||||||
|
|
||||||
for (var i = 0; i < pagesNumber.length; i++) {
|
for (var i = 0; i < pagesNumber.length; i++) {
|
||||||
final val = i + 1;
|
final val = i + 1;
|
||||||
if (i.toString().length == 1) {
|
if (i.toString().length == 1) {
|
||||||
pageUrls.add(
|
pageUrls.add(MBridge.querySelectorAll(pagesSelectorRes,
|
||||||
MBridge.querySelectorAll(pagesSelectorRes, "img", 2, "", 2, 0, "")
|
selector: "img", typeElement: 2, attributes: "", typeRegExp: 2)
|
||||||
.replaceAll("01", '0$val'));
|
.first
|
||||||
|
.replaceAll("01", '0$val'));
|
||||||
} else {
|
} else {
|
||||||
pageUrls.add(
|
pageUrls.add(MBridge.querySelectorAll(pagesSelectorRes,
|
||||||
MBridge.querySelectorAll(pagesSelectorRes, "img", 2, "", 2, 0, "")
|
selector: "img", typeElement: 2, attributes: "", typeRegExp: 2)
|
||||||
.replaceAll("01", val.toString()));
|
.first
|
||||||
|
.replaceAll("01", val.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -219,59 +224,53 @@ getChapterUrl(MangaModel manga) async {
|
|||||||
|
|
||||||
getLatestUpdatesManga(MangaModel manga) async {
|
getLatestUpdatesManga(MangaModel manga) async {
|
||||||
final url = "${manga.baseUrl}/manga/page/${manga.page}/?m_orderby=latest";
|
final url = "${manga.baseUrl}/manga/page/${manga.page}/?m_orderby=latest";
|
||||||
final datas = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
final datas = {"url": url, "sourceId": manga.sourceId};
|
||||||
final res = await MBridge.http(json.encode(datas), 0);
|
final res = await MBridge.http('GET', json.encode(datas));
|
||||||
if (res.isEmpty) {
|
if (res.isEmpty) {
|
||||||
return manga;
|
return manga;
|
||||||
}
|
}
|
||||||
manga.urls = MBridge.xpath(res, '//*[@class^="post-title"]/h3/a/@href', '-.')
|
manga.urls = MBridge.xpath(res, '//*[@class^="post-title"]/h3/a/@href');
|
||||||
.split("-.");
|
var images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-src');
|
||||||
String images =
|
|
||||||
MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-src', '-.');
|
|
||||||
if (images.isEmpty) {
|
if (images.isEmpty) {
|
||||||
images =
|
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-lazy-src');
|
||||||
MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-lazy-src', '-.');
|
|
||||||
if (images.isEmpty) {
|
if (images.isEmpty) {
|
||||||
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@srcset', '-.');
|
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@srcset');
|
||||||
if (images.isEmpty) {
|
if (images.isEmpty) {
|
||||||
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@src', '-.');
|
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@src');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
manga.images = images.split("-.");
|
manga.images = images;
|
||||||
manga.names =
|
manga.names = MBridge.xpath(res, '//*[@id^="manga-item"]/a/@title');
|
||||||
MBridge.xpath(res, '//*[@id^="manga-item"]/a/@title', '-.').split("-.");
|
|
||||||
return manga;
|
return manga;
|
||||||
}
|
}
|
||||||
|
|
||||||
searchManga(MangaModel manga) async {
|
searchManga(MangaModel manga) async {
|
||||||
final urll = "${manga.baseUrl}/?s=${manga.query}&post_type=wp-manga";
|
final urll = "${manga.baseUrl}/?s=${manga.query}&post_type=wp-manga";
|
||||||
final datas = {"url": urll, "headers": null, "sourceId": manga.sourceId};
|
final datas = {"url": urll, "sourceId": manga.sourceId};
|
||||||
final res = await MBridge.http(json.encode(datas), 0);
|
final res = await MBridge.http('GET', json.encode(datas));
|
||||||
if (res.isEmpty) {
|
if (res.isEmpty) {
|
||||||
return manga;
|
return manga;
|
||||||
}
|
}
|
||||||
manga.urls =
|
manga.urls =
|
||||||
MBridge.xpath(res, '//*[@class^="tab-thumb c-image-hover"]/a/@href', '-.')
|
MBridge.xpath(res, '//*[@class^="tab-thumb c-image-hover"]/a/@href');
|
||||||
.split("-.");
|
var images = MBridge.xpath(
|
||||||
String images = MBridge.xpath(
|
res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@data-src');
|
||||||
res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@data-src', '-.');
|
|
||||||
if (images.isEmpty) {
|
if (images.isEmpty) {
|
||||||
images = MBridge.xpath(res,
|
images = MBridge.xpath(
|
||||||
'//*[@class^="tab-thumb c-image-hover"]/a/img/@data-lazy-src', '-.');
|
res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@data-lazy-src');
|
||||||
if (images.isEmpty) {
|
if (images.isEmpty) {
|
||||||
images = MBridge.xpath(
|
images = MBridge.xpath(
|
||||||
res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@srcset', '-.');
|
res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@srcset');
|
||||||
if (images.isEmpty) {
|
if (images.isEmpty) {
|
||||||
images = MBridge.xpath(
|
images = MBridge.xpath(
|
||||||
res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@src', '-.');
|
res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@src');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
manga.images = images.split("-.");
|
manga.images = images;
|
||||||
manga.names = MBridge.xpath(
|
manga.names =
|
||||||
res, '//*[@class^="tab-thumb c-image-hover"]/a/@title', '-.')
|
MBridge.xpath(res, '//*[@class^="tab-thumb c-image-hover"]/a/@title');
|
||||||
.split("-.");
|
|
||||||
return manga;
|
return manga;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,216 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
getPopularManga(MangaModel manga) async {
|
|
||||||
final url =
|
|
||||||
"${manga.baseUrl}${getMangaUrlDirectory(manga.source)}/?page=${manga.page}&order=popular";
|
|
||||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
manga.urls =
|
|
||||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href', '._')
|
|
||||||
.split('._');
|
|
||||||
manga.names =
|
|
||||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title', '._')
|
|
||||||
.split('._');
|
|
||||||
manga.images = MBridge.xpath(
|
|
||||||
res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src', '._')
|
|
||||||
.split('._');
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesManga(MangaModel manga) async {
|
|
||||||
final url =
|
|
||||||
"${manga.baseUrl}${getMangaUrlDirectory(manga.source)}/?page=${manga.page}&order=update";
|
|
||||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
manga.urls =
|
|
||||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href', '._')
|
|
||||||
.split('._');
|
|
||||||
manga.names =
|
|
||||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title', '._')
|
|
||||||
.split('._');
|
|
||||||
manga.images = MBridge.xpath(
|
|
||||||
res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src', '._')
|
|
||||||
.split('._');
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getMangaDetail(MangaModel manga) async {
|
|
||||||
final statusList = [
|
|
||||||
{
|
|
||||||
"مستمرة": 0,
|
|
||||||
"En curso": 0,
|
|
||||||
"Ongoing": 0,
|
|
||||||
"On going": 0,
|
|
||||||
"Ativo": 0,
|
|
||||||
"En Cours": 0,
|
|
||||||
"Berjalan": 0,
|
|
||||||
"Продолжается": 0,
|
|
||||||
"Updating": 0,
|
|
||||||
"Lançando": 0,
|
|
||||||
"In Arrivo": 0,
|
|
||||||
"OnGoing": 0,
|
|
||||||
"Đang tiến hành": 0,
|
|
||||||
"em lançamento": 0,
|
|
||||||
"Онгоінг": 0,
|
|
||||||
"Publishing": 0,
|
|
||||||
"Curso": 0,
|
|
||||||
"En marcha": 0,
|
|
||||||
"Publicandose": 0,
|
|
||||||
"连载中": 0,
|
|
||||||
"Devam Ediyor": 0,
|
|
||||||
"Em Andamento": 0,
|
|
||||||
"In Corso": 0,
|
|
||||||
"Güncel": 0,
|
|
||||||
"Emision": 0,
|
|
||||||
"En emision": 0,
|
|
||||||
"مستمر": 0,
|
|
||||||
"Đã hoàn thành": 1,
|
|
||||||
"مكتملة": 1,
|
|
||||||
"Завершено": 1,
|
|
||||||
"Complété": 1,
|
|
||||||
"Fini": 1,
|
|
||||||
"Terminé": 1,
|
|
||||||
"Tamamlandı": 1,
|
|
||||||
"Tamat": 1,
|
|
||||||
"Completado": 1,
|
|
||||||
"Concluído": 1,
|
|
||||||
"Finished": 1,
|
|
||||||
"Completed": 1,
|
|
||||||
"Completo": 1,
|
|
||||||
"Concluido": 1,
|
|
||||||
"已完结": 1,
|
|
||||||
"Finalizado": 1,
|
|
||||||
"Completata": 1,
|
|
||||||
"One-Shot": 1,
|
|
||||||
"Bitti": 1,
|
|
||||||
"hiatus": 2,
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
final datas = {
|
|
||||||
"url": manga.link,
|
|
||||||
"headers": null,
|
|
||||||
"sourceId": manga.sourceId
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(datas), 0);
|
|
||||||
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
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()',
|
|
||||||
'')
|
|
||||||
.replaceAll("Autor", "")
|
|
||||||
.replaceAll("Author", "")
|
|
||||||
.replaceAll("Auteur", "")
|
|
||||||
.replaceAll("[Add, ]", "");
|
|
||||||
|
|
||||||
manga.description = MBridge.querySelectorAll(
|
|
||||||
res, ".desc, .entry-content[itemprop=description]", 0, "", 0, 0, "");
|
|
||||||
|
|
||||||
final status = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="imptdt" and contains(text(), "Status") or @class="imptdt" and contains(text(), "Estado") or @class="infotable" and contains(text(), "Status") or @class="infotable" and contains(text(), "Statut") or @class="imptdt" and contains(text(), "Statut")]/text()',
|
|
||||||
'')
|
|
||||||
.replaceAll("Status", "")
|
|
||||||
.replaceAll("Estado", "")
|
|
||||||
.replaceAll("Statut", "");
|
|
||||||
|
|
||||||
manga.status = MBridge.parseStatus(status, statusList);
|
|
||||||
|
|
||||||
manga.genre = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="gnr" or @class="mgen" or @class="seriestugenre" ]/a/text()',
|
|
||||||
"-.")
|
|
||||||
.split("-.");
|
|
||||||
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',
|
|
||||||
"-.")
|
|
||||||
.split("-.");
|
|
||||||
manga.names = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="bxcl" or @class="cl" or @class="chbox" or @class="eph-num" or @id="chapterlist"]/div/a/span[@class="chapternum" and not(text()="Chapter {{number}}") or @class="lch" and not(text()="Chapter {{number}}")]/text()',
|
|
||||||
"-.")
|
|
||||||
.split("-.");
|
|
||||||
|
|
||||||
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()',
|
|
||||||
"-.")
|
|
||||||
.split("-.");
|
|
||||||
|
|
||||||
manga.chaptersDateUploads = MBridge.listParseDateTime(
|
|
||||||
chaptersDateUploads, manga.dateFormat, manga.dateFormatLocale);
|
|
||||||
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
searchManga(MangaModel manga) async {
|
|
||||||
final url =
|
|
||||||
"${manga.baseUrl}${getMangaUrlDirectory(manga.source)}/?&title=${manga.query}&page=${manga.page}";
|
|
||||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
manga.urls =
|
|
||||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href', '._')
|
|
||||||
.split('._');
|
|
||||||
manga.names =
|
|
||||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title', '._')
|
|
||||||
.split('._');
|
|
||||||
manga.images = MBridge.xpath(
|
|
||||||
res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src', '._')
|
|
||||||
.split('._');
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getChapterUrl(MangaModel manga) async {
|
|
||||||
final datas = {
|
|
||||||
"url": manga.link,
|
|
||||||
"headers": null,
|
|
||||||
"sourceId": manga.sourceId
|
|
||||||
};
|
|
||||||
|
|
||||||
final res = await MBridge.http(json.encode(datas), 0);
|
|
||||||
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
if (manga.source == "Sushi-Scans") {
|
|
||||||
final pages = MBridge.xpath(res, '//*[@id="readerarea"]/p/img/@src', "._._")
|
|
||||||
.split("._._");
|
|
||||||
return pages;
|
|
||||||
}
|
|
||||||
List<String> pagesUrl = [];
|
|
||||||
final pages = MBridge.xpath(res, '//*[@id="readerarea"]/img/@src', "._._")
|
|
||||||
.split("._._");
|
|
||||||
if (pages.length == 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);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return pages;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pagesUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
String getMangaUrlDirectory(String sourceName) {
|
|
||||||
if (sourceName == "Sushi-Scan") {
|
|
||||||
return "/catalogue";
|
|
||||||
}
|
|
||||||
return "/manga";
|
|
||||||
}
|
|
||||||
173
manga/multisrc/mangareader/mangareader-v0.0.3.dart
Normal file
173
manga/multisrc/mangareader/mangareader-v0.0.3.dart
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'package:bridge_lib/bridge_lib.dart';
|
||||||
|
|
||||||
|
getPopularManga(MangaModel manga) async {
|
||||||
|
final url = "${manga.baseUrl}${getMangaUrlDirectory(manga.source)}/?page=${manga.page}&order=popular";
|
||||||
|
final data = {"url": url, "sourceId": manga.sourceId};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
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(MangaModel manga) async {
|
||||||
|
final url = "${manga.baseUrl}${getMangaUrlDirectory(manga.source)}/?page=${manga.page}&order=update";
|
||||||
|
final data = {"url": url, "sourceId": manga.sourceId};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
getMangaDetail(MangaModel manga) async {
|
||||||
|
final statusList = [
|
||||||
|
{
|
||||||
|
"مستمرة": 0,
|
||||||
|
"En curso": 0,
|
||||||
|
"Ongoing": 0,
|
||||||
|
"On going": 0,
|
||||||
|
"Ativo": 0,
|
||||||
|
"En Cours": 0,
|
||||||
|
"Berjalan": 0,
|
||||||
|
"Продолжается": 0,
|
||||||
|
"Updating": 0,
|
||||||
|
"Lançando": 0,
|
||||||
|
"In Arrivo": 0,
|
||||||
|
"OnGoing": 0,
|
||||||
|
"Đang tiến hành": 0,
|
||||||
|
"em lançamento": 0,
|
||||||
|
"Онгоінг": 0,
|
||||||
|
"Publishing": 0,
|
||||||
|
"Curso": 0,
|
||||||
|
"En marcha": 0,
|
||||||
|
"Publicandose": 0,
|
||||||
|
"连载中": 0,
|
||||||
|
"Devam Ediyor": 0,
|
||||||
|
"Em Andamento": 0,
|
||||||
|
"In Corso": 0,
|
||||||
|
"Güncel": 0,
|
||||||
|
"Emision": 0,
|
||||||
|
"En emision": 0,
|
||||||
|
"مستمر": 0,
|
||||||
|
"Đã hoàn thành": 1,
|
||||||
|
"مكتملة": 1,
|
||||||
|
"Завершено": 1,
|
||||||
|
"Complété": 1,
|
||||||
|
"Fini": 1,
|
||||||
|
"Terminé": 1,
|
||||||
|
"Tamamlandı": 1,
|
||||||
|
"Tamat": 1,
|
||||||
|
"Completado": 1,
|
||||||
|
"Concluído": 1,
|
||||||
|
"Finished": 1,
|
||||||
|
"Completed": 1,
|
||||||
|
"Completo": 1,
|
||||||
|
"Concluido": 1,
|
||||||
|
"已完结": 1,
|
||||||
|
"Finalizado": 1,
|
||||||
|
"Completata": 1,
|
||||||
|
"One-Shot": 1,
|
||||||
|
"Bitti": 1,
|
||||||
|
"hiatus": 2,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
||||||
|
final res = await MBridge.http('GET', json.encode(datas));
|
||||||
|
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
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()',
|
||||||
|
'')
|
||||||
|
.first
|
||||||
|
.replaceAll("Autor", "")
|
||||||
|
.replaceAll("Author", "")
|
||||||
|
.replaceAll("Auteur", "")
|
||||||
|
.replaceAll("[Add, ]", "");
|
||||||
|
|
||||||
|
manga.description = MBridge.querySelectorAll(res,
|
||||||
|
selector: ".desc, .entry-content[itemprop=description]", typeElement: 0, attributes: "", typeRegExp: 0)
|
||||||
|
.first;
|
||||||
|
|
||||||
|
final status = MBridge.xpath(
|
||||||
|
res,
|
||||||
|
'//*[@class="imptdt" and contains(text(), "Status") or @class="imptdt" and contains(text(), "Estado") or @class="infotable" and contains(text(), "Status") or @class="infotable" and contains(text(), "Statut") or @class="imptdt" and contains(text(), "Statut")]/text()',
|
||||||
|
'')
|
||||||
|
.first
|
||||||
|
.replaceAll("Status", "")
|
||||||
|
.replaceAll("Estado", "")
|
||||||
|
.replaceAll("Statut", "");
|
||||||
|
|
||||||
|
manga.status = MBridge.parseStatus(status, statusList);
|
||||||
|
|
||||||
|
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,
|
||||||
|
'//*[@class="bxcl" or @class="cl" or @class="chbox" or @class="eph-num" or @id="chapterlist"]/div/a/span[@class="chapternum" and not(text()="Chapter {{number}}") or @class="lch" and not(text()="Chapter {{number}}")]/text()');
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
searchManga(MangaModel manga) async {
|
||||||
|
final url = "${manga.baseUrl}${getMangaUrlDirectory(manga.source)}/?&title=${manga.query}&page=${manga.page}";
|
||||||
|
final data = {"url": url, "sourceId": manga.sourceId};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
getChapterUrl(MangaModel manga) async {
|
||||||
|
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
||||||
|
|
||||||
|
final res = await MBridge.http('GET', json.encode(datas));
|
||||||
|
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
var pages = [];
|
||||||
|
List<String> pagesUrl = [];
|
||||||
|
pages = MBridge.xpath(res, '//*[@id="readerarea"]/p/img/@src');
|
||||||
|
if (pages.isEmpty || pages.length == 1) {
|
||||||
|
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 pages = MBridge.jsonDecodeToList(images, 0);
|
||||||
|
for (var page in pages) {
|
||||||
|
pagesUrl.add(page);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return pages;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pagesUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getMangaUrlDirectory(String sourceName) {
|
||||||
|
if (sourceName == "Sushi-Scan") {
|
||||||
|
return "/catalogue";
|
||||||
|
}
|
||||||
|
return "/manga";
|
||||||
|
}
|
||||||
@@ -1,174 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
searchManga(MangaModel manga) async {
|
|
||||||
final url = "${manga.baseUrl}/search?query=${manga.query}";
|
|
||||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
final jsonList = MBridge.jsonPathToList(res, r'$.suggestions[*]', 0);
|
|
||||||
List<String> urls = [];
|
|
||||||
List<String> names = [];
|
|
||||||
List<String> images = [];
|
|
||||||
for (var da in jsonList) {
|
|
||||||
final value = MBridge.getMapValue(da, "value", 0);
|
|
||||||
final data = MBridge.getMapValue(da, "data", 0);
|
|
||||||
if (manga.source == 'Scan VF') {
|
|
||||||
urls.add('${manga.baseUrl}/$data');
|
|
||||||
} else if (manga.source == 'Manga-FR') {
|
|
||||||
urls.add('${manga.baseUrl}/lecture-en-ligne/$data');
|
|
||||||
} else {
|
|
||||||
urls.add('${manga.baseUrl}/manga/$data');
|
|
||||||
}
|
|
||||||
names.add(value);
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
manga.names = names;
|
|
||||||
manga.urls = urls;
|
|
||||||
manga.images = images;
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getPopularManga(MangaModel manga) async {
|
|
||||||
final url =
|
|
||||||
"${manga.baseUrl}/filterList?page=${manga.page}&sortBy=views&asc=false";
|
|
||||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
manga.urls =
|
|
||||||
MBridge.xpath(res, '//*[ @class="chart-title"]/@href', '._').split('._');
|
|
||||||
manga.names =
|
|
||||||
MBridge.xpath(res, '//*[ @class="chart-title"]/text()', '._').split('._');
|
|
||||||
List<String> images = [];
|
|
||||||
for (var url in manga.urls) {
|
|
||||||
if (manga.source == "Manga-FR") {
|
|
||||||
images.add(
|
|
||||||
"${manga.baseUrl}/uploads/manga/${MBridge.listParse(MBridge.stringParse(url, 0).split('/'), 2)[0]}.jpg");
|
|
||||||
} else {
|
|
||||||
images.add(
|
|
||||||
"${manga.baseUrl}/uploads/manga/${MBridge.listParse(MBridge.stringParse(url, 0).split('/'), 2)[0]}/cover/cover_250x350.jpg");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
manga.images = images;
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getMangaDetail(MangaModel manga) async {
|
|
||||||
final statusList = [
|
|
||||||
{
|
|
||||||
"complete": 1,
|
|
||||||
"complet": 1,
|
|
||||||
"completo": 1,
|
|
||||||
"zakończone": 1,
|
|
||||||
"concluído": 1,
|
|
||||||
"مكتملة": 1,
|
|
||||||
"ongoing": 0,
|
|
||||||
"en cours": 0,
|
|
||||||
"em lançamento": 0,
|
|
||||||
"prace w toku": 0,
|
|
||||||
"ativo": 0,
|
|
||||||
"مستمرة": 0,
|
|
||||||
"em andamento": 0
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
final datas = {
|
|
||||||
"url": manga.link,
|
|
||||||
"headers": null,
|
|
||||||
"sourceId": manga.sourceId
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(datas), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
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()',
|
|
||||||
'');
|
|
||||||
final status = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="dl-horizontal"]/dt[contains(text(), "Statut") or contains(text(), "Status") or contains(text(), "Estado") or contains(text(), "Durum")]/following-sibling::dd[1]/text()',
|
|
||||||
'');
|
|
||||||
manga.status = MBridge.parseStatus(status, statusList);
|
|
||||||
manga.description = MBridge.xpath(
|
|
||||||
res, '//*[@class="well" or @class="manga well"]/p/text()', '');
|
|
||||||
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()',
|
|
||||||
'')
|
|
||||||
.split(',');
|
|
||||||
manga.names =
|
|
||||||
MBridge.xpath(res, '//*[@class="chapter-title-rtl"]/a/text()', "-.")
|
|
||||||
.split("-.");
|
|
||||||
manga.urls =
|
|
||||||
MBridge.xpath(res, '//*[@class="chapter-title-rtl"]/a/@href', "-.")
|
|
||||||
.split("-.");
|
|
||||||
final date =
|
|
||||||
MBridge.xpath(res, '//*[@class="date-chapter-title-rtl"]/text()', "-.")
|
|
||||||
.split("-.");
|
|
||||||
manga.chaptersDateUploads =
|
|
||||||
MBridge.listParseDateTime(date, "d MMM. yyyy", "en_US");
|
|
||||||
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesManga(MangaModel manga) async {
|
|
||||||
final url = "${manga.baseUrl}/latest-release?page=${manga.page}";
|
|
||||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
manga.urls = MBridge.xpath(res, '//*[@class="manga-item"]/h3/a/@href', '._')
|
|
||||||
.split('._');
|
|
||||||
manga.names = MBridge.xpath(res, '//*[@class="manga-item"]/h3/a/text()', '._')
|
|
||||||
.split('._');
|
|
||||||
List<String> images = [];
|
|
||||||
for (var url in manga.urls) {
|
|
||||||
if (manga.source == "Manga-FR") {
|
|
||||||
images.add(
|
|
||||||
"${manga.baseUrl}/uploads/manga/${MBridge.listParse(MBridge.stringParse(url, 0).split('/'), 2)[0]}.jpg");
|
|
||||||
} else {
|
|
||||||
images.add(
|
|
||||||
"${manga.baseUrl}/uploads/manga/${MBridge.listParse(MBridge.stringParse(url, 0).split('/'), 2)[0]}/cover/cover_250x350.jpg");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
manga.images = images;
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getChapterUrl(MangaModel manga) async {
|
|
||||||
final datas = {
|
|
||||||
"url": manga.link,
|
|
||||||
"headers": null,
|
|
||||||
"sourceId": manga.sourceId
|
|
||||||
};
|
|
||||||
final res = await MBridge.http(json.encode(datas), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
List<String> pagesUrl = [];
|
|
||||||
final pages = MBridge.listParse(
|
|
||||||
MBridge.xpath(res,
|
|
||||||
'//*[@id="all"]/img[@class="img-responsive"]/@data-src', "._._")
|
|
||||||
.split("._._"),
|
|
||||||
0);
|
|
||||||
for (var page in pages) {
|
|
||||||
if (page.startsWith('//')) {
|
|
||||||
pagesUrl.add(page.replaceAll('//', 'https://'));
|
|
||||||
} else {
|
|
||||||
pagesUrl.add(page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return pagesUrl;
|
|
||||||
}
|
|
||||||
141
manga/multisrc/mmrcms/mmrcms-v0.0.2.dart
Normal file
141
manga/multisrc/mmrcms/mmrcms-v0.0.2.dart
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'package:bridge_lib/bridge_lib.dart';
|
||||||
|
|
||||||
|
searchManga(MangaModel 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 jsonList = json.decode(res)["suggestions"];
|
||||||
|
List<String> urls = [];
|
||||||
|
List<String> names = [];
|
||||||
|
List<String> images = [];
|
||||||
|
for (var da in jsonList) {
|
||||||
|
String value = da["value"];
|
||||||
|
String data = da["data"];
|
||||||
|
if (manga.source == 'Scan VF') {
|
||||||
|
urls.add('${manga.baseUrl}/$data');
|
||||||
|
} else if (manga.source == 'Manga-FR') {
|
||||||
|
urls.add('${manga.baseUrl}/lecture-en-ligne/$data');
|
||||||
|
} else {
|
||||||
|
urls.add('${manga.baseUrl}/manga/$data');
|
||||||
|
}
|
||||||
|
names.add(value);
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
manga.names = names;
|
||||||
|
manga.urls = urls;
|
||||||
|
manga.images = images;
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
getPopularManga(MangaModel manga) async {
|
||||||
|
final url = "${manga.baseUrl}/filterList?page=${manga.page}&sortBy=views&asc=false";
|
||||||
|
final data = {"url": url, "sourceId": manga.sourceId};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
manga.urls = MBridge.xpath(res, '//*[ @class="chart-title"]/@href');
|
||||||
|
manga.names = MBridge.xpath(res, '//*[ @class="chart-title"]/text()');
|
||||||
|
List<String> images = [];
|
||||||
|
for (var url in manga.urls) {
|
||||||
|
String slug = MBridge.substringAfterLast(url, '/');
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
manga.images = images;
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
getMangaDetail(MangaModel manga) async {
|
||||||
|
final statusList = [
|
||||||
|
{
|
||||||
|
"complete": 1,
|
||||||
|
"complet": 1,
|
||||||
|
"completo": 1,
|
||||||
|
"zakończone": 1,
|
||||||
|
"concluído": 1,
|
||||||
|
"مكتملة": 1,
|
||||||
|
"ongoing": 0,
|
||||||
|
"en cours": 0,
|
||||||
|
"em lançamento": 0,
|
||||||
|
"prace w toku": 0,
|
||||||
|
"ativo": 0,
|
||||||
|
"مستمرة": 0,
|
||||||
|
"em andamento": 0
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
||||||
|
final res = await MBridge.http('GET', json.encode(datas));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
final status = MBridge.xpath(res,
|
||||||
|
'//*[@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.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");
|
||||||
|
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
getLatestUpdatesManga(MangaModel 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;
|
||||||
|
}
|
||||||
|
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 = [];
|
||||||
|
for (var url in manga.urls) {
|
||||||
|
String slug = MBridge.substringAfterLast(url, '/');
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
manga.images = images;
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
getChapterUrl(MangaModel manga) async {
|
||||||
|
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
||||||
|
final res = await MBridge.http('GET', json.encode(datas));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
List<String> pagesUrl = [];
|
||||||
|
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://'));
|
||||||
|
} else {
|
||||||
|
pagesUrl.add(page);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pagesUrl;
|
||||||
|
}
|
||||||
@@ -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';
|
import 'dart:convert';
|
||||||
|
|
||||||
getLatestUpdatesManga(MangaModel manga) async {
|
getLatestUpdatesManga(MangaModel manga) async {
|
||||||
final url =
|
final url = "${manga.apiUrl}/v1.0/search?sort=uploaded&page=${manga.page}&tachiyomi=true";
|
||||||
"${manga.apiUrl}/v1.0/search?sort=uploaded&page=${manga.page}&tachiyomi=true";
|
|
||||||
final data = {"url": url, "headers": getHeader(manga.baseUrl)};
|
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) {
|
if (res.isEmpty) {
|
||||||
return manga;
|
return manga;
|
||||||
}
|
}
|
||||||
|
|
||||||
manga.names = MBridge.jsonPathToList(res, r'$.title', 0);
|
manga.names = MBridge.jsonPathToList(res, r'$.title', 0);
|
||||||
List<String> ids = MBridge.jsonPathToList(res, r'$.hid', 0);
|
List<String> ids = MBridge.jsonPathToList(res, r'$.hid', 0);
|
||||||
List<String> mangaUrls = [];
|
List<String> mangaUrls = [];
|
||||||
@@ -32,59 +32,43 @@ getMangaDetail(MangaModel manga) async {
|
|||||||
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
final headers = getHeader(manga.baseUrl);
|
||||||
|
|
||||||
final urll =
|
final urll = "${manga.apiUrl}${manga.link.replaceAll("#", '')}?tachiyomi=true";
|
||||||
"${manga.apiUrl}${manga.link.replaceAll("#", '')}?tachiyomi=true";
|
|
||||||
final data = {"url": urll, "headers": headers};
|
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) {
|
if (res.isEmpty) {
|
||||||
return manga;
|
return manga;
|
||||||
}
|
}
|
||||||
manga.author = MBridge.jsonPathToString(res, r'$.authors[*].name', '');
|
manga.author = MBridge.jsonPathToString(res, r'$.authors[*].name', '');
|
||||||
manga.genre =
|
manga.genre = MBridge.jsonPathToString(res, r'$.genres[*].name', "_.").split("_.");
|
||||||
MBridge.jsonPathToString(res, r'$.genres[*].name', "_.").split("_.");
|
|
||||||
manga.description = MBridge.jsonPathToString(res, r'$..desc', '');
|
manga.description = MBridge.jsonPathToString(res, r'$..desc', '');
|
||||||
manga.status = MBridge.parseStatus(
|
manga.status = MBridge.parseStatus(MBridge.jsonPathToString(res, r'$..comic.status', ''), statusList);
|
||||||
MBridge.jsonPathToString(res, r'$..comic.status', ''), statusList);
|
|
||||||
final chapUrlReq =
|
final chapUrlReq =
|
||||||
"${manga.apiUrl}${manga.link.replaceAll("#", '')}chapters?lang=${manga.lang}&tachiyomi=true&page=1";
|
"${manga.apiUrl}${manga.link.replaceAll("#", '')}chapters?lang=${manga.lang}&tachiyomi=true&page=1";
|
||||||
final dataReq = {"url": chapUrlReq, "headers": headers};
|
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', '');
|
var total = MBridge.jsonPathToString(request, r'$.total', '');
|
||||||
final chapterLimit = MBridge.intParse("$total");
|
final chapterLimit = MBridge.intParse("$total");
|
||||||
final newChapUrlReq =
|
final newChapUrlReq =
|
||||||
"${manga.apiUrl}${manga.link.replaceAll("#", '')}chapters?limit=$chapterLimit&lang=${manga.lang}&tachiyomi=true&page=1";
|
"${manga.apiUrl}${manga.link.replaceAll("#", '')}chapters?limit=$chapterLimit&lang=${manga.lang}&tachiyomi=true&page=1";
|
||||||
|
|
||||||
final newDataReq = {"url": newChapUrlReq, "headers": headers};
|
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', "_.")
|
manga.urls = MBridge.jsonPathToString(newRequest, r'$.chapters[*].hid', "_.").split("_.");
|
||||||
.split("_.");
|
final chapDate = MBridge.jsonPathToString(newRequest, r'$.chapters[*].created_at', "_.").split("_.");
|
||||||
final chapDate =
|
manga.chaptersDateUploads =MBridge.listParseDateTime(chapDate, "yyyy-MM-dd'T'HH:mm:ss'Z'", "en");
|
||||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].created_at', "_.")
|
manga.chaptersVolumes = MBridge.jsonPathToString(newRequest, r'$.chapters[*].vol', "_.").split("_.");
|
||||||
.split("_.");
|
manga.chaptersScanlators = MBridge.jsonPathToString(newRequest, r'$.chapters[*].group_name', "_.").split("_.");
|
||||||
manga.chaptersDateUploads = MBridge.listParse(
|
manga.names = MBridge.jsonPathToString(newRequest, r'$.chapters[*].title', "_.").split("_.");
|
||||||
MBridge.listParseDateTime(chapDate, "yyyy-MM-dd'T'HH:mm:ss'Z'", "en"), 0);
|
manga.chaptersChaps = MBridge.jsonPathToString(newRequest, r'$.chapters[*].chap', "_.").split("_.");
|
||||||
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;
|
return manga;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPopularManga(MangaModel manga) async {
|
getPopularManga(MangaModel manga) async {
|
||||||
final urll =
|
final urll = "${manga.apiUrl}/v1.0/search?sort=follow&page=${manga.page}&tachiyomi=true";
|
||||||
"${manga.apiUrl}/v1.0/search?sort=follow&page=${manga.page}&tachiyomi=true";
|
|
||||||
final data = {"url": urll, "headers": getHeader(manga.baseUrl)};
|
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) {
|
if (res.isEmpty) {
|
||||||
return manga;
|
return manga;
|
||||||
}
|
}
|
||||||
@@ -102,7 +86,7 @@ getPopularManga(MangaModel manga) async {
|
|||||||
searchManga(MangaModel manga) async {
|
searchManga(MangaModel manga) async {
|
||||||
final urll = "${manga.apiUrl}/v1.0/search?q=${manga.query}&tachiyomi=true";
|
final urll = "${manga.apiUrl}/v1.0/search?q=${manga.query}&tachiyomi=true";
|
||||||
final data = {"url": urll, "headers": getHeader(manga.baseUrl)};
|
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) {
|
if (res.isEmpty) {
|
||||||
return manga;
|
return manga;
|
||||||
}
|
}
|
||||||
@@ -120,19 +104,17 @@ searchManga(MangaModel manga) async {
|
|||||||
getChapterUrl(MangaModel manga) async {
|
getChapterUrl(MangaModel manga) async {
|
||||||
final url = "${manga.apiUrl}/chapter/${manga.link}?tachiyomi=true";
|
final url = "${manga.apiUrl}/chapter/${manga.link}?tachiyomi=true";
|
||||||
final data = {"url": url, "headers": getHeader(url)};
|
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) {
|
if (res.isEmpty) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return MBridge.jsonPathToString(res, r'$.chapter.images[*].url', '_.')
|
return MBridge.jsonPathToString(res, r'$.chapter.images[*].url', '_.').split('_.');
|
||||||
.split('_.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> getHeader(String url) {
|
Map<String, String> getHeader(String url) {
|
||||||
final headers = {
|
final headers = {
|
||||||
"Referer": "$url/",
|
"Referer": "$url/",
|
||||||
'User-Agent':
|
'User-Agent': "Tachiyomi Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:110.0) Gecko/20100101 Firefox/110.0"
|
||||||
"Tachiyomi Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:110.0) Gecko/20100101 Firefox/110.0"
|
|
||||||
};
|
};
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ getPopularManga(MangaModel manga) async {
|
|||||||
final url =
|
final url =
|
||||||
"https://api.mangadex.org/manga?limit=20&offset=$page&availableTranslatedLanguage[]=en&includes[]=cover_art${getMDXContentRating()}&order[followedCount]=desc";
|
"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 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) {
|
if (res.isEmpty) {
|
||||||
return manga;
|
return manga;
|
||||||
}
|
}
|
||||||
@@ -51,12 +51,12 @@ MangaModel getChapters(
|
|||||||
r'$.relationships[?@.id!="00e03853-1b96-4f41-9542-c71b8692033b"]', 0);
|
r'$.relationships[?@.id!="00e03853-1b96-4f41-9542-c71b8692033b"]', 0);
|
||||||
String chapName = "".toString();
|
String chapName = "".toString();
|
||||||
for (var element in groups) {
|
for (var element in groups) {
|
||||||
final data = MBridge.getMapValue(element, "attributes", 1);
|
final data = MBridge.getMapValue(element, "attributes", encode: true);
|
||||||
if (data.isEmpty) {
|
if (data.isEmpty) {
|
||||||
} else {
|
} else {
|
||||||
final name = MBridge.getMapValue(data, "name", 0);
|
final name = MBridge.getMapValue(data, "name");
|
||||||
scan += "$name".toString();
|
scan += "$name".toString();
|
||||||
final username = MBridge.getMapValue(data, "username", 0);
|
final username = MBridge.getMapValue(data, "username");
|
||||||
if (username.isEmpty) {
|
if (username.isEmpty) {
|
||||||
} else {
|
} else {
|
||||||
if (scan.isEmpty) {
|
if (scan.isEmpty) {
|
||||||
@@ -68,11 +68,11 @@ MangaModel getChapters(
|
|||||||
if (scan.isEmpty) {
|
if (scan.isEmpty) {
|
||||||
scan = "No Group".toString();
|
scan = "No Group".toString();
|
||||||
}
|
}
|
||||||
final dataRes = MBridge.getMapValue(res, "attributes", 1);
|
final dataRes = MBridge.getMapValue(res, "attributes", encode: true);
|
||||||
if (dataRes.isEmpty) {
|
if (dataRes.isEmpty) {
|
||||||
} else {
|
} else {
|
||||||
final data = MBridge.getMapValue(res, "attributes", 1);
|
final data = MBridge.getMapValue(res, "attributes", encode: true);
|
||||||
final volume = MBridge.getMapValue(data, "volume", 0);
|
final volume = MBridge.getMapValue(data, "volume");
|
||||||
if (volume.isEmpty) {
|
if (volume.isEmpty) {
|
||||||
} else {
|
} else {
|
||||||
if (volume == "null") {
|
if (volume == "null") {
|
||||||
@@ -80,7 +80,7 @@ MangaModel getChapters(
|
|||||||
chapName = "Vol.$volume ".toString();
|
chapName = "Vol.$volume ".toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final chapter = MBridge.getMapValue(data, "chapter", 0);
|
final chapter = MBridge.getMapValue(data, "chapter");
|
||||||
if (chapter.isEmpty) {
|
if (chapter.isEmpty) {
|
||||||
} else {
|
} else {
|
||||||
if (chapter == "null") {
|
if (chapter == "null") {
|
||||||
@@ -88,7 +88,7 @@ MangaModel getChapters(
|
|||||||
chapName += "Ch.$chapter ".toString();
|
chapName += "Ch.$chapter ".toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final title = MBridge.getMapValue(data, "title", 0);
|
final title = MBridge.getMapValue(data, "title");
|
||||||
if (title.isEmpty) {
|
if (title.isEmpty) {
|
||||||
} else {
|
} else {
|
||||||
if (title == "null") {
|
if (title == "null") {
|
||||||
@@ -103,8 +103,8 @@ MangaModel getChapters(
|
|||||||
if (chapName.isEmpty) {
|
if (chapName.isEmpty) {
|
||||||
chapName += "Oneshot".toString();
|
chapName += "Oneshot".toString();
|
||||||
}
|
}
|
||||||
final date = MBridge.getMapValue(data, "publishAt", 0);
|
final date = MBridge.getMapValue(data, "publishAt");
|
||||||
final id = MBridge.getMapValue(res, "id", 0);
|
final id = MBridge.getMapValue(res, "id");
|
||||||
chapterUrl += "._$id";
|
chapterUrl += "._$id";
|
||||||
chapDate += "._._$date";
|
chapDate += "._._$date";
|
||||||
scanlators += "._$scan";
|
scanlators += "._$scan";
|
||||||
@@ -132,7 +132,7 @@ getMangaDetail(MangaModel manga) async {
|
|||||||
final url =
|
final url =
|
||||||
"https://api.mangadex.org${manga.link}?includes[]=cover_art&includes[]=author&includes[]=artist";
|
"https://api.mangadex.org${manga.link}?includes[]=cover_art&includes[]=author&includes[]=artist";
|
||||||
final datas = {"url": url, "headers": null};
|
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) {
|
if (res.isEmpty) {
|
||||||
return manga;
|
return manga;
|
||||||
}
|
}
|
||||||
@@ -254,7 +254,7 @@ getLatestUpdatesManga(MangaModel manga) async {
|
|||||||
final urll =
|
final urll =
|
||||||
"https://api.mangadex.org/chapter?limit=20&offset=$page&translatedLanguage[]=${manga.lang}&includeFutureUpdates=0&order[publishAt]=desc&includeFuturePublishAt=0&includeEmptyPages=0";
|
"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 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) {
|
if (ress.isEmpty) {
|
||||||
return manga;
|
return manga;
|
||||||
}
|
}
|
||||||
@@ -269,7 +269,7 @@ getLatestUpdatesManga(MangaModel manga) async {
|
|||||||
final newUrl =
|
final newUrl =
|
||||||
"https://api.mangadex.org/manga?includes[]=cover_art&limit=${mangaIds.length}${getMDXContentRating()}$mangaa";
|
"https://api.mangadex.org/manga?includes[]=cover_art&limit=${mangaIds.length}${getMDXContentRating()}$mangaa";
|
||||||
final datass = {"url": newUrl, "headers": null};
|
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(
|
List<String> data = MBridge.listParse(
|
||||||
MBridge.jsonPathToString(res, r'$.data[*]', '_.').split("_."), 0);
|
MBridge.jsonPathToString(res, r'$.data[*]', '_.').split("_."), 0);
|
||||||
List<String> urlList = [];
|
List<String> urlList = [];
|
||||||
@@ -293,7 +293,7 @@ searchManga(MangaModel manga) async {
|
|||||||
final url =
|
final url =
|
||||||
"https://api.mangadex.org/manga?includes[]=cover_art&offset=0&limit=20&title=${manga.query}${getMDXContentRating()}&order[followedCount]=desc&availableTranslatedLanguage[]=${manga.lang}";
|
"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 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) {
|
if (res.isEmpty) {
|
||||||
return manga;
|
return manga;
|
||||||
}
|
}
|
||||||
@@ -319,7 +319,7 @@ searchManga(MangaModel manga) async {
|
|||||||
getChapterUrl(MangaModel manga) async {
|
getChapterUrl(MangaModel manga) async {
|
||||||
final url = "https://api.mangadex.org/at-home/server/${manga.link}";
|
final url = "https://api.mangadex.org/at-home/server/${manga.link}";
|
||||||
final data = {"url": url, "headers": null};
|
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) {
|
if (res.isEmpty) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -345,7 +345,7 @@ Future<String> paginatedChapterListRequest(
|
|||||||
final url =
|
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()}';
|
'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};
|
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) {
|
String findTitle(String dataRes, int mangaIndex, String lang) {
|
||||||
@@ -1,210 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
searchManga(MangaModel manga) async {
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
final url = "${manga.baseUrl}/search?title=${manga.query}&page=${manga.page}";
|
|
||||||
|
|
||||||
final data = {"url": url, "headers": headers};
|
|
||||||
final res = await MBridge.http(json.encode(data), 1);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
manga.names = MBridge.xpath(
|
|
||||||
res, '//*[contains(@class, "manga-list-4-list")]/li/a/@title', '-.')
|
|
||||||
.split('-.');
|
|
||||||
manga.images = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[contains(@class, "manga-list-4-list")]/li/a/img[@class="manga-list-4-cover"]/@src',
|
|
||||||
'-.')
|
|
||||||
.split('-.');
|
|
||||||
manga.urls = MBridge.xpath(
|
|
||||||
res, '//*[contains(@class, "manga-list-4-list")]/li/a/@href', '-.')
|
|
||||||
.split('-.');
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesManga(MangaModel manga) async {
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
final url = "${manga.baseUrl}/directory/${manga.page}.htm?latest";
|
|
||||||
|
|
||||||
final data = {"url": url, "headers": headers};
|
|
||||||
final res = await MBridge.http(json.encode(data), 1);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
manga.names = MBridge.xpath(
|
|
||||||
res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@title', '-.')
|
|
||||||
.split('-.');
|
|
||||||
manga.images = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[ contains(@class, "manga-list-1-list")]/li/a/img[@class="manga-list-1-cover"]/@src',
|
|
||||||
'-.')
|
|
||||||
.split('-.');
|
|
||||||
manga.urls = MBridge.xpath(
|
|
||||||
res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@href', '-.')
|
|
||||||
.split('-.');
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getMangaDetail(MangaModel manga) async {
|
|
||||||
final statusList = [
|
|
||||||
{
|
|
||||||
"Ongoing": 0,
|
|
||||||
"Completed": 1,
|
|
||||||
}
|
|
||||||
];
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
final url = "${manga.baseUrl}/${manga.link}";
|
|
||||||
final data = {"url": url, "headers": headers};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
manga.author =
|
|
||||||
MBridge.xpath(res, '//*[@class="detail-info-right-say"]/a/text()', '');
|
|
||||||
manga.description =
|
|
||||||
MBridge.xpath(res, '//*[@class="fullcontent"]/text()', '');
|
|
||||||
final status = MBridge.xpath(
|
|
||||||
res, '//*[@class="detail-info-right-title-tip"]/text()', '');
|
|
||||||
manga.status = MBridge.parseStatus(status, statusList);
|
|
||||||
manga.genre = MBridge.xpath(
|
|
||||||
res, '//*[@class="detail-info-right-tag-list"]/a/text()', '._')
|
|
||||||
.split("._");
|
|
||||||
manga.urls =
|
|
||||||
MBridge.xpath(res, '//*[@class="detail-main-list"]/li/a/@href', '._')
|
|
||||||
.split("._");
|
|
||||||
manga.names = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="detail-main-list"]/li/a/div/p[@class="title3"]/text()',
|
|
||||||
'._')
|
|
||||||
.split("._");
|
|
||||||
final chapterDates = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="detail-main-list"]/li/a/div/p[@class="title2"]/text()',
|
|
||||||
'._')
|
|
||||||
.split("._");
|
|
||||||
|
|
||||||
manga.chaptersDateUploads = MBridge.listParse(
|
|
||||||
MBridge.listParseDateTime(
|
|
||||||
chapterDates, manga.dateFormat, manga.dateFormatLocale),
|
|
||||||
0);
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getPopularManga(MangaModel manga) async {
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
final url = "${manga.baseUrl}/directory/${manga.page}.htm";
|
|
||||||
|
|
||||||
final data = {"url": url, "headers": headers};
|
|
||||||
final res = await MBridge.http(json.encode(data), 1);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
manga.names = MBridge.xpath(
|
|
||||||
res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@title', '-.')
|
|
||||||
.split('-.');
|
|
||||||
manga.images = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[ contains(@class, "manga-list-1-list")]/li/a/img[@class="manga-list-1-cover"]/@src',
|
|
||||||
'-.')
|
|
||||||
.split('-.');
|
|
||||||
manga.urls = MBridge.xpath(
|
|
||||||
res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@href', '-.')
|
|
||||||
.split('-.');
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getChapterUrl(MangaModel manga) async {
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
final url = "${manga.baseUrl}${manga.link}";
|
|
||||||
final data = {"url": url, "headers": headers};
|
|
||||||
final res = await MBridge.http(json.encode(data), 0);
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
final pages = MBridge.xpath(res, "//body/div/div/span/a/text()", "._");
|
|
||||||
List<String> pageUrls = [];
|
|
||||||
if (pages.isEmpty) {
|
|
||||||
final script = MBridge.xpath(res,
|
|
||||||
"//script[contains(text(),'function(p,a,c,k,e,d)')]/text()", "")
|
|
||||||
.replaceAll("eval", "");
|
|
||||||
String deobfuscatedScript = MBridge.evalJs(script);
|
|
||||||
int a = deobfuscatedScript.indexOf("newImgs=['") + 10;
|
|
||||||
int b = deobfuscatedScript.indexOf("'];");
|
|
||||||
List<String> urls =
|
|
||||||
MBridge.listParse(deobfuscatedScript.substring(a, b).split("','"), 0);
|
|
||||||
for (var url in urls) {
|
|
||||||
pageUrls.add("https:$url");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
final pagesNumberList = MBridge.listParse(pages.split("._"), 0);
|
|
||||||
//manga.status objext is used to parse pagesNumber value to int
|
|
||||||
manga.status =
|
|
||||||
MBridge.intParse(pagesNumberList[pagesNumberList.length - 2]);
|
|
||||||
int secretKeyScriptLocation = res.indexOf("eval(function(p,a,c,k,e,d)");
|
|
||||||
int secretKeyScriptEndLocation =
|
|
||||||
res.indexOf("</script>", secretKeyScriptLocation);
|
|
||||||
String secretKeyScript = res
|
|
||||||
.substring(secretKeyScriptLocation, secretKeyScriptEndLocation)
|
|
||||||
.replaceAll("eval", "");
|
|
||||||
String secretKeyDeobfuscatedScript = MBridge.evalJs(secretKeyScript);
|
|
||||||
int secretKeyStartLoc = secretKeyDeobfuscatedScript.indexOf("'");
|
|
||||||
int secretKeyEndLoc = secretKeyDeobfuscatedScript.indexOf(";");
|
|
||||||
|
|
||||||
String secretKey = secretKeyDeobfuscatedScript.substring(
|
|
||||||
secretKeyStartLoc, secretKeyEndLoc);
|
|
||||||
int chapterIdStartLoc = res.indexOf("chapterid");
|
|
||||||
String chapterId = res.substring(
|
|
||||||
chapterIdStartLoc + 11, res.indexOf(";", chapterIdStartLoc));
|
|
||||||
String pageBase = url.substring(0, url.lastIndexOf("/"));
|
|
||||||
for (int i = 1; i <= manga.status; i++) {
|
|
||||||
String pageLink =
|
|
||||||
"$pageBase/chapterfun.ashx?cid=$chapterId&page=$i&key=$secretKey";
|
|
||||||
String responseText = MBridge.stringParse("", 0);
|
|
||||||
for (int tr = 1; tr <= 3; tr++) {
|
|
||||||
if (responseText.isEmpty) {
|
|
||||||
final headers = {
|
|
||||||
"Referer": url,
|
|
||||||
"Accept": "*/*",
|
|
||||||
"Accept-Language": "en-US,en;q=0.9",
|
|
||||||
"Connection": "keep-alive",
|
|
||||||
"Host": "www.mangahere.cc",
|
|
||||||
"X-Requested-With": "XMLHttpRequest"
|
|
||||||
};
|
|
||||||
final data = {"url": pageLink, "headers": headers};
|
|
||||||
final response = await MBridge.http(json.encode(data), 0);
|
|
||||||
responseText = MBridge.stringParse(response, 0);
|
|
||||||
|
|
||||||
if (responseText.isEmpty) {
|
|
||||||
secretKey = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String deobfuscatedScript =
|
|
||||||
MBridge.evalJs(responseText.replaceAll("eval", ""));
|
|
||||||
|
|
||||||
int baseLinkStartPos = deobfuscatedScript.indexOf("pix=") + 5;
|
|
||||||
int baseLinkEndPos =
|
|
||||||
deobfuscatedScript.indexOf(";", baseLinkStartPos) - 1;
|
|
||||||
String baseLink =
|
|
||||||
deobfuscatedScript.substring(baseLinkStartPos, baseLinkEndPos);
|
|
||||||
|
|
||||||
int imageLinkStartPos = deobfuscatedScript.indexOf("pvalue=") + 9;
|
|
||||||
int imageLinkEndPos = deobfuscatedScript.indexOf("\"", imageLinkStartPos);
|
|
||||||
String imageLink =
|
|
||||||
deobfuscatedScript.substring(imageLinkStartPos, imageLinkEndPos);
|
|
||||||
pageUrls.add("https:$baseLink$imageLink");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return pageUrls;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, String> getHeader(String url) {
|
|
||||||
final headers = {'Referer': '$url/', "Cookie": "isAdult=1"};
|
|
||||||
return headers;
|
|
||||||
}
|
|
||||||
157
manga/src/en/mangahere/mangahere-v0.0.2.dart
Normal file
157
manga/src/en/mangahere/mangahere-v0.0.2.dart
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'package:bridge_lib/bridge_lib.dart';
|
||||||
|
|
||||||
|
searchManga(MangaModel manga) async {
|
||||||
|
final headers = getHeader(manga.baseUrl);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
manga.names = MBridge.xpath(res, '//*[contains(@class, "manga-list-4-list")]/li/a/@title');
|
||||||
|
manga.images =
|
||||||
|
MBridge.xpath(res, '//*[contains(@class, "manga-list-4-list")]/li/a/img[@class="manga-list-4-cover"]/@src');
|
||||||
|
manga.urls = MBridge.xpath(res, '//*[contains(@class, "manga-list-4-list")]/li/a/@href');
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
getLatestUpdatesManga(MangaModel manga) async {
|
||||||
|
final headers = getHeader(manga.baseUrl);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
manga.names = MBridge.xpath(res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@title');
|
||||||
|
manga.images =
|
||||||
|
MBridge.xpath(res, '//*[ contains(@class, "manga-list-1-list")]/li/a/img[@class="manga-list-1-cover"]/@src');
|
||||||
|
manga.urls = MBridge.xpath(res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@href');
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
getMangaDetail(MangaModel manga) async {
|
||||||
|
final statusList = [
|
||||||
|
{
|
||||||
|
"Ongoing": 0,
|
||||||
|
"Completed": 1,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
manga.author = MBridge.xpath(res, '//*[@class="detail-info-right-say"]/a/text()').first;
|
||||||
|
manga.description = MBridge.xpath(res, '//*[@class="fullcontent"]/text()').first;
|
||||||
|
final status = MBridge.xpath(res, '//*[@class="detail-info-right-title-tip"]/text()').first;
|
||||||
|
manga.status = MBridge.parseStatus(status, statusList);
|
||||||
|
manga.genre = MBridge.xpath(res, '//*[@class="detail-info-right-tag-list"]/a/text()');
|
||||||
|
manga.urls = MBridge.xpath(res, '//*[@class="detail-main-list"]/li/a/@href');
|
||||||
|
manga.names = MBridge.xpath(res, '//*[@class="detail-main-list"]/li/a/div/p[@class="title3"]/text()');
|
||||||
|
final chapterDates = MBridge.xpath(res, '//*[@class="detail-main-list"]/li/a/div/p[@class="title2"]/text()');
|
||||||
|
|
||||||
|
manga.chaptersDateUploads = MBridge.listParseDateTime(chapterDates, manga.dateFormat, manga.dateFormatLocale);
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
getPopularManga(MangaModel manga) async {
|
||||||
|
final headers = getHeader(manga.baseUrl);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
manga.names = MBridge.xpath(res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@title');
|
||||||
|
manga.images =
|
||||||
|
MBridge.xpath(res, '//*[ contains(@class, "manga-list-1-list")]/li/a/img[@class="manga-list-1-cover"]/@src');
|
||||||
|
manga.urls = MBridge.xpath(res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@href');
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
getChapterUrl(MangaModel 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 pages = MBridge.xpath(res, "//body/div/div/span/a/text()");
|
||||||
|
List<String> pageUrls = [];
|
||||||
|
if (pages.isEmpty) {
|
||||||
|
final script =
|
||||||
|
MBridge.xpath(res, "//script[contains(text(),'function(p,a,c,k,e,d)')]/text()").first.replaceAll("eval", "");
|
||||||
|
String deobfuscatedScript = MBridge.evalJs(script);
|
||||||
|
int a = deobfuscatedScript.indexOf("newImgs=['") + 10;
|
||||||
|
int b = deobfuscatedScript.indexOf("'];");
|
||||||
|
List<String> urls = MBridge.listParse(deobfuscatedScript.substring(a, b).split("','"), 0);
|
||||||
|
for (var url in urls) {
|
||||||
|
pageUrls.add("https:$url");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final pagesNumberList = pages;
|
||||||
|
int pagesNumber = MBridge.intParse(pagesNumberList[pagesNumberList.length - 2]);
|
||||||
|
int secretKeyScriptLocation = res.indexOf("eval(function(p,a,c,k,e,d)");
|
||||||
|
int secretKeyScriptEndLocation = res.indexOf("</script>", secretKeyScriptLocation);
|
||||||
|
String secretKeyScript = res.substring(secretKeyScriptLocation, secretKeyScriptEndLocation).replaceAll("eval", "");
|
||||||
|
String secretKeyDeobfuscatedScript = MBridge.evalJs(secretKeyScript);
|
||||||
|
int secretKeyStartLoc = secretKeyDeobfuscatedScript.indexOf("'");
|
||||||
|
int secretKeyEndLoc = secretKeyDeobfuscatedScript.indexOf(";");
|
||||||
|
|
||||||
|
String secretKey = secretKeyDeobfuscatedScript.substring(secretKeyStartLoc, secretKeyEndLoc);
|
||||||
|
int chapterIdStartLoc = res.indexOf("chapterid");
|
||||||
|
String chapterId = res.substring(chapterIdStartLoc + 11, res.indexOf(";", chapterIdStartLoc));
|
||||||
|
String pageBase = url.substring(0, url.lastIndexOf("/"));
|
||||||
|
for (int i = 1; i <= pagesNumber; i++) {
|
||||||
|
String pageLink = "$pageBase/chapterfun.ashx?cid=$chapterId&page=$i&key=$secretKey";
|
||||||
|
String responseText = MBridge.stringParse("", 0);
|
||||||
|
for (int tr = 1; tr <= 3; tr++) {
|
||||||
|
if (responseText.isEmpty) {
|
||||||
|
final headers = {
|
||||||
|
"Referer": url,
|
||||||
|
"Accept": "*/*",
|
||||||
|
"Accept-Language": "en-US,en;q=0.9",
|
||||||
|
"Connection": "keep-alive",
|
||||||
|
"Host": "www.mangahere.cc",
|
||||||
|
"X-Requested-With": "XMLHttpRequest"
|
||||||
|
};
|
||||||
|
final data = {"url": pageLink, "headers": headers};
|
||||||
|
final response = await MBridge.http('GET', json.encode(data));
|
||||||
|
responseText = MBridge.stringParse(response, 0);
|
||||||
|
|
||||||
|
if (responseText.isEmpty) {
|
||||||
|
secretKey = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String deobfuscatedScript = MBridge.evalJs(responseText.replaceAll("eval", ""));
|
||||||
|
|
||||||
|
int baseLinkStartPos = deobfuscatedScript.indexOf("pix=") + 5;
|
||||||
|
int baseLinkEndPos = deobfuscatedScript.indexOf(";", baseLinkStartPos) - 1;
|
||||||
|
String baseLink = deobfuscatedScript.substring(baseLinkStartPos, baseLinkEndPos);
|
||||||
|
|
||||||
|
int imageLinkStartPos = deobfuscatedScript.indexOf("pvalue=") + 9;
|
||||||
|
int imageLinkEndPos = deobfuscatedScript.indexOf("\"", imageLinkStartPos);
|
||||||
|
String imageLink = deobfuscatedScript.substring(imageLinkStartPos, imageLinkEndPos);
|
||||||
|
pageUrls.add("https:$baseLink$imageLink");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pageUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> getHeader(String url) {
|
||||||
|
final headers = {'Referer': '$url/', "Cookie": "isAdult=1"};
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
@@ -47,7 +47,7 @@ class Source {
|
|||||||
this.version = "",
|
this.version = "",
|
||||||
this.isManga = true,
|
this.isManga = true,
|
||||||
this.isFullData = false,
|
this.isFullData = false,
|
||||||
this.appMinVerReq = "0.0.21"});
|
this.appMinVerReq = "0.0.5"});
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user