mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
28
anime/multisrc/zorotheme/sources.dart
Normal file
28
anime/multisrc/zorotheme/sources.dart
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import '../../../model/source.dart';
|
||||||
|
import '../../../utils/utils.dart';
|
||||||
|
|
||||||
|
const zorothemeVersion = "0.0.4";
|
||||||
|
const zorothemeSourceCodeUrl =
|
||||||
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/multisrc/zorotheme/zorotheme-v$zorothemeVersion.dart";
|
||||||
|
|
||||||
|
List<Source> get zorothemeSourcesList => _zorothemeSourcesList;
|
||||||
|
List<Source> _zorothemeSourcesList = [
|
||||||
|
Source(
|
||||||
|
name: "AniWatch.to",
|
||||||
|
baseUrl: "https://aniwatch.to",
|
||||||
|
lang: "en",
|
||||||
|
typeSource: "zorotheme",
|
||||||
|
iconUrl: getIconUrl("aniwatch", "en"),
|
||||||
|
version: zorothemeVersion,
|
||||||
|
isManga: false,
|
||||||
|
sourceCodeUrl: zorothemeSourceCodeUrl),
|
||||||
|
Source(
|
||||||
|
name: "Kaido.to",
|
||||||
|
baseUrl: "https://kaido.to",
|
||||||
|
lang: "en",
|
||||||
|
typeSource: "zorotheme",
|
||||||
|
iconUrl: getIconUrl("kaido", "en"),
|
||||||
|
version: zorothemeVersion,
|
||||||
|
isManga: false,
|
||||||
|
sourceCodeUrl: zorothemeSourceCodeUrl),
|
||||||
|
];
|
||||||
200
anime/multisrc/zorotheme/zorotheme-v0.0.4.dart
Normal file
200
anime/multisrc/zorotheme/zorotheme-v0.0.4.dart
Normal file
@@ -0,0 +1,200 @@
|
|||||||
|
import 'package:mangayomi/bridge_lib.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class ZoroTheme extends MProvider {
|
||||||
|
ZoroTheme();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getPopular(MSource source, int page) async {
|
||||||
|
final data = {"url": "${source.baseUrl}/most-popular?page=$page"};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
return animeElementM(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||||
|
final data = {"url": "${source.baseUrl}/recently-updated?page=$page"};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
return animeElementM(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> search(MSource source, String query, int page) async {
|
||||||
|
final data = {"url": "${source.baseUrl}/search?keyword=$query&page=$page"};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
return animeElementM(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MManga> getDetail(MSource source, String url) async {
|
||||||
|
final statusList = [
|
||||||
|
{
|
||||||
|
"Currently Airing": 0,
|
||||||
|
"Finished Airing": 1,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
final data = {"url": "${source.baseUrl}$url"};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
MManga anime = MManga();
|
||||||
|
final status = xpath(res,
|
||||||
|
'//*[@class="anisc-info"]/div[contains(text(),"Status:")]/span[2]/text()')
|
||||||
|
.first;
|
||||||
|
|
||||||
|
anime.status = parseStatus(status, statusList);
|
||||||
|
anime.author = xpath(res,
|
||||||
|
'//*[@class="anisc-info"]/div[contains(text(),"Studios:")]/span/text()')
|
||||||
|
.first
|
||||||
|
.replaceAll("Studios:", "");
|
||||||
|
anime.description = xpath(res,
|
||||||
|
'//*[@class="anisc-info"]/div[contains(text(),"Overview:")]/text()')
|
||||||
|
.first
|
||||||
|
.replaceAll("Overview:", "");
|
||||||
|
final genre = xpath(res,
|
||||||
|
'//*[@class="anisc-info"]/div[contains(text(),"Genres:")]/a/text()');
|
||||||
|
|
||||||
|
anime.genre = genre;
|
||||||
|
final id = substringAfterLast(url, '-');
|
||||||
|
|
||||||
|
final urlEp =
|
||||||
|
"${source.baseUrl}/ajax${ajaxRoute('${source.baseUrl}')}/episode/list/$id";
|
||||||
|
|
||||||
|
final dataEp = {
|
||||||
|
"url": urlEp,
|
||||||
|
"headers": {"referer": url}
|
||||||
|
};
|
||||||
|
final resEp = await http('GET', json.encode(dataEp));
|
||||||
|
|
||||||
|
final html = json.decode(resEp)["html"];
|
||||||
|
|
||||||
|
final epUrls = querySelectorAll(html,
|
||||||
|
selector: "a.ep-item",
|
||||||
|
typeElement: 3,
|
||||||
|
attributes: "href",
|
||||||
|
typeRegExp: 0);
|
||||||
|
final numbers = querySelectorAll(html,
|
||||||
|
selector: "a.ep-item",
|
||||||
|
typeElement: 3,
|
||||||
|
attributes: "data-number",
|
||||||
|
typeRegExp: 0);
|
||||||
|
|
||||||
|
final titles = 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");
|
||||||
|
}
|
||||||
|
List<MChapter>? episodesList = [];
|
||||||
|
for (var i = 0; i < episodes.length; i++) {
|
||||||
|
MChapter episode = MChapter();
|
||||||
|
episode.name = episodes[i];
|
||||||
|
episode.url = epUrls[i];
|
||||||
|
episodesList.add(episode);
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.chapters = episodesList;
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<MVideo>> getVideoList(MSource source, String url) async {
|
||||||
|
final id = substringAfterLast(url, '?ep=');
|
||||||
|
|
||||||
|
final datas = {
|
||||||
|
"url":
|
||||||
|
"${source.baseUrl}/ajax${ajaxRoute('${source.baseUrl}')}/episode/servers?episodeId=$id",
|
||||||
|
"headers": {"referer": "${source.baseUrl}/$url"}
|
||||||
|
};
|
||||||
|
final res = await http('GET', json.encode(datas));
|
||||||
|
final html = json.decode(res)["html"];
|
||||||
|
|
||||||
|
final names = querySelectorAll(html,
|
||||||
|
selector: "div.server-item",
|
||||||
|
typeElement: 0,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0);
|
||||||
|
|
||||||
|
final ids = querySelectorAll(html,
|
||||||
|
selector: "div.server-item",
|
||||||
|
typeElement: 3,
|
||||||
|
attributes: "data-id",
|
||||||
|
typeRegExp: 0);
|
||||||
|
|
||||||
|
final subDubs = querySelectorAll(html,
|
||||||
|
selector: "div.server-item",
|
||||||
|
typeElement: 3,
|
||||||
|
attributes: "data-type",
|
||||||
|
typeRegExp: 0);
|
||||||
|
|
||||||
|
List<MVideo> videos = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
final name = names[i];
|
||||||
|
final id = ids[i];
|
||||||
|
final subDub = subDubs[i];
|
||||||
|
final datasE = {
|
||||||
|
"url":
|
||||||
|
"${source.baseUrl}/ajax${ajaxRoute('${source.baseUrl}')}/episode/sources?id=$id",
|
||||||
|
"headers": {"referer": "${source.baseUrl}/$url"}
|
||||||
|
};
|
||||||
|
|
||||||
|
final resE = await http('GET', json.encode(datasE));
|
||||||
|
String epUrl = substringBefore(substringAfter(resE, "\"link\":\""), "\"");
|
||||||
|
print(epUrl);
|
||||||
|
List<MVideo> a = [];
|
||||||
|
if (name.contains("Vidstreaming")) {
|
||||||
|
a = await rapidCloudExtractor(epUrl, "Vidstreaming - $subDub");
|
||||||
|
} else if (name.contains("Vidcloud")) {
|
||||||
|
a = await rapidCloudExtractor(epUrl, "Vidcloud - $subDub");
|
||||||
|
} else if (name.contains("StreamTape")) {
|
||||||
|
a = await streamTapeExtractor(epUrl, "StreamTape - $subDub");
|
||||||
|
}
|
||||||
|
videos.addAll(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
return videos;
|
||||||
|
}
|
||||||
|
|
||||||
|
MPages animeElementM(String res) {
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
|
||||||
|
final urls = xpath(
|
||||||
|
res, '//*[@class^="flw-item"]/div[@class="film-detail"]/h3/a/@href');
|
||||||
|
|
||||||
|
final names = xpath(res,
|
||||||
|
'//*[@class^="flw-item"]/div[@class="film-detail"]/h3/a/@data-jname');
|
||||||
|
|
||||||
|
final images = xpath(
|
||||||
|
res, '//*[@class^="flw-item"]/div[@class="film-poster"]/img/@data-src');
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.name = names[i];
|
||||||
|
anime.imageUrl = images[i];
|
||||||
|
anime.link = urls[i];
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
final nextPage =
|
||||||
|
xpath(res, '//li[@class="page-item"]/a[@title="Next"]/@href', "");
|
||||||
|
return MPages(animeList, !nextPage.isEmpty);
|
||||||
|
}
|
||||||
|
|
||||||
|
String ajaxRoute(String baseUrl) {
|
||||||
|
if (baseUrl == "https://kaido.to") {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return "/v2";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ZoroTheme main() {
|
||||||
|
return ZoroTheme();
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ import 'dart:convert';
|
|||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import '../model/source.dart';
|
import '../model/source.dart';
|
||||||
|
import 'multisrc/zorotheme/sources.dart';
|
||||||
import 'src/ar/okanime/source.dart';
|
import 'src/ar/okanime/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';
|
||||||
@@ -16,7 +17,7 @@ void main() {
|
|||||||
franimeSource,
|
franimeSource,
|
||||||
otakufr,
|
otakufr,
|
||||||
animesultraSource,
|
animesultraSource,
|
||||||
...aniwatchSourcesList,
|
...zorothemeSourcesList,
|
||||||
kisskhSource,
|
kisskhSource,
|
||||||
okanimeSource
|
okanimeSource
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,169 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
getPopularAnime(MManga anime) async {
|
|
||||||
final data = {"url": "https://www.okanime.xyz"};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
anime.urls = MBridge.xpath(res,
|
|
||||||
'//div[@class="section" and contains(text(),"افضل انميات")]/div[@class="section-content"]/div/div/div[contains(@class,"anime-card")]/div[@class="anime-title")]/h4/a/@href');
|
|
||||||
|
|
||||||
anime.names = MBridge.xpath(res,
|
|
||||||
'//div[@class="section" and contains(text(),"افضل انميات")]/div[@class="section-content"]/div/div/div[contains(@class,"anime-card")]/div[@class="anime-title")]/h4/a/text()');
|
|
||||||
|
|
||||||
anime.images = MBridge.xpath(res,
|
|
||||||
'//div[@class="section" and contains(text(),"افضل انميات")]/div[@class="section-content"]/div/div/div[contains(@class,"anime-card")]/div[@class="anime-image")]/img/@src');
|
|
||||||
anime.hasNextPage = false;
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getAnimeDetail(MManga anime) async {
|
|
||||||
final statusList = [
|
|
||||||
{"يعرض الان": 0, "مكتمل": 1}
|
|
||||||
];
|
|
||||||
final data = {"url": anime.link};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
|
|
||||||
final status = MBridge.xpath(res,
|
|
||||||
'//*[@class="full-list-info" and contains(text(),"حالة الأنمي")]/small/a/text()');
|
|
||||||
if (status.isNotEmpty) {
|
|
||||||
anime.status = MBridge.parseStatus(status.first, statusList);
|
|
||||||
}
|
|
||||||
anime.description =
|
|
||||||
MBridge.xpath(res, '//*[@class="review-content"]/text()').first;
|
|
||||||
final genre = MBridge.xpath(res, '//*[@class="review-author-info"]/a/text()');
|
|
||||||
anime.genre = genre;
|
|
||||||
|
|
||||||
anime.urls = MBridge.xpath(res,
|
|
||||||
'//*[contains(@class,"anime-card")]/div[@class="anime-title")]/h5/a/@href')
|
|
||||||
.reversed
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
anime.names = MBridge.xpath(res,
|
|
||||||
'//*[contains(@class,"anime-card")]/div[@class="anime-title")]/h5/a/text()')
|
|
||||||
.reversed
|
|
||||||
.toList();
|
|
||||||
anime.chaptersDateUploads = [];
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesAnime(MManga anime) async {
|
|
||||||
final data = {
|
|
||||||
"url": "https://www.okanime.xyz/espisode-list?page=${anime.page}"
|
|
||||||
};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
anime.urls = MBridge.xpath(res,
|
|
||||||
'//*[contains(@class,"anime-card")]/div[@class="anime-title")]/h4/a/@href');
|
|
||||||
|
|
||||||
anime.names = MBridge.xpath(res,
|
|
||||||
'//*[contains(@class,"anime-card")]/div[@class="anime-title")]/h4/a/text()');
|
|
||||||
|
|
||||||
anime.images = MBridge.xpath(res,
|
|
||||||
'//*[contains(@class,"anime-card")]/div[@class="episode-image")]/img/@src');
|
|
||||||
final nextPage =
|
|
||||||
MBridge.xpath(res, '//li[@class="page-item"]/a[@rel="next"]/@href');
|
|
||||||
if (nextPage.isEmpty) {
|
|
||||||
anime.hasNextPage = false;
|
|
||||||
} else {
|
|
||||||
anime.hasNextPage = true;
|
|
||||||
}
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
searchAnime(MManga anime) async {
|
|
||||||
String url = "https://www.okanime.xyz/search/?s=${anime.query}";
|
|
||||||
if (anime.page > 1) {
|
|
||||||
url += "&page=${anime.page}";
|
|
||||||
}
|
|
||||||
final data = {"url": url};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
anime.urls = MBridge.xpath(res,
|
|
||||||
'//*[contains(@class,"anime-card")]/div[@class="anime-title")]/h4/a/@href');
|
|
||||||
|
|
||||||
anime.names = MBridge.xpath(res,
|
|
||||||
'//*[contains(@class,"anime-card")]/div[@class="anime-title")]/h4/a/text()');
|
|
||||||
|
|
||||||
anime.images = MBridge.xpath(res,
|
|
||||||
'//*[contains(@class,"anime-card")]/div[@class="anime-image")]/img/@src');
|
|
||||||
final nextPage =
|
|
||||||
MBridge.xpath(res, '//li[@class="page-item"]/a[@rel="next"]/@href');
|
|
||||||
if (nextPage.isEmpty) {
|
|
||||||
anime.hasNextPage = false;
|
|
||||||
} else {
|
|
||||||
anime.hasNextPage = true;
|
|
||||||
}
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getVideoList(MManga anime) async {
|
|
||||||
final datas = {"url": anime.link};
|
|
||||||
final response = await MBridge.http('GET', json.encode(datas));
|
|
||||||
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
final urls = MBridge.xpath(res, '//*[@id="streamlinks"]/a/@data-src');
|
|
||||||
final qualities = MBridge.xpath(res, '//*[@id="streamlinks"]/a/span/text()');
|
|
||||||
|
|
||||||
List<MVideo> videos = [];
|
|
||||||
for (var i = 0; i < urls.length; i++) {
|
|
||||||
final url = urls[i];
|
|
||||||
final quality = getQuality(qualities[i]);
|
|
||||||
List<MVideo> a = [];
|
|
||||||
|
|
||||||
if (url.contains("https://doo")) {
|
|
||||||
a = await MBridge.doodExtractor(url, "DoodStream - $quality");
|
|
||||||
} else if (url.contains("mp4upload")) {
|
|
||||||
a = await MBridge.mp4UploadExtractor(url, null, "", "");
|
|
||||||
} else if (url.contains("ok.ru")) {
|
|
||||||
a = await MBridge.okruExtractor(url);
|
|
||||||
} else if (url.contains("voe.sx")) {
|
|
||||||
a = await MBridge.voeExtractor(url, "VoeSX $quality");
|
|
||||||
} else if (containsVidBom(url)) {
|
|
||||||
a = await MBridge.vidBomExtractor(url);
|
|
||||||
}
|
|
||||||
if (a.isNotEmpty) {
|
|
||||||
videos.addAll(a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return videos;
|
|
||||||
}
|
|
||||||
|
|
||||||
String getQuality(String quality) {
|
|
||||||
quality = quality.replaceAll(" ", "");
|
|
||||||
if (quality == "HD") {
|
|
||||||
return "720p";
|
|
||||||
} else if (quality == "FHD") {
|
|
||||||
return "1080p";
|
|
||||||
} else if (quality == "SD") {
|
|
||||||
return "480p";
|
|
||||||
}
|
|
||||||
return "240p";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool containsVidBom(String url) {
|
|
||||||
url = url;
|
|
||||||
final list = ["vidbam", "vadbam", "vidbom", "vidbm"];
|
|
||||||
for (var n in list) {
|
|
||||||
if (url.contains(n)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
176
anime/src/ar/okanime/okanime-v0.0.25.dart
Normal file
176
anime/src/ar/okanime/okanime-v0.0.25.dart
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
import 'package:mangayomi/bridge_lib.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class OkAnime extends MProvider {
|
||||||
|
OkAnime();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getPopular(MSource source, int page) async {
|
||||||
|
final data = {"url": source.baseUrl};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
final urls = xpath(res,
|
||||||
|
'//div[@class="section" and contains(text(),"افضل انميات")]/div[@class="section-content"]/div/div/div[contains(@class,"anime-card")]/div[@class="anime-title")]/h4/a/@href');
|
||||||
|
final names = xpath(res,
|
||||||
|
'//div[@class="section" and contains(text(),"افضل انميات")]/div[@class="section-content"]/div/div/div[contains(@class,"anime-card")]/div[@class="anime-title")]/h4/a/text()');
|
||||||
|
final images = xpath(res,
|
||||||
|
'//div[@class="section" and contains(text(),"افضل انميات")]/div[@class="section-content"]/div/div/div[contains(@class,"anime-card")]/div[@class="anime-image")]/img/@src');
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.name = names[i];
|
||||||
|
anime.imageUrl = images[i];
|
||||||
|
anime.link = urls[i];
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
return MPages(animeList, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||||
|
final data = {"url": "${source.baseUrl}/espisode-list?page=$page"};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
final urls = xpath(res,
|
||||||
|
'//*[contains(@class,"anime-card")]/div[@class="anime-title")]/h4/a/@href');
|
||||||
|
final names = xpath(res,
|
||||||
|
'//*[contains(@class,"anime-card")]/div[@class="anime-title")]/h4/a/text()');
|
||||||
|
final images = xpath(res,
|
||||||
|
'//*[contains(@class,"anime-card")]/div[@class="episode-image")]/img/@src');
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.name = names[i];
|
||||||
|
anime.imageUrl = images[i];
|
||||||
|
anime.link = urls[i];
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
final nextPage =
|
||||||
|
xpath(res, '//li[@class="page-item"]/a[@rel="next"]/@href');
|
||||||
|
return MPages(animeList, nextPage.isNotEmpty);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> search(MSource source, String query, int page) async {
|
||||||
|
String url = "${source.baseUrl}/search/?s=$query";
|
||||||
|
if (page > 1) {
|
||||||
|
url += "&page=$page";
|
||||||
|
}
|
||||||
|
final data = {"url": url};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
final urls = xpath(res,
|
||||||
|
'//*[contains(@class,"anime-card")]/div[@class="anime-title")]/h4/a/@href');
|
||||||
|
final names = xpath(res,
|
||||||
|
'//*[contains(@class,"anime-card")]/div[@class="anime-title")]/h4/a/text()');
|
||||||
|
final images = xpath(res,
|
||||||
|
'//*[contains(@class,"anime-card")]/div[@class="anime-image")]/img/@src');
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.name = names[i];
|
||||||
|
anime.imageUrl = images[i];
|
||||||
|
anime.link = urls[i];
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
final nextPage =
|
||||||
|
xpath(res, '//li[@class="page-item"]/a[@rel="next"]/@href');
|
||||||
|
return MPages(animeList, nextPage.isNotEmpty);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MManga> getDetail(MSource source, String url) async {
|
||||||
|
final statusList = [
|
||||||
|
{"يعرض الان": 0, "مكتمل": 1}
|
||||||
|
];
|
||||||
|
final data = {"url": url};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
MManga anime = MManga();
|
||||||
|
final status = xpath(res,
|
||||||
|
'//*[@class="full-list-info" and contains(text(),"حالة الأنمي")]/small/a/text()');
|
||||||
|
if (status.isNotEmpty) {
|
||||||
|
anime.status = parseStatus(status.first, statusList);
|
||||||
|
}
|
||||||
|
anime.description = xpath(res, '//*[@class="review-content"]/text()').first;
|
||||||
|
|
||||||
|
anime.genre = xpath(res, '//*[@class="review-author-info"]/a/text()');
|
||||||
|
final epUrls = xpath(res,
|
||||||
|
'//*[contains(@class,"anime-card")]/div[@class="anime-title")]/h5/a/@href')
|
||||||
|
.reversed
|
||||||
|
.toList();
|
||||||
|
final names = xpath(res,
|
||||||
|
'//*[contains(@class,"anime-card")]/div[@class="anime-title")]/h5/a/text()')
|
||||||
|
.reversed
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
List<MChapter>? episodesList = [];
|
||||||
|
for (var i = 0; i < epUrls.length; i++) {
|
||||||
|
MChapter episode = MChapter();
|
||||||
|
episode.name = names[i];
|
||||||
|
episode.url = epUrls[i];
|
||||||
|
episodesList.add(episode);
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.chapters = episodesList;
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<MVideo>> getVideoList(MSource source, String url) async {
|
||||||
|
final res = await http('GET', json.encode({"url": url}));
|
||||||
|
|
||||||
|
final urls = xpath(res, '//*[@id="streamlinks"]/a/@data-src');
|
||||||
|
final qualities = xpath(res, '//*[@id="streamlinks"]/a/span/text()');
|
||||||
|
|
||||||
|
List<MVideo> videos = [];
|
||||||
|
for (var i = 0; i < urls.length; i++) {
|
||||||
|
final url = urls[i];
|
||||||
|
final quality = getQuality(qualities[i]);
|
||||||
|
List<MVideo> a = [];
|
||||||
|
|
||||||
|
if (url.contains("https://doo")) {
|
||||||
|
a = await doodExtractor(url, "DoodStream - $quality");
|
||||||
|
} else if (url.contains("mp4upload")) {
|
||||||
|
a = await mp4UploadExtractor(url, null, "", "");
|
||||||
|
} else if (url.contains("ok.ru")) {
|
||||||
|
a = await okruExtractor(url);
|
||||||
|
} else if (url.contains("voe.sx")) {
|
||||||
|
a = await voeExtractor(url, "VoeSX $quality");
|
||||||
|
} else if (containsVidBom(url)) {
|
||||||
|
a = await vidBomExtractor(url);
|
||||||
|
}
|
||||||
|
videos.addAll(a);
|
||||||
|
}
|
||||||
|
return videos;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getQuality(String quality) {
|
||||||
|
quality = quality.replaceAll(" ", "");
|
||||||
|
if (quality == "HD") {
|
||||||
|
return "720p";
|
||||||
|
} else if (quality == "FHD") {
|
||||||
|
return "1080p";
|
||||||
|
} else if (quality == "SD") {
|
||||||
|
return "480p";
|
||||||
|
}
|
||||||
|
return "240p";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool containsVidBom(String url) {
|
||||||
|
url = url;
|
||||||
|
final list = ["vidbam", "vadbam", "vidbom", "vidbm"];
|
||||||
|
for (var n in list) {
|
||||||
|
if (url.contains(n)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OkAnime main() {
|
||||||
|
return OkAnime();
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ import '../../../../model/source.dart';
|
|||||||
import '../../../../utils/utils.dart';
|
import '../../../../utils/utils.dart';
|
||||||
|
|
||||||
Source get okanimeSource => _okanimeSource;
|
Source get okanimeSource => _okanimeSource;
|
||||||
const okanimeVersion = "0.0.2";
|
const okanimeVersion = "0.0.25";
|
||||||
const okanimeSourceCodeUrl =
|
const okanimeSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/ar/okanime/okanime-v$okanimeVersion.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/ar/okanime/okanime-v$okanimeVersion.dart";
|
||||||
Source _okanimeSource = Source(
|
Source _okanimeSource = Source(
|
||||||
|
|||||||
@@ -1,213 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
getPopularAnime(MManga anime) async {
|
|
||||||
final data = {"url": "${anime.baseUrl}/most-popular?page=${anime.page}"};
|
|
||||||
final res = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (res.hasError) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
return animeElementM(res.body, anime);
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesAnime(MManga anime) async {
|
|
||||||
final data = {"url": "${anime.baseUrl}/recently-updated?page=${anime.page}"};
|
|
||||||
final res = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (res.hasError) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
return animeElementM(res.body, anime);
|
|
||||||
}
|
|
||||||
|
|
||||||
getAnimeDetail(MManga anime) async {
|
|
||||||
final statusList = [
|
|
||||||
{
|
|
||||||
"Currently Airing": 0,
|
|
||||||
"Finished Airing": 1,
|
|
||||||
}
|
|
||||||
];
|
|
||||||
final url = "${anime.baseUrl}${anime.link}";
|
|
||||||
final data = {"url": url, "headers": null};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
final status = MBridge.xpath(res,
|
|
||||||
'//*[@class="anisc-info"]/div[contains(text(),"Status:")]/span[2]/text()')
|
|
||||||
.first;
|
|
||||||
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.body)["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(MManga 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.hasError) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
return animeElementM(res.body, anime);
|
|
||||||
}
|
|
||||||
|
|
||||||
getVideoList(MManga 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.hasError) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
final html = json.decode(res.body)["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<MVideo> 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.body, "\"link\":\""), "\"");
|
|
||||||
print(url);
|
|
||||||
List<MVideo> a = [];
|
|
||||||
if (name.contains("Vidstreaming")) {
|
|
||||||
a = await MBridge.rapidCloudExtractor(url, "Vidstreaming - $subDub");
|
|
||||||
videos.addAll(a);
|
|
||||||
} else if (name.contains("Vidcloud")) {
|
|
||||||
a = await MBridge.rapidCloudExtractor(url, "Vidcloud - $subDub");
|
|
||||||
videos.addAll(a);
|
|
||||||
} else if (name.contains("StreamTape")) {
|
|
||||||
a = await MBridge.streamTapeExtractor(url, "StreamTape - $subDub");
|
|
||||||
videos.addAll(a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return videos;
|
|
||||||
}
|
|
||||||
|
|
||||||
MManga animeElementM(String res, MManga 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,28 +0,0 @@
|
|||||||
import '../../../../model/source.dart';
|
|
||||||
import '../../../../utils/utils.dart';
|
|
||||||
|
|
||||||
const aniwatchVersion = "0.0.35";
|
|
||||||
const aniwatchSourceCodeUrl =
|
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/en/aniwatch/aniwatch-v$aniwatchVersion.dart";
|
|
||||||
|
|
||||||
List<Source> get aniwatchSourcesList => _aniwatchSourcesList;
|
|
||||||
List<Source> _aniwatchSourcesList = [
|
|
||||||
Source(
|
|
||||||
name: "AniWatch.to",
|
|
||||||
baseUrl: "https://aniwatch.to",
|
|
||||||
lang: "en",
|
|
||||||
typeSource: "single",
|
|
||||||
iconUrl: getIconUrl("aniwatch", "en"),
|
|
||||||
version: aniwatchVersion,
|
|
||||||
isManga: false,
|
|
||||||
sourceCodeUrl: aniwatchSourceCodeUrl),
|
|
||||||
Source(
|
|
||||||
name: "Kaido.to",
|
|
||||||
baseUrl: "https://kaido.to",
|
|
||||||
lang: "en",
|
|
||||||
typeSource: "single",
|
|
||||||
iconUrl: getIconUrl("kaido", "en"),
|
|
||||||
version: aniwatchVersion,
|
|
||||||
isManga: false,
|
|
||||||
sourceCodeUrl: aniwatchSourceCodeUrl),
|
|
||||||
];
|
|
||||||
@@ -1,148 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
getPopularAnime(MManga anime) async {
|
|
||||||
final data = {"url": "${anime.baseUrl}/popular.html?page=${anime.page}"};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
anime.urls = MBridge.xpath(res, '//*[@class="img"]/a/@href');
|
|
||||||
anime.names = MBridge.xpath(res, '//*[@class="img"]/a/@title');
|
|
||||||
anime.images = MBridge.xpath(res, '//*[@class="img"]/a/img/@src');
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesAnime(MManga anime) async {
|
|
||||||
final url =
|
|
||||||
"https://ajax.gogo-load.com/ajax/page-recent-release-ongoing.html?page=${anime.page}&type=1";
|
|
||||||
final data = {"url": url};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
anime.urls = MBridge.xpath(
|
|
||||||
res, '//*[@class="added_series_body popular"]/ul/li/a[1]/@href');
|
|
||||||
anime.names = MBridge.xpath(
|
|
||||||
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(MManga anime) async {
|
|
||||||
final statusList = [
|
|
||||||
{
|
|
||||||
"Ongoing": 0,
|
|
||||||
"Completed": 1,
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
final data = {"url": "${anime.baseUrl}${anime.link}"};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
|
|
||||||
final status = MBridge.xpath(
|
|
||||||
res, '//*[@class="anime_info_body_bg"]/p[@class="type"][5]/text()')
|
|
||||||
.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 responseresEp = await MBridge.http('GET', json.encode(dataEp));
|
|
||||||
if (responseresEp.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String resEp = responseresEp.body;
|
|
||||||
anime.urls = MBridge.xpath(resEp, '//*[@id="episode_related"]/li/a/@href');
|
|
||||||
final names = MBridge.xpath(
|
|
||||||
resEp, '//*[@id="episode_related"]/li/a/div[@class="name"]/text()');
|
|
||||||
|
|
||||||
List<String> episodes = [];
|
|
||||||
for (var a in names) {
|
|
||||||
episodes.add("Episode ${MBridge.substringAfterLast(a, ' ')}");
|
|
||||||
}
|
|
||||||
|
|
||||||
anime.names = episodes;
|
|
||||||
anime.chaptersDateUploads = [];
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getVideoList(MManga anime) async {
|
|
||||||
final datas = {"url": "${anime.baseUrl}${anime.link}"};
|
|
||||||
|
|
||||||
final response = await MBridge.http('GET', json.encode(datas));
|
|
||||||
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
|
|
||||||
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');
|
|
||||||
List<MVideo> videos = [];
|
|
||||||
for (var i = 0; i < classNames.length; i++) {
|
|
||||||
final name = classNames[i];
|
|
||||||
final url = serverUrls[i];
|
|
||||||
print(url);
|
|
||||||
List<MVideo> 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(MManga anime) async {
|
|
||||||
final url =
|
|
||||||
"${anime.baseUrl}/search.html?keyword=${anime.query}&page=${anime.page}";
|
|
||||||
final data = {"url": url};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
anime.urls = MBridge.xpath(res, '//*[@class="img"]/a/@href');
|
|
||||||
anime.names = MBridge.xpath(res, '//*[@class="img"]/a/@title');
|
|
||||||
anime.images = MBridge.xpath(res, '//*[@class="img"]/a/img/@src');
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
165
anime/src/en/gogoanime/gogoanime-v0.0.35.dart
Normal file
165
anime/src/en/gogoanime/gogoanime-v0.0.35.dart
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
import 'package:mangayomi/bridge_lib.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class GogoAnime extends MProvider {
|
||||||
|
GogoAnime();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getPopular(MSource source, int page) async {
|
||||||
|
final data = {"url": "${source.baseUrl}/popular.html?page=$page"};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
final urls = xpath(res, '//*[@class="img"]/a/@href');
|
||||||
|
final names = xpath(res, '//*[@class="img"]/a/@title');
|
||||||
|
final images = xpath(res, '//*[@class="img"]/a/img/@src');
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.name = names[i];
|
||||||
|
anime.imageUrl = images[i];
|
||||||
|
anime.link = urls[i];
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(animeList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||||
|
final data = {
|
||||||
|
"url":
|
||||||
|
"https://ajax.gogo-load.com/ajax/page-recent-release-ongoing.html?page=$page&type=1"
|
||||||
|
};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
final urls =
|
||||||
|
xpath(res, '//*[@class="added_series_body popular"]/ul/li/a[1]/@href');
|
||||||
|
final names = xpath(
|
||||||
|
res, '//*[//*[@class="added_series_body popular"]/ul/li/a[1]/@title');
|
||||||
|
List<String> images = [];
|
||||||
|
List<String> imagess = 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("');", ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.name = names[i];
|
||||||
|
anime.imageUrl = images[i];
|
||||||
|
anime.link = urls[i];
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(animeList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> search(MSource source, String query, int page) async {
|
||||||
|
final data = {
|
||||||
|
"url": "${source.baseUrl}/search.html?keyword=$query&page=$page"
|
||||||
|
};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
final urls = xpath(res, '//*[@class="img"]/a/@href');
|
||||||
|
final names = xpath(res, '//*[@class="img"]/a/@title');
|
||||||
|
final images = xpath(res, '//*[@class="img"]/a/img/@src');
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.name = names[i];
|
||||||
|
anime.imageUrl = images[i];
|
||||||
|
anime.link = urls[i];
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(animeList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MManga> getDetail(MSource source, String url) async {
|
||||||
|
final statusList = [
|
||||||
|
{
|
||||||
|
"Ongoing": 0,
|
||||||
|
"Completed": 1,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
final data = {"url": "${source.baseUrl}$url"};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
MManga anime = MManga();
|
||||||
|
final status = xpath(
|
||||||
|
res, '//*[@class="anime_info_body_bg"]/p[@class="type"][5]/text()')
|
||||||
|
.first
|
||||||
|
.replaceAll("Status: ", "");
|
||||||
|
anime.description = xpath(
|
||||||
|
res, '//*[@class="anime_info_body_bg"]/p[@class="type"][2]/text()')
|
||||||
|
.first
|
||||||
|
.replaceAll("Plot Summary: ", "");
|
||||||
|
anime.status = parseStatus(status, statusList);
|
||||||
|
anime.genre = xpath(
|
||||||
|
res, '//*[@class="anime_info_body_bg"]/p[@class="type"][3]/text()')
|
||||||
|
.first
|
||||||
|
.replaceAll("Genre: ", "")
|
||||||
|
.split(",");
|
||||||
|
|
||||||
|
final id = 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 http('GET', json.encode(dataEp));
|
||||||
|
|
||||||
|
final epUrls = xpath(resEp, '//*[@id="episode_related"]/li/a/@href');
|
||||||
|
final names = xpath(
|
||||||
|
resEp, '//*[@id="episode_related"]/li/a/div[@class="name"]/text()');
|
||||||
|
List<String> episodes = [];
|
||||||
|
|
||||||
|
for (var a in names) {
|
||||||
|
episodes.add("Episode ${substringAfterLast(a, ' ')}");
|
||||||
|
}
|
||||||
|
List<MChapter>? episodesList = [];
|
||||||
|
for (var i = 0; i < episodes.length; i++) {
|
||||||
|
MChapter episode = MChapter();
|
||||||
|
episode.name = episodes[i];
|
||||||
|
episode.url = epUrls[i];
|
||||||
|
episodesList.add(episode);
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.chapters = episodesList;
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<MVideo>> getVideoList(MSource source, String url) async {
|
||||||
|
final datas = {"url": "${source.baseUrl}$url"};
|
||||||
|
|
||||||
|
final res = await http('GET', json.encode(datas));
|
||||||
|
final serverUrls =
|
||||||
|
xpath(res, '//*[@class="anime_muti_link"]/ul/li/a/@data-video');
|
||||||
|
final classNames = xpath(res, '//*[@class="anime_muti_link"]/ul/li/@class');
|
||||||
|
List<MVideo> videos = [];
|
||||||
|
for (var i = 0; i < classNames.length; i++) {
|
||||||
|
final name = classNames[i];
|
||||||
|
final url = serverUrls[i];
|
||||||
|
List<MVideo> a = [];
|
||||||
|
if (name.contains("anime")) {
|
||||||
|
a = await gogoCdnExtractor(url);
|
||||||
|
} else if (name.contains("vidcdn")) {
|
||||||
|
a = await gogoCdnExtractor(url);
|
||||||
|
} else if (name.contains("doodstream")) {
|
||||||
|
a = await doodExtractor(url);
|
||||||
|
} else if (name.contains("mp4upload")) {
|
||||||
|
a = await mp4UploadExtractor(url, null, "", "");
|
||||||
|
} else if (name.contains("streamsb")) {}
|
||||||
|
videos.addAll(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
return videos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GogoAnime main() {
|
||||||
|
return GogoAnime();
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ import '../../../../model/source.dart';
|
|||||||
import '../../../../utils/utils.dart';
|
import '../../../../utils/utils.dart';
|
||||||
|
|
||||||
Source get gogoanimeSource => _gogoanimeSource;
|
Source get gogoanimeSource => _gogoanimeSource;
|
||||||
const gogoanimeVersion = "0.0.3";
|
const gogoanimeVersion = "0.0.35";
|
||||||
const gogoanimeSourceCodeUrl =
|
const gogoanimeSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/en/gogoanime/gogoanime-v$gogoanimeVersion.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/en/gogoanime/gogoanime-v$gogoanimeVersion.dart";
|
||||||
Source _gogoanimeSource = Source(
|
Source _gogoanimeSource = Source(
|
||||||
|
|||||||
@@ -1,163 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
getPopularAnime(MManga anime) async {
|
|
||||||
final data = {
|
|
||||||
"url":
|
|
||||||
"${anime.baseUrl}/api/DramaList/List?page=${anime.page}&type=0&sub=0&country=0&status=0&order=1&pageSize=40"
|
|
||||||
};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
final jsonRes = json.decode(res);
|
|
||||||
final datas = jsonRes["data"] as List;
|
|
||||||
anime.names = datas.map((e) => e["title"]).toList();
|
|
||||||
anime.images = datas.map((e) => e["thumbnail"] ?? "").toList();
|
|
||||||
anime.urls = datas
|
|
||||||
.map((e) => "${anime.baseUrl}/api/DramaList/Drama/${e["id"]}?isq=false")
|
|
||||||
.toList();
|
|
||||||
final lastPage = jsonRes["totalCount"] as int;
|
|
||||||
final page = jsonRes["page"] as int;
|
|
||||||
|
|
||||||
anime.hasNextPage = page < lastPage;
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesAnime(MManga anime) async {
|
|
||||||
final data = {
|
|
||||||
"url":
|
|
||||||
"${anime.baseUrl}/api/DramaList/List?page=${anime.page}&type=0&sub=0&country=0&status=0&order=12&pageSize=40"
|
|
||||||
};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
final jsonRes = json.decode(res);
|
|
||||||
final datas = jsonRes["data"] as List;
|
|
||||||
anime.names = datas.map((e) => e["title"]).toList();
|
|
||||||
anime.images = datas.map((e) => e["thumbnail"] ?? "").toList();
|
|
||||||
anime.urls = datas
|
|
||||||
.map((e) => "${anime.baseUrl}/api/DramaList/Drama/${e["id"]}?isq=false")
|
|
||||||
.toList();
|
|
||||||
final lastPage = jsonRes["totalCount"] as int;
|
|
||||||
final page = jsonRes["page"] as int;
|
|
||||||
|
|
||||||
anime.hasNextPage = page < lastPage;
|
|
||||||
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getAnimeDetail(MManga anime) async {
|
|
||||||
final statusList = [
|
|
||||||
{
|
|
||||||
"Ongoing": 0,
|
|
||||||
"Completed": 1,
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
final data = {"url": anime.link};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
final jsonRes = json.decode(res);
|
|
||||||
final status = jsonRes["status"] ?? "";
|
|
||||||
print(status);
|
|
||||||
anime.description = jsonRes["description"];
|
|
||||||
anime.status = MBridge.parseStatus(status, statusList);
|
|
||||||
anime.imageUrl = jsonRes["thumbnail"];
|
|
||||||
var episodes = jsonRes["episodes"];
|
|
||||||
String type = jsonRes["type"];
|
|
||||||
final episodesCount = jsonRes["episodesCount"] as int;
|
|
||||||
List<String> episodesNames = [];
|
|
||||||
List<String> episodesUrls = [];
|
|
||||||
final containsAnime = type.contains("Anime") as bool;
|
|
||||||
final containsTVSeries = type.contains("TVSeries") as bool;
|
|
||||||
final containsHollywood = type.contains("Hollywood") as bool;
|
|
||||||
final containsMovie = type.contains("Movie") as bool;
|
|
||||||
for (var a in episodes) {
|
|
||||||
String number = (a["number"] as double).toString().replaceAll(".0", "");
|
|
||||||
final id = a["id"];
|
|
||||||
if (containsAnime || containsTVSeries) {
|
|
||||||
episodesNames.add("Episode $number");
|
|
||||||
} else if (containsHollywood && episodesCount == 1 || containsMovie) {
|
|
||||||
episodesNames.add("Movie");
|
|
||||||
} else if (containsHollywood && episodesCount > 1) {
|
|
||||||
episodesNames.add("Episode $number");
|
|
||||||
}
|
|
||||||
|
|
||||||
episodesUrls.add(
|
|
||||||
"${anime.baseUrl}/api/DramaList/Episode/$id.png?err=false&ts=&time=");
|
|
||||||
}
|
|
||||||
anime.urls = episodesUrls;
|
|
||||||
anime.names = episodesNames;
|
|
||||||
anime.chaptersDateUploads = [];
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getVideoList(MManga anime) async {
|
|
||||||
final datas = {"url": anime.link};
|
|
||||||
|
|
||||||
final response = await MBridge.http('GET', json.encode(datas));
|
|
||||||
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
final id = MBridge.substringAfter(
|
|
||||||
MBridge.substringBefore(anime.link, ".png"), "Episode/");
|
|
||||||
final jsonRes = json.decode(res);
|
|
||||||
final subRes = await MBridge.http(
|
|
||||||
'GET', json.encode({"url": "${anime.baseUrl}/api/Sub/$id"}));
|
|
||||||
var jsonSubRes = json.decode(subRes.body);
|
|
||||||
|
|
||||||
List<MTrack> subtitles = [];
|
|
||||||
|
|
||||||
for (var sub in jsonSubRes) {
|
|
||||||
try {
|
|
||||||
final subUrl = sub["src"];
|
|
||||||
final label = sub["label"];
|
|
||||||
MTrack subtitle = MTrack();
|
|
||||||
subtitle
|
|
||||||
..label = label
|
|
||||||
..file = subUrl;
|
|
||||||
subtitles.add(subtitle);
|
|
||||||
} catch (_) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
final videoUrl = jsonRes["Video"];
|
|
||||||
MVideo video = MVideo();
|
|
||||||
video
|
|
||||||
..url = videoUrl
|
|
||||||
..originalUrl = videoUrl
|
|
||||||
..quality = "kisskh"
|
|
||||||
..subtitles = subtitles
|
|
||||||
..headers = {
|
|
||||||
"referer": "https://kisskh.me/",
|
|
||||||
"origin": "https://kisskh.me"
|
|
||||||
};
|
|
||||||
return [video];
|
|
||||||
}
|
|
||||||
|
|
||||||
searchAnime(MManga anime) async {
|
|
||||||
final data = {
|
|
||||||
"url": "${anime.baseUrl}/api/DramaList/Search?q=${anime.query}&type=0"
|
|
||||||
};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
var jsonRes = json.decode(res) as List;
|
|
||||||
anime.names = jsonRes.map((e) => e["title"]).toList();
|
|
||||||
anime.images = jsonRes.map((e) => e["thumbnail"] ?? "").toList();
|
|
||||||
anime.urls = jsonRes
|
|
||||||
.map((e) => "${anime.baseUrl}/api/DramaList/Drama/${e["id"]}?isq=false")
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
166
anime/src/en/kisskh/kisskh-v0.0.25.dart
Normal file
166
anime/src/en/kisskh/kisskh-v0.0.25.dart
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
import 'package:mangayomi/bridge_lib.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class KissKh extends MProvider {
|
||||||
|
KissKh();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getPopular(MSource source, int page) async {
|
||||||
|
final data = {
|
||||||
|
"url":
|
||||||
|
"${source.baseUrl}/api/DramaList/List?page=$page&type=0&sub=0&country=0&status=0&order=1&pageSize=40"
|
||||||
|
};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
final jsonRes = json.decode(res);
|
||||||
|
final datas = jsonRes["data"] as List;
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
|
||||||
|
for (var data in datas) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.name = data["title"];
|
||||||
|
anime.imageUrl = data["thumbnail"] ?? "";
|
||||||
|
anime.link =
|
||||||
|
"${source.baseUrl}/api/DramaList/Drama/${data["id"]}?isq=false";
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
|
||||||
|
int lastPage = jsonRes["totalCount"];
|
||||||
|
int pages = jsonRes["page"];
|
||||||
|
return MPages(animeList, pages < lastPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||||
|
final data = {
|
||||||
|
"url":
|
||||||
|
"${source.baseUrl}/api/DramaList/List?page=$page&type=0&sub=0&country=0&status=0&order=12&pageSize=40",
|
||||||
|
"header": {"ee": "eee"}
|
||||||
|
};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
final jsonRes = json.decode(res);
|
||||||
|
final datas = jsonRes["data"] as List;
|
||||||
|
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
|
||||||
|
for (var data in datas) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.name = data["title"];
|
||||||
|
anime.imageUrl = data["thumbnail"] ?? "";
|
||||||
|
anime.link =
|
||||||
|
"${source.baseUrl}/api/DramaList/Drama/${data["id"]}?isq=false";
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
|
||||||
|
int lastPage = jsonRes["totalCount"];
|
||||||
|
int pages = jsonRes["page"];
|
||||||
|
return MPages(animeList, pages < lastPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> search(MSource source, String query, int page) async {
|
||||||
|
final data = {
|
||||||
|
"url": "${source.baseUrl}/api/DramaList/Search?q=$query&type=0"
|
||||||
|
};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
final jsonRes = json.decode(res);
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
for (var data in jsonRes) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.name = data["title"];
|
||||||
|
anime.imageUrl = data["thumbnail"] ?? "";
|
||||||
|
anime.link =
|
||||||
|
"${source.baseUrl}/api/DramaList/Drama/${data["id"]}?isq=false";
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
return MPages(animeList, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MManga> getDetail(MSource source, String url) async {
|
||||||
|
final statusList = [
|
||||||
|
{
|
||||||
|
"Ongoing": 0,
|
||||||
|
"Completed": 1,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
final data = {"url": url};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
MManga anime = MManga();
|
||||||
|
final jsonRes = json.decode(res);
|
||||||
|
final status = jsonRes["status"] ?? "";
|
||||||
|
print(status);
|
||||||
|
anime.description = jsonRes["description"];
|
||||||
|
anime.status = parseStatus(status, statusList);
|
||||||
|
anime.imageUrl = jsonRes["thumbnail"];
|
||||||
|
var episodes = jsonRes["episodes"];
|
||||||
|
String type = jsonRes["type"];
|
||||||
|
final episodesCount = jsonRes["episodesCount"];
|
||||||
|
final containsAnime = type.contains("Anime");
|
||||||
|
final containsTVSeries = type.contains("TVSeries");
|
||||||
|
final containsHollywood = type.contains("Hollywood");
|
||||||
|
final containsMovie = type.contains("Movie");
|
||||||
|
List<MChapter>? episodesList = [];
|
||||||
|
|
||||||
|
for (var a in episodes) {
|
||||||
|
MChapter episode = MChapter();
|
||||||
|
String number = (a["number"] as double).toString().replaceAll(".0", "");
|
||||||
|
final id = a["id"];
|
||||||
|
if (containsAnime || containsTVSeries) {
|
||||||
|
episode.name = "Episode $number";
|
||||||
|
} else if (containsHollywood && episodesCount == 1 || containsMovie) {
|
||||||
|
episode.name = "Movie";
|
||||||
|
} else if (containsHollywood && episodesCount > 1) {
|
||||||
|
episode.name = "Episode $number";
|
||||||
|
}
|
||||||
|
episode.url =
|
||||||
|
"${source.baseUrl}/api/DramaList/Episode/$id.png?err=false&ts=&time=";
|
||||||
|
episodesList.add(episode);
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.chapters = episodesList;
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<MVideo>> getVideoList(MSource source, String url) async {
|
||||||
|
final datas = {"url": url};
|
||||||
|
|
||||||
|
final res = await http('GET', json.encode(datas));
|
||||||
|
final id = substringAfter(substringBefore(url, ".png"), "Episode/");
|
||||||
|
final jsonRes = json.decode(res);
|
||||||
|
|
||||||
|
final subRes = await http(
|
||||||
|
'GET', json.encode({"url": "${source.baseUrl}/api/Sub/$id"}));
|
||||||
|
var jsonSubRes = json.decode(subRes);
|
||||||
|
|
||||||
|
List<MTrack> subtitles = [];
|
||||||
|
|
||||||
|
for (var sub in jsonSubRes) {
|
||||||
|
try {
|
||||||
|
final subUrl = sub["src"];
|
||||||
|
final label = sub["label"];
|
||||||
|
MTrack subtitle = MTrack();
|
||||||
|
subtitle
|
||||||
|
..label = label
|
||||||
|
..file = subUrl;
|
||||||
|
subtitles.add(subtitle);
|
||||||
|
} catch (_) {}
|
||||||
|
}
|
||||||
|
final videoUrl = jsonRes["Video"];
|
||||||
|
MVideo video = MVideo();
|
||||||
|
video
|
||||||
|
..url = videoUrl
|
||||||
|
..originalUrl = videoUrl
|
||||||
|
..quality = "kisskh"
|
||||||
|
..subtitles = subtitles
|
||||||
|
..headers = {
|
||||||
|
"referer": "https://kisskh.me/",
|
||||||
|
"origin": "https://kisskh.me"
|
||||||
|
};
|
||||||
|
return [video];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
KissKh main() {
|
||||||
|
return KissKh();
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ import '../../../../model/source.dart';
|
|||||||
import '../../../../utils/utils.dart';
|
import '../../../../utils/utils.dart';
|
||||||
|
|
||||||
Source get kisskhSource => _kisskhSource;
|
Source get kisskhSource => _kisskhSource;
|
||||||
const kisskhVersion = "0.0.2";
|
const kisskhVersion = "0.0.25";
|
||||||
const kisskhSourceCodeUrl =
|
const kisskhSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/en/kisskh/kisskh-v$kisskhVersion.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/en/kisskh/kisskh-v$kisskhVersion.dart";
|
||||||
Source _kisskhSource = Source(
|
Source _kisskhSource = Source(
|
||||||
|
|||||||
@@ -1,133 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
getPopularAnime(MManga anime) async {
|
|
||||||
final data = {"url": "${anime.baseUrl}/"};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
anime.urls = MBridge.xpath(res,
|
|
||||||
'//*[contains(@class,"swiper-slide item-qtip")]/div[@class="item"]/a/@href');
|
|
||||||
anime.names = MBridge.xpath(res,
|
|
||||||
'//*[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(MManga anime) async {
|
|
||||||
final data = {"url": "${anime.baseUrl}/"};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
|
|
||||||
anime.urls = MBridge.xpath(res,
|
|
||||||
'//*[@class="block_area block_area_home"]/div[@class="tab-content"]/div[contains(@class,"block_area-content block_area-list")]/div[@class="film_list-wrap"]/div[@class="flw-item"]/div[@class="film-poster"]/a/@href');
|
|
||||||
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(MManga anime) async {
|
|
||||||
final url =
|
|
||||||
"${anime.baseUrl}/?story=${anime.query}&do=search&subaction=search";
|
|
||||||
final data = {"url": url};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
anime.urls = MBridge.xpath(res, '//*[@class="film-poster"]/a/@href');
|
|
||||||
anime.names = MBridge.xpath(res, '//*[@class="film-poster"]/a/@title');
|
|
||||||
anime.images = MBridge.xpath(res, '//*[@class="film-poster"]/img/@data-src');
|
|
||||||
anime.hasNextPage = false;
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getAnimeDetail(MManga anime) async {
|
|
||||||
final statusList = [
|
|
||||||
{
|
|
||||||
"En cours": 0,
|
|
||||||
"Terminé": 1,
|
|
||||||
}
|
|
||||||
];
|
|
||||||
final url = anime.link;
|
|
||||||
final data = {"url": url};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
anime.description =
|
|
||||||
MBridge.xpath(res, '//*[@class="film-description m-hide"]/text()').first;
|
|
||||||
|
|
||||||
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(MManga 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<MVideo> videos = [];
|
|
||||||
for (var i = 0; i < serverNames.length; i++) {
|
|
||||||
final name = serverNames[i];
|
|
||||||
final url = serverUrls[i];
|
|
||||||
|
|
||||||
List<MVideo> 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;
|
|
||||||
}
|
|
||||||
160
anime/src/fr/animesultra/animesultra-v0.0.35.dart
Normal file
160
anime/src/fr/animesultra/animesultra-v0.0.35.dart
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
import 'package:mangayomi/bridge_lib.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class AnimesUltra extends MProvider {
|
||||||
|
AnimesUltra();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getPopular(MSource source, int page) async {
|
||||||
|
final data = {"url": "${source.baseUrl}/"};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
final urls = xpath(res,
|
||||||
|
'//*[contains(@class,"swiper-slide item-qtip")]/div[@class="item"]/a/@href');
|
||||||
|
final names = xpath(res,
|
||||||
|
'//*[contains(@class,"swiper-slide item-qtip")]/div[@class="item"]/a/img/@title');
|
||||||
|
final images = xpath(res,
|
||||||
|
'//*[contains(@class,"swiper-slide item-qtip")]/div[@class="item"]/a/img/@data-src');
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.name = names[i];
|
||||||
|
anime.imageUrl = images[i];
|
||||||
|
anime.link = urls[i];
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(animeList, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||||
|
final data = {"url": "${source.baseUrl}/"};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
final urls = 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');
|
||||||
|
final names = 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');
|
||||||
|
final images = 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');
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.name = names[i];
|
||||||
|
anime.imageUrl = images[i];
|
||||||
|
anime.link = urls[i];
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(animeList, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> search(MSource source, String query, int page) async {
|
||||||
|
final data = {"url": "${source.baseUrl}/"};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
final urls = xpath(res, '//*[@class="film-poster"]/a/@href');
|
||||||
|
final names = xpath(res, '//*[@class="film-poster"]/a/@title');
|
||||||
|
final images = xpath(res, '//*[@class="film-poster"]/img/@data-src');
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.name = names[i];
|
||||||
|
anime.imageUrl = images[i];
|
||||||
|
anime.link = urls[i];
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(animeList, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MManga> getDetail(MSource source, String url) async {
|
||||||
|
final statusList = [
|
||||||
|
{
|
||||||
|
"En cours": 0,
|
||||||
|
"Terminé": 1,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
final data = {"url": url};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.description =
|
||||||
|
xpath(res, '//*[@class="film-description m-hide"]/text()').first;
|
||||||
|
|
||||||
|
final status = xpath(res,
|
||||||
|
'//*[@class="item item-title" and contains(text(),"Status:")]/span[2]/text()')
|
||||||
|
.first;
|
||||||
|
anime.status = parseStatus(status, statusList);
|
||||||
|
anime.genre = xpath(res,
|
||||||
|
'//*[@class="item item-list" and contains(text(),"Genres:")]/a/text()');
|
||||||
|
anime.author = xpath(res,
|
||||||
|
'//*[@class="item item-title" and contains(text(),"Studio:")]/span[2]/text()')
|
||||||
|
.first;
|
||||||
|
final urlEp = url.replaceAll('.html', '/episode-1.html');
|
||||||
|
final resEpWebview =
|
||||||
|
await getHtmlViaWebview(urlEp, '//*[@class="ss-list"]/a/@href');
|
||||||
|
final epUrls =
|
||||||
|
xpath(resEpWebview, '//*[@class="ss-list"]/a/@href').reversed.toList();
|
||||||
|
final names = xpath(resEpWebview,
|
||||||
|
'//*[@class="ss-list"]/a/div[@class="ssli-detail"]/div/text()')
|
||||||
|
.reversed
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
List<MChapter>? episodesList = [];
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MChapter episode = MChapter();
|
||||||
|
episode.name = names[i];
|
||||||
|
episode.url = epUrls[i];
|
||||||
|
episodesList.add(episode);
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.chapters = episodesList;
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<MVideo>> getVideoList(MSource source, String url) async {
|
||||||
|
final resWebview = await getHtmlViaWebview(
|
||||||
|
url, '//*[@class="ps__-list"]/div/@data-server-id');
|
||||||
|
|
||||||
|
final serverIds =
|
||||||
|
xpath(resWebview, '//*[@class="ps__-list"]/div/@data-server-id');
|
||||||
|
final serverNames =
|
||||||
|
xpath(resWebview, '//*[@class="ps__-list"]/div/a/text()');
|
||||||
|
List<String> serverUrls = [];
|
||||||
|
for (var id in serverIds) {
|
||||||
|
final serversUrls =
|
||||||
|
xpath(resWebview, '//*[@id="content_player_${id}"]/text()').first;
|
||||||
|
serverUrls.add(serversUrls);
|
||||||
|
}
|
||||||
|
List<MVideo> videos = [];
|
||||||
|
for (var i = 0; i < serverNames.length; i++) {
|
||||||
|
final name = serverNames[i];
|
||||||
|
final url = serverUrls[i];
|
||||||
|
|
||||||
|
List<MVideo> a = [];
|
||||||
|
if (name.contains("Sendvid")) {
|
||||||
|
a = await sendVidExtractor(url.replaceAll("https:////", "https://"),
|
||||||
|
json.encode({"Referer": "${source.baseUrl}/"}), "");
|
||||||
|
} else if (name.contains("Sibnet")) {
|
||||||
|
a = await sibnetExtractor(
|
||||||
|
"https://video.sibnet.ru/shell.php?videoid=$url");
|
||||||
|
} else if (name.contains("Mytv")) {
|
||||||
|
a = await myTvExtractor("https://www.myvi.tv/embed/$url");
|
||||||
|
}
|
||||||
|
videos.addAll(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
return videos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimesUltra main() {
|
||||||
|
return AnimesUltra();
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ import '../../../../model/source.dart';
|
|||||||
import '../../../../utils/utils.dart';
|
import '../../../../utils/utils.dart';
|
||||||
|
|
||||||
Source get animesultraSource => _animesultraSource;
|
Source get animesultraSource => _animesultraSource;
|
||||||
const animesultraVersion = "0.0.3";
|
const animesultraVersion = "0.0.35";
|
||||||
const animesultraSourceCodeUrl =
|
const animesultraSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/fr/animesultra/animesultra-v$animesultraVersion.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/fr/animesultra/animesultra-v$animesultraVersion.dart";
|
||||||
Source _animesultraSource = Source(
|
Source _animesultraSource = Source(
|
||||||
|
|||||||
@@ -1,386 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
Future<MHttpResponse> dataBase(int sourceId) async {
|
|
||||||
final data = {
|
|
||||||
"url": "https://api.franime.fr/api/animes/",
|
|
||||||
"headers": {"Referer": "https://franime.fr/"}
|
|
||||||
};
|
|
||||||
|
|
||||||
return await MBridge.http('GET', json.encode(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
getPopularAnime(MManga 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.hasError) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
List<MManga> animeList = animeResList(res.body);
|
|
||||||
|
|
||||||
return animeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<MManga> animeResList(String res) {
|
|
||||||
final statusList = [
|
|
||||||
{"EN COURS": 0, "TERMINÉ": 1}
|
|
||||||
];
|
|
||||||
List<MManga> animeList = [];
|
|
||||||
|
|
||||||
var jsonResList = json.decode(res);
|
|
||||||
|
|
||||||
for (var animeJson in jsonResList) {
|
|
||||||
final seasons = animeJson["saisons"];
|
|
||||||
List<bool> vostfrListName = [];
|
|
||||||
List<bool> 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"];
|
|
||||||
bool hasVostfr = vostfrListName.contains(true);
|
|
||||||
bool hasVf = vfListName.contains(true);
|
|
||||||
if (hasVostfr || hasVf) {
|
|
||||||
for (int i = 0; i < seasons.length; i++) {
|
|
||||||
MManga anime = MManga();
|
|
||||||
int ind = i + 1;
|
|
||||||
anime.genre = genre;
|
|
||||||
anime.description = description;
|
|
||||||
String seasonTitle = "".toString();
|
|
||||||
String lang = "";
|
|
||||||
if (title.isEmpty) {
|
|
||||||
seasonTitle = titleO;
|
|
||||||
} else {
|
|
||||||
seasonTitle = title;
|
|
||||||
}
|
|
||||||
if (seasons.length > 1) {
|
|
||||||
seasonTitle += " S$ind";
|
|
||||||
}
|
|
||||||
if (hasVf) {
|
|
||||||
seasonTitle += " VF";
|
|
||||||
lang = "vf".toString();
|
|
||||||
}
|
|
||||||
if (hasVostfr) {
|
|
||||||
seasonTitle += " VOSTFR";
|
|
||||||
lang = "vo".toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
anime.status = status;
|
|
||||||
anime.name = seasonTitle;
|
|
||||||
anime.imageUrl = imageUrl;
|
|
||||||
anime.link =
|
|
||||||
"/anime/${MBridge.regExp(titleO, "[^A-Za-z0-9 ]", "", 0, 0).replaceAll(" ", "-").toLowerCase()}?lang=$lang&s=$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(MManga 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.hasError) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
final animeByTitleOJson = databaseAnimeByTitleO(res.body, 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(MManga anime) async {
|
|
||||||
final res = await dataBase(anime.sourceId);
|
|
||||||
|
|
||||||
if (res.hasError) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
List list = json.decode(res.body);
|
|
||||||
List reversedList = list.reversed.toList();
|
|
||||||
List<MManga> animeList = animeResList(json.encode(reversedList));
|
|
||||||
|
|
||||||
return animeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
searchAnime(MManga anime) async {
|
|
||||||
final res = await dataBase(anime.sourceId);
|
|
||||||
|
|
||||||
if (res.hasError) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
List<MManga> animeList = animeSeachFetch(res.body, anime.query);
|
|
||||||
return animeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<MManga> animeSeachFetch(String res, query) {
|
|
||||||
final statusList = [
|
|
||||||
{"EN COURS": 0, "TERMINÉ": 1}
|
|
||||||
];
|
|
||||||
List<MManga> animeList = [];
|
|
||||||
final jsonResList = json.decode(res);
|
|
||||||
for (var animeJson in jsonResList) {
|
|
||||||
MManga anime = MManga();
|
|
||||||
|
|
||||||
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<bool> vostfrListName = [];
|
|
||||||
List<bool> 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"];
|
|
||||||
|
|
||||||
bool hasVostfr = vostfrListName.contains(true);
|
|
||||||
bool hasVf = vfListName.contains(true);
|
|
||||||
if (hasVostfr || hasVf) {
|
|
||||||
for (int i = 0; i < seasons.length; i++) {
|
|
||||||
MManga anime = MManga();
|
|
||||||
int ind = i + 1;
|
|
||||||
anime.genre = genre;
|
|
||||||
anime.description = description;
|
|
||||||
String seasonTitle = "".toString();
|
|
||||||
String lang = "";
|
|
||||||
if (title.isEmpty) {
|
|
||||||
seasonTitle = titleO;
|
|
||||||
} else {
|
|
||||||
seasonTitle = title;
|
|
||||||
}
|
|
||||||
if (seasons.length > 1) {
|
|
||||||
seasonTitle += " S$ind";
|
|
||||||
}
|
|
||||||
if (hasVf) {
|
|
||||||
seasonTitle += " VF";
|
|
||||||
lang = "vf".toString();
|
|
||||||
}
|
|
||||||
if (hasVostfr) {
|
|
||||||
seasonTitle += " VOSTFR";
|
|
||||||
lang = "vo".toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
anime.status = status;
|
|
||||||
anime.name = seasonTitle;
|
|
||||||
anime.imageUrl = imageUrl;
|
|
||||||
anime.link =
|
|
||||||
"/anime/${MBridge.regExp(titleO, "[^A-Za-z0-9 ]", "", 0, 0).replaceAll(" ", "-").toLowerCase()}?lang=$lang&s=$ind";
|
|
||||||
|
|
||||||
animeList.add(anime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return animeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
getVideoList(MManga 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.hasError) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
final animeByTitleOJson = databaseAnimeByTitleO(res.body, 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;
|
|
||||||
List<String> vostfrPlayers = vo["lecteurs"];
|
|
||||||
List<String> vfPlayers = vf["lecteurs"];
|
|
||||||
List<String> players = [];
|
|
||||||
if (language == "vo" && hasVostfr) {
|
|
||||||
players = vostfrPlayers;
|
|
||||||
} else if (language == "vf" && hasVf) {
|
|
||||||
players = vfPlayers;
|
|
||||||
}
|
|
||||||
List<MVideo> videos = [];
|
|
||||||
for (var i = 0; i < players.length; i++) {
|
|
||||||
String apiUrl = "$videoBaseUrl/$language/$i";
|
|
||||||
String playerName = players[i];
|
|
||||||
|
|
||||||
MVideo video = MVideo();
|
|
||||||
|
|
||||||
final data = {
|
|
||||||
"url": apiUrl,
|
|
||||||
"headers": {"Referer": "https://franime.fr/"},
|
|
||||||
"sourceId": anime.sourceId
|
|
||||||
};
|
|
||||||
final requestPlayerUrl = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (requestPlayerUrl.hasError) {
|
|
||||||
return requestPlayerUrl;
|
|
||||||
}
|
|
||||||
String playerUrl = requestPlayerUrl.body;
|
|
||||||
List<MVideo> a = [];
|
|
||||||
if (playerName.contains("franime_myvi")) {
|
|
||||||
videos.add(video
|
|
||||||
..url = playerUrl
|
|
||||||
..originalUrl = playerUrl
|
|
||||||
..quality = "FRAnime");
|
|
||||||
} 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;
|
|
||||||
}
|
|
||||||
352
anime/src/fr/franime/franime-v0.0.35.dart
Normal file
352
anime/src/fr/franime/franime-v0.0.35.dart
Normal file
@@ -0,0 +1,352 @@
|
|||||||
|
import 'package:mangayomi/bridge_lib.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class FrAnime extends MProvider {
|
||||||
|
FrAnime();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getPopular(MSource source, int page) async {
|
||||||
|
final data = {
|
||||||
|
"url": "https://api.franime.fr/api/animes/",
|
||||||
|
"headers": {"Referer": "https://franime.fr/"}
|
||||||
|
};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
return animeResList(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||||
|
final res = await dataBase();
|
||||||
|
|
||||||
|
List list = json.decode(res);
|
||||||
|
return animeResList(json.encode(list.reversed.toList()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> search(MSource source, String query, int page) async {
|
||||||
|
final res = await dataBase();
|
||||||
|
|
||||||
|
return animeSeachFetch(res, query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MManga> getDetail(MSource source, String url) async {
|
||||||
|
MManga anime = MManga();
|
||||||
|
String language = "vo".toString();
|
||||||
|
if (url.contains("lang=")) {
|
||||||
|
language = substringBefore(substringAfter(url, "lang="), "&");
|
||||||
|
}
|
||||||
|
String stem = substringBefore(substringAfterLast(url, "/"), "?");
|
||||||
|
final res = await dataBase();
|
||||||
|
|
||||||
|
final animeByTitleOJson = databaseAnimeByTitleO(res, stem);
|
||||||
|
final seasons = json.decode(animeByTitleOJson)["saisons"];
|
||||||
|
|
||||||
|
var seasonsJson = seasons.first;
|
||||||
|
|
||||||
|
if (url.contains("s=")) {
|
||||||
|
int seasonNumber =
|
||||||
|
int.parse(substringBefore(substringAfter(url, "s="), "&"));
|
||||||
|
seasonsJson = seasons[seasonNumber - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MChapter>? episodesList = [];
|
||||||
|
|
||||||
|
final episodes = seasonsJson["episodes"];
|
||||||
|
|
||||||
|
for (int i = 0; i < episodes.length; i++) {
|
||||||
|
final ep = episodes[i];
|
||||||
|
|
||||||
|
final lang = ep["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) {
|
||||||
|
MChapter episode = MChapter();
|
||||||
|
episode.url = "$url&ep=${i + 1}";
|
||||||
|
String title = ep["title"];
|
||||||
|
episode.name = title.replaceAll('"', "");
|
||||||
|
episodesList.add(episode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.chapters = episodesList.reversed.toList();
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<MVideo>> getVideoList(MSource source, String url) async {
|
||||||
|
String language = "vo".toString();
|
||||||
|
String videoBaseUrl = "https://api.franime.fr/api/anime".toString();
|
||||||
|
if (url.contains("lang=")) {
|
||||||
|
language = substringBefore(substringAfter(url, "lang="), "&");
|
||||||
|
}
|
||||||
|
String stem = substringBefore(substringAfterLast(url, "/"), "?");
|
||||||
|
final res = await dataBase();
|
||||||
|
|
||||||
|
final animeByTitleOJson = databaseAnimeByTitleO(res, stem);
|
||||||
|
final animeId = json.decode(animeByTitleOJson)["id"];
|
||||||
|
final seasons = json.decode(animeByTitleOJson)["saisons"];
|
||||||
|
|
||||||
|
var seasonsJson = seasons.first;
|
||||||
|
|
||||||
|
videoBaseUrl += "/$animeId/";
|
||||||
|
|
||||||
|
if (url.contains("s=")) {
|
||||||
|
int seasonNumber =
|
||||||
|
int.parse(substringBefore(substringAfter(url, "s="), "&"));
|
||||||
|
print(seasonNumber);
|
||||||
|
videoBaseUrl += "${seasonNumber - 1}/";
|
||||||
|
seasonsJson = seasons[seasonNumber - 1];
|
||||||
|
} else {
|
||||||
|
videoBaseUrl += "0/";
|
||||||
|
}
|
||||||
|
final episodesJson = seasonsJson["episodes"];
|
||||||
|
var episode = episodesJson.first;
|
||||||
|
if (url.contains("ep=")) {
|
||||||
|
int episodeNumber = int.parse(substringAfter(url, "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;
|
||||||
|
List<String> vostfrPlayers = vo["lecteurs"];
|
||||||
|
List<String> vfPlayers = vf["lecteurs"];
|
||||||
|
List<String> players = [];
|
||||||
|
if (language == "vo" && hasVostfr) {
|
||||||
|
players = vostfrPlayers;
|
||||||
|
} else if (language == "vf" && hasVf) {
|
||||||
|
players = vfPlayers;
|
||||||
|
}
|
||||||
|
List<MVideo> videos = [];
|
||||||
|
for (var i = 0; i < players.length; i++) {
|
||||||
|
String apiUrl = "$videoBaseUrl/$language/$i";
|
||||||
|
String playerName = players[i];
|
||||||
|
|
||||||
|
MVideo video = MVideo();
|
||||||
|
|
||||||
|
final data = {
|
||||||
|
"url": apiUrl,
|
||||||
|
"headers": {"Referer": "https://franime.fr/"}
|
||||||
|
};
|
||||||
|
final playerUrl = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MVideo> a = [];
|
||||||
|
if (playerName.contains("vido")) {
|
||||||
|
videos.add(video
|
||||||
|
..url = playerUrl
|
||||||
|
..originalUrl = playerUrl
|
||||||
|
..quality = "FRAnime (Vido)");
|
||||||
|
} else if (playerName.contains("myvi")) {
|
||||||
|
a = await myTvExtractor(playerUrl);
|
||||||
|
} else if (playerName.contains("sendvid")) {
|
||||||
|
a = await sendVidExtractor(
|
||||||
|
playerUrl, json.encode({"Referer": "https://franime.fr/"}), "");
|
||||||
|
} else if (playerName.contains("sibnet")) {
|
||||||
|
a = await sibnetExtractor(playerUrl);
|
||||||
|
}
|
||||||
|
videos.addAll(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
return videos;
|
||||||
|
}
|
||||||
|
|
||||||
|
MPages animeResList(String res) {
|
||||||
|
final statusList = [
|
||||||
|
{"EN COURS": 0, "TERMINÉ": 1}
|
||||||
|
];
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
|
||||||
|
var jsonResList = json.decode(res);
|
||||||
|
|
||||||
|
for (var animeJson in jsonResList) {
|
||||||
|
final seasons = animeJson["saisons"];
|
||||||
|
List<bool> vostfrListName = [];
|
||||||
|
List<bool> 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 = parseStatus(animeJson["status"], statusList);
|
||||||
|
final imageUrl = animeJson["affiche"];
|
||||||
|
bool hasVostfr = vostfrListName.contains(true);
|
||||||
|
bool hasVf = vfListName.contains(true);
|
||||||
|
if (hasVostfr || hasVf) {
|
||||||
|
for (int i = 0; i < seasons.length; i++) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
int ind = i + 1;
|
||||||
|
anime.genre = genre;
|
||||||
|
anime.description = description;
|
||||||
|
String seasonTitle = "".toString();
|
||||||
|
String lang = "";
|
||||||
|
if (title.isEmpty) {
|
||||||
|
seasonTitle = titleO;
|
||||||
|
} else {
|
||||||
|
seasonTitle = title;
|
||||||
|
}
|
||||||
|
if (seasons.length > 1) {
|
||||||
|
seasonTitle += " S$ind";
|
||||||
|
}
|
||||||
|
if (hasVf) {
|
||||||
|
seasonTitle += " VF";
|
||||||
|
lang = "vf".toString();
|
||||||
|
}
|
||||||
|
if (hasVostfr) {
|
||||||
|
seasonTitle += " VOSTFR";
|
||||||
|
lang = "vo".toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.status = status;
|
||||||
|
anime.name = seasonTitle;
|
||||||
|
anime.imageUrl = imageUrl;
|
||||||
|
anime.link =
|
||||||
|
"/anime/${regExp(titleO, "[^A-Za-z0-9 ]", "", 0, 0).replaceAll(" ", "-").toLowerCase()}?lang=$lang&s=$ind";
|
||||||
|
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return MPages(animeList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
MPages animeSeachFetch(String res, String query) {
|
||||||
|
final statusList = [
|
||||||
|
{"EN COURS": 0, "TERMINÉ": 1}
|
||||||
|
];
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
final jsonResList = json.decode(res);
|
||||||
|
for (var animeJson in jsonResList) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
|
||||||
|
final titleO = getMapValue(json.encode(animeJson), "titleO");
|
||||||
|
final titleAlt =
|
||||||
|
getMapValue(json.encode(animeJson), "titles", encode: true);
|
||||||
|
final containsEn = getMapValue(titleAlt, "en")
|
||||||
|
.toString()
|
||||||
|
.toLowerCase()
|
||||||
|
.contains(query.toLowerCase());
|
||||||
|
final containsEnJp = getMapValue(titleAlt, "en_jp")
|
||||||
|
.toString()
|
||||||
|
.toLowerCase()
|
||||||
|
.contains(query.toLowerCase());
|
||||||
|
final containsJaJp = getMapValue(titleAlt, "ja_jp")
|
||||||
|
.toString()
|
||||||
|
.toLowerCase()
|
||||||
|
.contains(query.toLowerCase());
|
||||||
|
final containsTitleO = titleO.toLowerCase().contains(query.toLowerCase());
|
||||||
|
|
||||||
|
if (containsEn || containsEnJp || containsJaJp || containsTitleO) {
|
||||||
|
final seasons = animeJson["saisons"];
|
||||||
|
List<bool> vostfrListName = [];
|
||||||
|
List<bool> 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 = parseStatus(animeJson["status"], statusList);
|
||||||
|
final imageUrl = animeJson["affiche"];
|
||||||
|
|
||||||
|
bool hasVostfr = vostfrListName.contains(true);
|
||||||
|
bool hasVf = vfListName.contains(true);
|
||||||
|
if (hasVostfr || hasVf) {
|
||||||
|
for (int i = 0; i < seasons.length; i++) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
int ind = i + 1;
|
||||||
|
anime.genre = genre;
|
||||||
|
anime.description = description;
|
||||||
|
String seasonTitle = "".toString();
|
||||||
|
String lang = "";
|
||||||
|
if (title.isEmpty) {
|
||||||
|
seasonTitle = titleO;
|
||||||
|
} else {
|
||||||
|
seasonTitle = title;
|
||||||
|
}
|
||||||
|
if (seasons.length > 1) {
|
||||||
|
seasonTitle += " S$ind";
|
||||||
|
}
|
||||||
|
if (hasVf) {
|
||||||
|
seasonTitle += " VF";
|
||||||
|
lang = "vf".toString();
|
||||||
|
}
|
||||||
|
if (hasVostfr) {
|
||||||
|
seasonTitle += " VOSTFR";
|
||||||
|
lang = "vo".toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.status = status;
|
||||||
|
anime.name = seasonTitle;
|
||||||
|
anime.imageUrl = imageUrl;
|
||||||
|
anime.link =
|
||||||
|
"/anime/${regExp(titleO, "[^A-Za-z0-9 ]", "", 0, 0).replaceAll(" ", "-").toLowerCase()}?lang=$lang&s=$ind";
|
||||||
|
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return MPages(animeList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<String> dataBase() async {
|
||||||
|
final data = {
|
||||||
|
"url": "https://api.franime.fr/api/animes/",
|
||||||
|
"headers": {"Referer": "https://franime.fr/"}
|
||||||
|
};
|
||||||
|
|
||||||
|
return await http('GET', json.encode(data));
|
||||||
|
}
|
||||||
|
|
||||||
|
String databaseAnimeByTitleO(String res, String titleO) {
|
||||||
|
print(titleO);
|
||||||
|
final datas = json.decode(res) as List;
|
||||||
|
for (var data in datas) {
|
||||||
|
if (regExp(data["titleO"], "[^A-Za-z0-9 ]", "", 0, 0)
|
||||||
|
.replaceAll(" ", "-")
|
||||||
|
.toLowerCase() ==
|
||||||
|
"${titleO}") {
|
||||||
|
return json.encode(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FrAnime main() {
|
||||||
|
return FrAnime();
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ import '../../../../model/source.dart';
|
|||||||
import '../../../../utils/utils.dart';
|
import '../../../../utils/utils.dart';
|
||||||
|
|
||||||
Source get franimeSource => _franimeSource;
|
Source get franimeSource => _franimeSource;
|
||||||
const franimeVersion = "0.0.3";
|
const franimeVersion = "0.0.35";
|
||||||
const franimeSourceCodeUrl =
|
const franimeSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/fr/franime/franime-v$franimeVersion.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/fr/franime/franime-v$franimeVersion.dart";
|
||||||
Source _franimeSource = Source(
|
Source _franimeSource = Source(
|
||||||
|
|||||||
@@ -1,200 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
getPopularAnime(MManga anime) async {
|
|
||||||
final data = {
|
|
||||||
"url": "${anime.baseUrl}/toute-la-liste-affiches/page/${anime.page}/?q=."
|
|
||||||
};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
anime.urls =
|
|
||||||
MBridge.xpath(res, '//*[@class="list"]/article/div/div/figure/a/@href');
|
|
||||||
anime.names = MBridge.xpath(
|
|
||||||
res, '//*[@class="list"]/article/div/div/figure/a/img/@title');
|
|
||||||
anime.images = MBridge.xpath(
|
|
||||||
res, '//*[@class="list"]/article/div/div/figure/a/img/@src');
|
|
||||||
final nextPage = MBridge.xpath(res, '//a[@class="next page-link"]/@href');
|
|
||||||
if (nextPage.isEmpty) {
|
|
||||||
anime.hasNextPage = false;
|
|
||||||
} else {
|
|
||||||
anime.hasNextPage = true;
|
|
||||||
}
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesAnime(MManga anime) async {
|
|
||||||
final data = {"url": "${anime.baseUrl}/page/${anime.page}/"};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
anime.urls = MBridge.xpath(res, '//*[@class="episode"]/div/a/@href');
|
|
||||||
final namess = MBridge.xpath(res, '//*[@class="episode"]/div/a/text()');
|
|
||||||
List<String> names = [];
|
|
||||||
for (var name in namess) {
|
|
||||||
names.add(MBridge.regExp(
|
|
||||||
name,
|
|
||||||
r'(?<=\bS\d\s*|)\d{2}\s*(?=\b(Vostfr|vostfr|VF|Vf|vf|\(VF\)|\(vf\)|\(Vf\)|\(Vostfr\)\b))?',
|
|
||||||
'',
|
|
||||||
0,
|
|
||||||
0)
|
|
||||||
.replaceAll(' vostfr', '')
|
|
||||||
.replaceAll(' Vostfr', '')
|
|
||||||
.replaceAll(' VF', '')
|
|
||||||
.replaceAll(' Vf', '')
|
|
||||||
.replaceAll(' vf', '')
|
|
||||||
.replaceAll(' (VF)', '')
|
|
||||||
.replaceAll(' (vf)', '')
|
|
||||||
.replaceAll(' (vf)', '')
|
|
||||||
.replaceAll(' (Vf)', '')
|
|
||||||
.replaceAll(' (Vostfr)', ''));
|
|
||||||
}
|
|
||||||
anime.names = names;
|
|
||||||
anime.images =
|
|
||||||
MBridge.xpath(res, '//*[@class="episode"]/div/figure/a/img/@src');
|
|
||||||
final nextPage = MBridge.xpath(res, '//a[@class="next page-link"]/@href');
|
|
||||||
if (nextPage.isEmpty) {
|
|
||||||
anime.hasNextPage = false;
|
|
||||||
} else {
|
|
||||||
anime.hasNextPage = true;
|
|
||||||
}
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getAnimeDetail(MManga anime) async {
|
|
||||||
final statusList = [
|
|
||||||
{
|
|
||||||
"En cours": 0,
|
|
||||||
"Terminé": 1,
|
|
||||||
}
|
|
||||||
];
|
|
||||||
final url = anime.link;
|
|
||||||
final data = {"url": url};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
|
|
||||||
final originalUrl = MBridge.xpath(res,
|
|
||||||
'//*[@class="breadcrumb"]/li[@class="breadcrumb-item"][2]/a/@href')
|
|
||||||
.first;
|
|
||||||
if (originalUrl.isNotEmpty) {
|
|
||||||
final newData = {"url": originalUrl};
|
|
||||||
final newResponse = await MBridge.http('GET', json.encode(newData));
|
|
||||||
if (newResponse.hasError) {
|
|
||||||
return newResponse;
|
|
||||||
}
|
|
||||||
res = newResponse.body;
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
anime.description =
|
|
||||||
MBridge.xpath(res, '//*[@class="episode fz-sm synop"]/p/text()')
|
|
||||||
.first
|
|
||||||
.replaceAll("Synopsis:", "");
|
|
||||||
final status = MBridge.xpath(res,
|
|
||||||
'//*[@class="list-unstyled"]/li[contains(text(),"Statut")]/text()')
|
|
||||||
.first
|
|
||||||
.replaceAll("Statut: ", "");
|
|
||||||
anime.status = MBridge.parseStatus(status, statusList);
|
|
||||||
anime.genre = MBridge.xpath(res,
|
|
||||||
'//*[@class="list-unstyled"]/li[contains(text(),"Genre")]/ul/li/a/text()');
|
|
||||||
|
|
||||||
anime.urls =
|
|
||||||
MBridge.xpath(res, '//*[@class="list-episodes list-group"]/a/@href');
|
|
||||||
final dates = MBridge.xpath(
|
|
||||||
res, '//*[@class="list-episodes list-group"]/a/span/text()');
|
|
||||||
final names =
|
|
||||||
MBridge.xpath(res, '//*[@class="list-episodes list-group"]/a/text()');
|
|
||||||
|
|
||||||
List<String> episodes = [];
|
|
||||||
for (var i = 0; i < names.length; i++) {
|
|
||||||
final date = dates[i];
|
|
||||||
final name = names[i];
|
|
||||||
episodes.add(
|
|
||||||
"Episode ${MBridge.regExp(name.replaceAll(date, ""), r".* (\d*) [VvfF]{1,1}", '', 1, 1)}");
|
|
||||||
}
|
|
||||||
anime.names = episodes;
|
|
||||||
anime.chaptersDateUploads =
|
|
||||||
MBridge.listParseDateTime(dates, "dd MMMM yyyy", "fr");
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
searchAnime(MManga anime) async {
|
|
||||||
final data = {
|
|
||||||
"url":
|
|
||||||
"${anime.baseUrl}/toute-la-liste-affiches/page/${anime.page}/?q=${anime.query}"
|
|
||||||
};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
|
|
||||||
anime.urls =
|
|
||||||
MBridge.xpath(res, '//*[@class="list"]/article/div/div/figure/a/@href');
|
|
||||||
|
|
||||||
anime.names = MBridge.xpath(
|
|
||||||
res, '//*[@class="list"]/article/div/div/figure/a/img/@title');
|
|
||||||
anime.images = MBridge.xpath(
|
|
||||||
res, '//*[@class="list"]/article/div/div/figure/a/img/@src');
|
|
||||||
final nextPage = MBridge.xpath(res, '//a[@class="next page-link"]/@href');
|
|
||||||
if (nextPage.isEmpty) {
|
|
||||||
anime.hasNextPage = false;
|
|
||||||
} else {
|
|
||||||
anime.hasNextPage = true;
|
|
||||||
}
|
|
||||||
return anime;
|
|
||||||
}
|
|
||||||
|
|
||||||
getVideoList(MManga anime) async {
|
|
||||||
final datas = {"url": anime.link};
|
|
||||||
|
|
||||||
final res = await MBridge.http('GET', json.encode(datas));
|
|
||||||
|
|
||||||
if (res.hasError) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
final servers =
|
|
||||||
MBridge.xpath(res.body, '//*[@id="nav-tabContent"]/div/iframe/@src');
|
|
||||||
List<MVideo> videos = [];
|
|
||||||
for (var url in servers) {
|
|
||||||
final datasServer = {
|
|
||||||
"url": fixUrl(url),
|
|
||||||
"headers": {"X-Requested-With": "XMLHttpRequest"}
|
|
||||||
};
|
|
||||||
|
|
||||||
final responseResServer =
|
|
||||||
await MBridge.http('GET', json.encode(datasServer));
|
|
||||||
String resServer = responseResServer.body;
|
|
||||||
final serverUrl =
|
|
||||||
fixUrl(MBridge.regExp(resServer, r"data-url='([^']+)'", '', 1, 1));
|
|
||||||
List<MVideo> a = [];
|
|
||||||
if (serverUrl.contains("https://streamwish")) {
|
|
||||||
a = await MBridge.streamWishExtractor(serverUrl, "StreamWish");
|
|
||||||
} else if (serverUrl.contains("sibnet")) {
|
|
||||||
a = await MBridge.sibnetExtractor(serverUrl);
|
|
||||||
} else if (serverUrl.contains("https://doo")) {
|
|
||||||
a = await MBridge.doodExtractor(serverUrl);
|
|
||||||
} else if (serverUrl.contains("https://voe.sx")) {
|
|
||||||
a = await MBridge.voeExtractor(serverUrl, null);
|
|
||||||
} else if (serverUrl.contains("https://ok.ru")) {
|
|
||||||
a = await MBridge.okruExtractor(serverUrl);
|
|
||||||
}
|
|
||||||
for (var vi in a) {
|
|
||||||
videos.add(vi);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return videos;
|
|
||||||
}
|
|
||||||
|
|
||||||
String fixUrl(String url) {
|
|
||||||
return MBridge.regExp(url, r"^(?:(?:https?:)?//|www\.)", 'https://', 0, 0);
|
|
||||||
}
|
|
||||||
196
anime/src/fr/otakufr/otakufr-v0.0.35.dart
Normal file
196
anime/src/fr/otakufr/otakufr-v0.0.35.dart
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
import 'package:mangayomi/bridge_lib.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class OtakuFr extends MProvider {
|
||||||
|
OtakuFr();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getPopular(MSource source, int page) async {
|
||||||
|
final data = {
|
||||||
|
"url": "${source.baseUrl}/toute-la-liste-affiches/page/$page/?q=."
|
||||||
|
};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
final urls =
|
||||||
|
xpath(res, '//*[@class="list"]/article/div/div/figure/a/@href');
|
||||||
|
final names =
|
||||||
|
xpath(res, '//*[@class="list"]/article/div/div/figure/a/img/@title');
|
||||||
|
final images =
|
||||||
|
xpath(res, '//*[@class="list"]/article/div/div/figure/a/img/@src');
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.name = names[i];
|
||||||
|
anime.imageUrl = images[i];
|
||||||
|
anime.link = urls[i];
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
final nextPage = xpath(res, '//a[@class="next page-link"]/@href');
|
||||||
|
return MPages(animeList, nextPage.isNotEmpty);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||||
|
final data = {"url": "${source.baseUrl}/page/$page/"};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
final urls = xpath(res, '//*[@class="episode"]/div/a/@href');
|
||||||
|
final namess = xpath(res, '//*[@class="episode"]/div/a/text()');
|
||||||
|
List<String> names = [];
|
||||||
|
for (var name in namess) {
|
||||||
|
names.add(regExp(
|
||||||
|
name,
|
||||||
|
r'(?<=\bS\d\s*|)\d{2}\s*(?=\b(Vostfr|vostfr|VF|Vf|vf|\(VF\)|\(vf\)|\(Vf\)|\(Vostfr\)\b))?',
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
0)
|
||||||
|
.replaceAll(' vostfr', '')
|
||||||
|
.replaceAll(' Vostfr', '')
|
||||||
|
.replaceAll(' VF', '')
|
||||||
|
.replaceAll(' Vf', '')
|
||||||
|
.replaceAll(' vf', '')
|
||||||
|
.replaceAll(' (VF)', '')
|
||||||
|
.replaceAll(' (vf)', '')
|
||||||
|
.replaceAll(' (vf)', '')
|
||||||
|
.replaceAll(' (Vf)', '')
|
||||||
|
.replaceAll(' (Vostfr)', ''));
|
||||||
|
}
|
||||||
|
final images = xpath(res, '//*[@class="episode"]/div/figure/a/img/@src');
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.name = names[i];
|
||||||
|
anime.imageUrl = images[i];
|
||||||
|
anime.link = urls[i];
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
final nextPage = xpath(res, '//a[@class="next page-link"]/@href');
|
||||||
|
return MPages(animeList, nextPage.isNotEmpty);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> search(MSource source, String query, int page) async {
|
||||||
|
final data = {
|
||||||
|
"url": "${source.baseUrl}/toute-la-liste-affiches/page/$page/?q=$query"
|
||||||
|
};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> animeList = [];
|
||||||
|
final urls =
|
||||||
|
xpath(res, '//*[@class="list"]/article/div/div/figure/a/@href');
|
||||||
|
final names =
|
||||||
|
xpath(res, '//*[@class="list"]/article/div/div/figure/a/img/@title');
|
||||||
|
final images =
|
||||||
|
xpath(res, '//*[@class="list"]/article/div/div/figure/a/img/@src');
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga anime = MManga();
|
||||||
|
anime.name = names[i];
|
||||||
|
anime.imageUrl = images[i];
|
||||||
|
anime.link = urls[i];
|
||||||
|
animeList.add(anime);
|
||||||
|
}
|
||||||
|
final nextPage = xpath(res, '//a[@class="next page-link"]/@href');
|
||||||
|
return MPages(animeList, nextPage.isNotEmpty);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MManga> getDetail(MSource source, String url) async {
|
||||||
|
final statusList = [
|
||||||
|
{
|
||||||
|
"En cours": 0,
|
||||||
|
"Terminé": 1,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
final data = {"url": url};
|
||||||
|
String res = await http('GET', json.encode(data));
|
||||||
|
MManga anime = MManga();
|
||||||
|
final originalUrl = xpath(res,
|
||||||
|
'//*[@class="breadcrumb"]/li[@class="breadcrumb-item"][2]/a/@href')
|
||||||
|
.first;
|
||||||
|
if (originalUrl.isNotEmpty) {
|
||||||
|
final newData = {"url": originalUrl};
|
||||||
|
res = await http('GET', json.encode(newData));
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.description = xpath(res, '//*[@class="episode fz-sm synop"]/p/text()')
|
||||||
|
.first
|
||||||
|
.replaceAll("Synopsis:", "");
|
||||||
|
final status = xpath(res,
|
||||||
|
'//*[@class="list-unstyled"]/li[contains(text(),"Statut")]/text()')
|
||||||
|
.first
|
||||||
|
.replaceAll("Statut: ", "");
|
||||||
|
anime.status = parseStatus(status, statusList);
|
||||||
|
anime.genre = xpath(res,
|
||||||
|
'//*[@class="list-unstyled"]/li[contains(text(),"Genre")]/ul/li/a/text()');
|
||||||
|
|
||||||
|
final epUrls = xpath(res, '//*[@class="list-episodes list-group"]/a/@href');
|
||||||
|
final dates =
|
||||||
|
xpath(res, '//*[@class="list-episodes list-group"]/a/span/text()');
|
||||||
|
final names = xpath(res, '//*[@class="list-episodes list-group"]/a/text()');
|
||||||
|
List<String> episodes = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
final date = dates[i];
|
||||||
|
final name = names[i];
|
||||||
|
episodes.add(
|
||||||
|
"Episode ${regExp(name.replaceAll(date, ""), r".* (\d*) [VvfF]{1,1}", '', 1, 1)}");
|
||||||
|
}
|
||||||
|
final dateUploads = parseDates(dates, "dd MMMM yyyy", "fr");
|
||||||
|
|
||||||
|
List<MChapter>? episodesList = [];
|
||||||
|
for (var i = 0; i < episodes.length; i++) {
|
||||||
|
MChapter episode = MChapter();
|
||||||
|
episode.name = episodes[i];
|
||||||
|
episode.url = epUrls[i];
|
||||||
|
episode.dateUpload = dateUploads[i];
|
||||||
|
episodesList.add(episode);
|
||||||
|
}
|
||||||
|
|
||||||
|
anime.chapters = episodesList;
|
||||||
|
return anime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<MVideo>> getVideoList(MSource source, String url) async {
|
||||||
|
final res = await http('GET', json.encode({"url": url}));
|
||||||
|
|
||||||
|
final servers = xpath(res, '//*[@id="nav-tabContent"]/div/iframe/@src');
|
||||||
|
List<MVideo> videos = [];
|
||||||
|
for (var url in servers) {
|
||||||
|
final datasServer = {
|
||||||
|
"url": fixUrl(url),
|
||||||
|
"headers": {"X-Requested-With": "XMLHttpRequest"}
|
||||||
|
};
|
||||||
|
|
||||||
|
final resServer = await http('GET', json.encode(datasServer));
|
||||||
|
final serverUrl =
|
||||||
|
fixUrl(regExp(resServer, r"data-url='([^']+)'", '', 1, 1));
|
||||||
|
List<MVideo> a = [];
|
||||||
|
if (serverUrl.contains("https://streamwish")) {
|
||||||
|
a = await streamWishExtractor(serverUrl, "StreamWish");
|
||||||
|
} else if (serverUrl.contains("sibnet")) {
|
||||||
|
a = await sibnetExtractor(serverUrl);
|
||||||
|
} else if (serverUrl.contains("https://doo")) {
|
||||||
|
a = await doodExtractor(serverUrl);
|
||||||
|
} else if (serverUrl.contains("https://voe.sx")) {
|
||||||
|
a = await voeExtractor(serverUrl, null);
|
||||||
|
} else if (serverUrl.contains("https://ok.ru")) {
|
||||||
|
a = await okruExtractor(serverUrl);
|
||||||
|
}
|
||||||
|
videos.addAll(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
return videos;
|
||||||
|
}
|
||||||
|
|
||||||
|
String fixUrl(String url) {
|
||||||
|
return regExp(url, r"^(?:(?:https?:)?//|www\.)", 'https://', 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OtakuFr main() {
|
||||||
|
return OtakuFr();
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ import '../../../../model/source.dart';
|
|||||||
import '../../../../utils/utils.dart';
|
import '../../../../utils/utils.dart';
|
||||||
|
|
||||||
Source get otakufr => _otakufr;
|
Source get otakufr => _otakufr;
|
||||||
const otakufrVersion = "0.0.3";
|
const otakufrVersion = "0.0.35";
|
||||||
const otakufrCodeUrl =
|
const otakufrCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/fr/otakufr/otakufr-v$otakufrVersion.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/fr/otakufr/otakufr-v$otakufrVersion.dart";
|
||||||
Source _otakufr = Source(
|
Source _otakufr = Source(
|
||||||
|
|||||||
BIN
icons/mangayomi-ar-beastscans.png
Normal file
BIN
icons/mangayomi-ar-beastscans.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
BIN
icons/mangayomi-fr-lelmanga.png
Normal file
BIN
icons/mangayomi-fr-lelmanga.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
File diff suppressed because one or more lines are too long
@@ -1,251 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
searchManga(MManga manga) async {
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
MHttpResponse response = MHttpResponse();
|
|
||||||
if (!useNewQueryEndpoint(manga.source)) {
|
|
||||||
final url = "${manga.apiUrl}/series/search";
|
|
||||||
final body = {"term": manga.query};
|
|
||||||
final data = {"url": url, "headers": headers, "body": body};
|
|
||||||
response = await MBridge.http('POST', json.encode(data));
|
|
||||||
} else {
|
|
||||||
final newEndpointUrl =
|
|
||||||
"${manga.apiUrl}/query/?page=${manga.page}&query_string=${manga.query}&series_status=All&order=desc&orderBy=total_views&perPage=12&tags_ids=[]&series_type=Comic";
|
|
||||||
|
|
||||||
final newEndpointData = {"url": newEndpointUrl, "headers": headers};
|
|
||||||
response = await MBridge.http('GET', json.encode(newEndpointData));
|
|
||||||
}
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
return mMangaRes(response, manga);
|
|
||||||
}
|
|
||||||
|
|
||||||
getPopularManga(MManga manga) async {
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
MHttpResponse response = MHttpResponse();
|
|
||||||
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
|
|
||||||
};
|
|
||||||
response = await MBridge.http('POST', json.encode(data));
|
|
||||||
} else {
|
|
||||||
final newEndpointUrl =
|
|
||||||
"${manga.apiUrl}/query/?page=${manga.page}&query_string=&series_status=All&order=desc&orderBy=total_views&perPage=12&tags_ids=[]&series_type=Comic";
|
|
||||||
|
|
||||||
final newEndpointData = {
|
|
||||||
"url": newEndpointUrl,
|
|
||||||
"headers": headers,
|
|
||||||
"sourceId": manga.sourceId
|
|
||||||
};
|
|
||||||
response = await MBridge.http('GET', json.encode(newEndpointData));
|
|
||||||
}
|
|
||||||
return mMangaRes(response, manga);
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesManga(MManga manga) async {
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
MHttpResponse response = MHttpResponse();
|
|
||||||
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
|
|
||||||
};
|
|
||||||
response = await MBridge.http('POST', json.encode(data));
|
|
||||||
} else {
|
|
||||||
final newEndpointUrl =
|
|
||||||
"${manga.apiUrl}/query/?page=${manga.page}&query_string=&series_status=All&order=desc&orderBy=latest&perPage=12&tags_ids=[]&series_type=Comic";
|
|
||||||
|
|
||||||
final newEndpointData = {"url": newEndpointUrl, "headers": headers};
|
|
||||||
response = await MBridge.http('GET', json.encode(newEndpointData));
|
|
||||||
}
|
|
||||||
|
|
||||||
return mMangaRes(response, manga);
|
|
||||||
}
|
|
||||||
|
|
||||||
getMangaDetail(MManga manga) async {
|
|
||||||
String currentSlug = MBridge.substringAfterLast(manga.link, "/");
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
final url = "${manga.apiUrl}/series/$currentSlug";
|
|
||||||
final data = {"url": url, "headers": headers};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.author = MBridge.getMapValue(res, "author");
|
|
||||||
|
|
||||||
manga.description = MBridge.getMapValue(res, "description");
|
|
||||||
manga.genre =
|
|
||||||
MBridge.jsonPathToString(res, r"$.tags[*].name", "._").split("._");
|
|
||||||
List<String> chapterTitles = [];
|
|
||||||
List<String> chapterUrls = [];
|
|
||||||
List<String> chapterDates = [];
|
|
||||||
|
|
||||||
if (!useNewQueryEndpoint(manga.source)) {
|
|
||||||
for (var chapter in json.decode(res)["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);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
final seasons = json.decode(res)["seasons"].first;
|
|
||||||
for (var chapter in seasons["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;
|
|
||||||
}
|
|
||||||
|
|
||||||
getChapterPages(MManga manga) async {
|
|
||||||
MHttpResponse response = MHttpResponse();
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
|
|
||||||
String res = "".toString();
|
|
||||||
if (!useslugStrategy(manga.source)) {
|
|
||||||
String chapterId = MBridge.substringAfter(manga.link, '#');
|
|
||||||
final url = "${manga.apiUrl}/series/chapter/$chapterId";
|
|
||||||
final data = {"url": url, "headers": headers};
|
|
||||||
response = await MBridge.http('GET', json.encode(data));
|
|
||||||
res = response.body;
|
|
||||||
} else {
|
|
||||||
final url = "${manga.baseUrl}${manga.link}";
|
|
||||||
final data = {"url": url, "headers": headers};
|
|
||||||
response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
res = response.body;
|
|
||||||
List<String> pageUrls = [];
|
|
||||||
var imagesRes = MBridge.querySelectorAll(res,
|
|
||||||
selector: "div.min-h-screen > div.container > p.items-center",
|
|
||||||
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 (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
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", "Perf Scan"];
|
|
||||||
return sources.contains(sourceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
MManga mMangaRes(MHttpResponse response, MManga manga) {
|
|
||||||
String res = response.body;
|
|
||||||
List<String> names = [];
|
|
||||||
List<String> urls = [];
|
|
||||||
List<String> images = [];
|
|
||||||
if (res.startsWith("{")) {
|
|
||||||
for (var a in json.decode(res)["data"]) {
|
|
||||||
String thumbnail = a["thumbnail"];
|
|
||||||
if (thumbnail.startsWith("https://")) {
|
|
||||||
images.add(thumbnail);
|
|
||||||
} else {
|
|
||||||
images.add("${manga.apiUrl}/cover/$thumbnail");
|
|
||||||
}
|
|
||||||
names.add(a["title"]);
|
|
||||||
final seriesSlug = a["series_slug"];
|
|
||||||
urls.add("/series/$seriesSlug");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (var a in json.decode(res)) {
|
|
||||||
String thumbnail = a["thumbnail"];
|
|
||||||
if (thumbnail.startsWith("https://")) {
|
|
||||||
images.add(thumbnail);
|
|
||||||
} else {
|
|
||||||
images.add("${manga.apiUrl}/cover/$thumbnail");
|
|
||||||
}
|
|
||||||
names.add(a["title"]);
|
|
||||||
final seriesSlug = a["series_slug"];
|
|
||||||
urls.add("/series/$seriesSlug");
|
|
||||||
}
|
|
||||||
manga.hasNextPage = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
manga.urls = urls;
|
|
||||||
manga.images = images;
|
|
||||||
manga.names = names;
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
241
manga/multisrc/heancms/heancms-v0.0.35.dart
Normal file
241
manga/multisrc/heancms/heancms-v0.0.35.dart
Normal file
@@ -0,0 +1,241 @@
|
|||||||
|
import 'package:mangayomi/bridge_lib.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class HeanCms extends MProvider {
|
||||||
|
HeanCms();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getPopular(MSource source, int page) async {
|
||||||
|
final headers = getHeader(source.baseUrl);
|
||||||
|
String res = "";
|
||||||
|
if (!useNewQueryEndpoint(source.name)) {
|
||||||
|
final url = "${source.apiUrl}/series/querysearch";
|
||||||
|
|
||||||
|
final body = {
|
||||||
|
"page": page,
|
||||||
|
"order": "desc",
|
||||||
|
"order_by": "total_views",
|
||||||
|
"series_status": "Ongoing",
|
||||||
|
"series_type": "Comic"
|
||||||
|
};
|
||||||
|
final data = {"url": url, "headers": headers, "body": body};
|
||||||
|
res = await http('POST', json.encode(data));
|
||||||
|
} else {
|
||||||
|
final newEndpointUrl =
|
||||||
|
"${source.apiUrl}/query/?page=$page&query_string=&series_status=All&order=desc&orderBy=total_views&perPage=12&tags_ids=[]&series_type=Comic";
|
||||||
|
|
||||||
|
final newEndpointData = {"url": newEndpointUrl, "headers": headers};
|
||||||
|
res = await http('GET', json.encode(newEndpointData));
|
||||||
|
}
|
||||||
|
return mMangaRes(res, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||||
|
final headers = getHeader(source.baseUrl);
|
||||||
|
String res = "";
|
||||||
|
if (!useNewQueryEndpoint(source.name)) {
|
||||||
|
final url = "${source.apiUrl}/series/querysearch";
|
||||||
|
final body = {
|
||||||
|
"page": page,
|
||||||
|
"order": "desc",
|
||||||
|
"order_by": "latest",
|
||||||
|
"series_status": "Ongoing",
|
||||||
|
"series_type": "Comic"
|
||||||
|
};
|
||||||
|
final data = {"url": url, "headers": headers, "body": body};
|
||||||
|
res = await http('POST', json.encode(data));
|
||||||
|
} else {
|
||||||
|
final newEndpointUrl =
|
||||||
|
"${source.apiUrl}/query/?page=$page&query_string=&series_status=All&order=desc&orderBy=latest&perPage=12&tags_ids=[]&series_type=Comic";
|
||||||
|
|
||||||
|
final newEndpointData = {"url": newEndpointUrl, "headers": headers};
|
||||||
|
res = await http('GET', json.encode(newEndpointData));
|
||||||
|
}
|
||||||
|
return mMangaRes(res, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> search(MSource source, String query, int page) async {
|
||||||
|
final headers = getHeader(source.baseUrl);
|
||||||
|
String res = "";
|
||||||
|
if (!useNewQueryEndpoint(source.source)) {
|
||||||
|
final url = "${source.apiUrl}/series/search";
|
||||||
|
final body = {"term": query};
|
||||||
|
final data = {"url": url, "headers": headers, "body": body};
|
||||||
|
res = await http('POST', json.encode(data));
|
||||||
|
} else {
|
||||||
|
final newEndpointUrl =
|
||||||
|
"${source.apiUrl}/query/?page=$page&query_string=$query&series_status=All&order=desc&orderBy=total_views&perPage=12&tags_ids=[]&series_type=Comic";
|
||||||
|
|
||||||
|
final newEndpointData = {"url": newEndpointUrl, "headers": headers};
|
||||||
|
res = await http('GET', json.encode(newEndpointData));
|
||||||
|
}
|
||||||
|
return mMangaRes(res, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MManga> getDetail(MSource source, String url) async {
|
||||||
|
MManga manga = MManga();
|
||||||
|
String currentSlug = substringAfterLast(url, "/");
|
||||||
|
final headers = getHeader(source.baseUrl);
|
||||||
|
final data = {
|
||||||
|
"url": "${source.apiUrl}/series/$currentSlug",
|
||||||
|
"headers": headers
|
||||||
|
};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
manga.author = getMapValue(res, "author");
|
||||||
|
manga.description = getMapValue(res, "description");
|
||||||
|
manga.genre = jsonPathToString(res, r"$.tags[*].name", "._").split("._");
|
||||||
|
List<String> chapterTitles = [];
|
||||||
|
List<String> chapterUrls = [];
|
||||||
|
List<String> chapterDates = [];
|
||||||
|
|
||||||
|
if (!useNewQueryEndpoint(source.name)) {
|
||||||
|
for (var chapter in json.decode(res)["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);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final seasons = json.decode(res)["seasons"].first;
|
||||||
|
for (var chapter in seasons["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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final dateUploads = parseDates(chapterDates, "dd MMMM yyyy", "fr");
|
||||||
|
List<MChapter>? chaptersList = [];
|
||||||
|
for (var i = 0; i < chapterTitles.length; i++) {
|
||||||
|
MChapter chapter = MChapter();
|
||||||
|
chapter.name = chapterTitles[i];
|
||||||
|
chapter.url = chapterUrls[i];
|
||||||
|
chapter.dateUpload = dateUploads[i];
|
||||||
|
chaptersList.add(chapter);
|
||||||
|
}
|
||||||
|
if (!useNewQueryEndpoint(source.name)) {
|
||||||
|
chaptersList = chaptersList.reversed.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
manga.chapters = chaptersList;
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<String>> getPageList(MSource source, String url) async {
|
||||||
|
final headers = getHeader(source.baseUrl);
|
||||||
|
|
||||||
|
String res = "".toString();
|
||||||
|
if (!useslugStrategy(source.name)) {
|
||||||
|
String chapterId = substringAfter(url, '#');
|
||||||
|
final data = {
|
||||||
|
"url": "${source.apiUrl}/series/chapter/$chapterId",
|
||||||
|
"headers": headers
|
||||||
|
};
|
||||||
|
res = await http('GET', json.encode(data));
|
||||||
|
} else {
|
||||||
|
final data = {"url": "${source.baseUrl}$url", "headers": headers};
|
||||||
|
res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<String> pageUrls = [];
|
||||||
|
var imagesRes = querySelectorAll(res,
|
||||||
|
selector: "div.min-h-screen > div.container > p.items-center",
|
||||||
|
typeElement: 1,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0);
|
||||||
|
pageUrls = xpath(imagesRes.first, '//img/@src');
|
||||||
|
|
||||||
|
pageUrls.addAll(xpath(imagesRes.first, '//img/@data-src'));
|
||||||
|
|
||||||
|
return pageUrls.where((e) => e.isNotEmpty).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
final pages = 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("${source.apiUrl}/$url");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pageUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
MPages mMangaRes(String res, MSource source) {
|
||||||
|
bool hasNextPage = true;
|
||||||
|
List<MManga> mangaList = [];
|
||||||
|
List<String> names = [];
|
||||||
|
List<String> urls = [];
|
||||||
|
List<String> images = [];
|
||||||
|
if (res.startsWith("{")) {
|
||||||
|
for (var a in json.decode(res)["data"]) {
|
||||||
|
String thumbnail = a["thumbnail"];
|
||||||
|
if (thumbnail.startsWith("https://")) {
|
||||||
|
images.add(thumbnail);
|
||||||
|
} else {
|
||||||
|
images.add("${source.apiUrl}/cover/$thumbnail");
|
||||||
|
}
|
||||||
|
names.add(a["title"]);
|
||||||
|
final seriesSlug = a["series_slug"];
|
||||||
|
urls.add("/series/$seriesSlug");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (var a in json.decode(res)) {
|
||||||
|
String thumbnail = a["thumbnail"];
|
||||||
|
if (thumbnail.startsWith("https://")) {
|
||||||
|
images.add(thumbnail);
|
||||||
|
} else {
|
||||||
|
images.add("${source.apiUrl}/cover/$thumbnail");
|
||||||
|
}
|
||||||
|
names.add(a["title"]);
|
||||||
|
final seriesSlug = a["series_slug"];
|
||||||
|
urls.add("/series/$seriesSlug");
|
||||||
|
}
|
||||||
|
hasNextPage = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.name = names[i];
|
||||||
|
manga.imageUrl = images[i];
|
||||||
|
manga.link = urls[i];
|
||||||
|
mangaList.add(manga);
|
||||||
|
}
|
||||||
|
return MPages(mangaList, hasNextPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
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", "Perf Scan"];
|
||||||
|
return sources.contains(sourceName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> getHeader(String url) {
|
||||||
|
final headers = {
|
||||||
|
'Origin': url,
|
||||||
|
'Referer': '$url/',
|
||||||
|
'Accept': 'application/json, text/plain, */*',
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
};
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
HeanCms main() {
|
||||||
|
return HeanCms();
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import '../../../model/source.dart';
|
import '../../../model/source.dart';
|
||||||
import '../../../utils/utils.dart';
|
import '../../../utils/utils.dart';
|
||||||
|
|
||||||
const heancmsVersion = "0.0.3";
|
const heancmsVersion = "0.0.35";
|
||||||
const heancmsSourceCodeUrl =
|
const heancmsSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/heancms/heancms-v$heancmsVersion.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/heancms/heancms-v$heancmsVersion.dart";
|
||||||
const defaultDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ";
|
const defaultDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ";
|
||||||
|
|||||||
@@ -1,289 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
getPopularManga(MManga manga) async {
|
|
||||||
final url = "${manga.baseUrl}/manga/page/${manga.page}/?m_orderby=views";
|
|
||||||
final data = {"url": url, "sourceId": manga.sourceId};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.urls = MBridge.xpath(res, '//*[@class^="post-title"]/h3/a/@href');
|
|
||||||
var images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-src');
|
|
||||||
if (images.isEmpty) {
|
|
||||||
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-lazy-src');
|
|
||||||
if (images.isEmpty) {
|
|
||||||
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@srcset');
|
|
||||||
if (images.isEmpty) {
|
|
||||||
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@src');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
manga.images = images;
|
|
||||||
manga.names = MBridge.xpath(res, '//*[@id^="manga-item"]/a/@title');
|
|
||||||
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getMangaDetail(MManga manga) async {
|
|
||||||
final statusList = [
|
|
||||||
{
|
|
||||||
"OnGoing": 0,
|
|
||||||
"Продолжается": 0,
|
|
||||||
"Updating": 0,
|
|
||||||
"Em Lançamento": 0,
|
|
||||||
"Em lançamento": 0,
|
|
||||||
"Em andamento": 0,
|
|
||||||
"Em Andamento": 0,
|
|
||||||
"En cours": 0,
|
|
||||||
"Ativo": 0,
|
|
||||||
"Lançando": 0,
|
|
||||||
"Đang Tiến Hành": 0,
|
|
||||||
"Devam Ediyor": 0,
|
|
||||||
"Devam ediyor": 0,
|
|
||||||
"In Corso": 0,
|
|
||||||
"In Arrivo": 0,
|
|
||||||
"مستمرة": 0,
|
|
||||||
"مستمر": 0,
|
|
||||||
"En Curso": 0,
|
|
||||||
"En curso": 0,
|
|
||||||
"Emision": 0,
|
|
||||||
"En marcha": 0,
|
|
||||||
"Publicandose": 0,
|
|
||||||
"En emision": 0,
|
|
||||||
"连载中": 0,
|
|
||||||
"Completed": 1,
|
|
||||||
"Completo": 1,
|
|
||||||
"Completado": 1,
|
|
||||||
"Concluído": 1,
|
|
||||||
"Concluido": 1,
|
|
||||||
"Finalizado": 1,
|
|
||||||
"Terminé": 1,
|
|
||||||
"Hoàn Thành": 1,
|
|
||||||
"مكتملة": 1,
|
|
||||||
"مكتمل": 1,
|
|
||||||
"已完结": 1,
|
|
||||||
"On Hold": 2,
|
|
||||||
"Pausado": 2,
|
|
||||||
"En espera": 2,
|
|
||||||
"Canceled": 3,
|
|
||||||
"Cancelado": 3,
|
|
||||||
}
|
|
||||||
];
|
|
||||||
MHttpResponse response = MHttpResponse();
|
|
||||||
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
|
||||||
response = await MBridge.http('GET', json.encode(datas));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.author = MBridge.querySelectorAll(res,
|
|
||||||
selector: "div.author-content > a",
|
|
||||||
typeElement: 0,
|
|
||||||
attributes: "",
|
|
||||||
typeRegExp: 0)
|
|
||||||
.first;
|
|
||||||
manga.description = MBridge.querySelectorAll(res,
|
|
||||||
selector:
|
|
||||||
"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,
|
|
||||||
attributes: "",
|
|
||||||
typeRegExp: 0)
|
|
||||||
.first;
|
|
||||||
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(
|
|
||||||
MBridge.querySelectorAll(res,
|
|
||||||
selector: "div.summary-content",
|
|
||||||
typeElement: 0,
|
|
||||||
attributes: "",
|
|
||||||
typeRegExp: 0)
|
|
||||||
.last,
|
|
||||||
statusList);
|
|
||||||
|
|
||||||
manga.genre = MBridge.querySelectorAll(res,
|
|
||||||
selector: "div.genres-content a",
|
|
||||||
typeElement: 0,
|
|
||||||
attributes: "",
|
|
||||||
typeRegExp: 0);
|
|
||||||
|
|
||||||
final baseUrl = "${manga.baseUrl}/";
|
|
||||||
final headers = {
|
|
||||||
"Referer": baseUrl,
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
|
||||||
"X-Requested-With": "XMLHttpRequest"
|
|
||||||
};
|
|
||||||
final url =
|
|
||||||
"${baseUrl}wp-admin/admin-ajax.php?action=manga_get_chapters&manga=$mangaId";
|
|
||||||
final datasP = {"url": url, "headers": headers, "sourceId": manga.sourceId};
|
|
||||||
|
|
||||||
response = await MBridge.http('POST', json.encode(datasP));
|
|
||||||
if (response.statusCode != 200) {
|
|
||||||
final urlP = "${manga.link}ajax/chapters";
|
|
||||||
final datasP = {
|
|
||||||
"url": urlP,
|
|
||||||
"headers": headers,
|
|
||||||
"sourceId": manga.sourceId
|
|
||||||
};
|
|
||||||
response = await MBridge.http('POST', json.encode(datasP));
|
|
||||||
}
|
|
||||||
|
|
||||||
String resP = response.body;
|
|
||||||
manga.urls = MBridge.xpath(resP, "//li/a/@href");
|
|
||||||
var chaptersNames = MBridge.xpath(resP, "//li/a/text()");
|
|
||||||
|
|
||||||
var dateF = MBridge.xpath(resP, "//li/span/i/text()");
|
|
||||||
if (dateF.isEmpty) {
|
|
||||||
final resWebview = await MBridge.getHtmlViaWebview(manga.link,
|
|
||||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/@href");
|
|
||||||
manga.urls = MBridge.xpath(resWebview,
|
|
||||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/@href");
|
|
||||||
chaptersNames = MBridge.xpath(resWebview,
|
|
||||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/text()");
|
|
||||||
dateF = MBridge.xpath(resWebview,
|
|
||||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/span/i/text()");
|
|
||||||
}
|
|
||||||
|
|
||||||
manga.names = chaptersNames;
|
|
||||||
if (dateF.length == chaptersNames.length) {
|
|
||||||
manga.chaptersDateUploads = MBridge.listParseDateTime(
|
|
||||||
dateF, manga.dateFormat, manga.dateFormatLocale);
|
|
||||||
} else if (dateF.length < chaptersNames.length) {
|
|
||||||
final length = chaptersNames.length - dateF.length;
|
|
||||||
String date = "${DateTime.now().millisecondsSinceEpoch}";
|
|
||||||
for (var i = 0; i < length - 1; i++) {
|
|
||||||
date += "--..${DateTime.now().millisecondsSinceEpoch}";
|
|
||||||
}
|
|
||||||
|
|
||||||
final dateFF = MBridge.listParseDateTime(
|
|
||||||
dateF, manga.dateFormat, manga.dateFormatLocale);
|
|
||||||
List<String> chapterDate = date.split('--..');
|
|
||||||
|
|
||||||
for (var date in dateFF) {
|
|
||||||
chapterDate.add(date);
|
|
||||||
}
|
|
||||||
manga.chaptersDateUploads = chapterDate;
|
|
||||||
}
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getChapterPages(MManga manga) async {
|
|
||||||
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
|
||||||
final response = await MBridge.http('GET', json.encode(datas));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
final pagesSelectorRes = MBridge.querySelectorAll(res,
|
|
||||||
selector:
|
|
||||||
"div.page-break, li.blocks-gallery-item, .reading-content, .text-left img",
|
|
||||||
typeElement: 1,
|
|
||||||
attributes: "",
|
|
||||||
typeRegExp: 0)
|
|
||||||
.first;
|
|
||||||
final imgs = MBridge.querySelectorAll(pagesSelectorRes,
|
|
||||||
selector: "img", typeElement: 2, attributes: "", typeRegExp: 2);
|
|
||||||
var pageUrls = [];
|
|
||||||
|
|
||||||
if (imgs.length == 1) {
|
|
||||||
final pages = MBridge.querySelectorAll(res,
|
|
||||||
selector: "#single-pager",
|
|
||||||
typeElement: 2,
|
|
||||||
attributes: "",
|
|
||||||
typeRegExp: 0)
|
|
||||||
.first;
|
|
||||||
|
|
||||||
final pagesNumber = MBridge.querySelectorAll(pages,
|
|
||||||
selector: "option", typeElement: 2, attributes: "", typeRegExp: 0);
|
|
||||||
|
|
||||||
for (var i = 0; i < pagesNumber.length; i++) {
|
|
||||||
final val = i + 1;
|
|
||||||
if (i.toString().length == 1) {
|
|
||||||
pageUrls.add(MBridge.querySelectorAll(pagesSelectorRes,
|
|
||||||
selector: "img", typeElement: 2, attributes: "", typeRegExp: 2)
|
|
||||||
.first
|
|
||||||
.replaceAll("01", '0$val'));
|
|
||||||
} else {
|
|
||||||
pageUrls.add(MBridge.querySelectorAll(pagesSelectorRes,
|
|
||||||
selector: "img", typeElement: 2, attributes: "", typeRegExp: 2)
|
|
||||||
.first
|
|
||||||
.replaceAll("01", val.toString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return imgs;
|
|
||||||
}
|
|
||||||
return pageUrls;
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesManga(MManga manga) async {
|
|
||||||
final url = "${manga.baseUrl}/manga/page/${manga.page}/?m_orderby=latest";
|
|
||||||
final datas = {"url": url, "sourceId": manga.sourceId};
|
|
||||||
final response = await MBridge.http('GET', json.encode(datas));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.urls = MBridge.xpath(res, '//*[@class^="post-title"]/h3/a/@href');
|
|
||||||
var images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-src');
|
|
||||||
if (images.isEmpty) {
|
|
||||||
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-lazy-src');
|
|
||||||
if (images.isEmpty) {
|
|
||||||
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@srcset');
|
|
||||||
if (images.isEmpty) {
|
|
||||||
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@src');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
manga.images = images;
|
|
||||||
manga.names = MBridge.xpath(res, '//*[@id^="manga-item"]/a/@title');
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
searchManga(MManga manga) async {
|
|
||||||
final urll = "${manga.baseUrl}/?s=${manga.query}&post_type=wp-manga";
|
|
||||||
final datas = {"url": urll, "sourceId": manga.sourceId};
|
|
||||||
final response = await MBridge.http('GET', json.encode(datas));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.urls =
|
|
||||||
MBridge.xpath(res, '//*[@class^="tab-thumb c-image-hover"]/a/@href');
|
|
||||||
var images = MBridge.xpath(
|
|
||||||
res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@data-src');
|
|
||||||
if (images.isEmpty) {
|
|
||||||
images = MBridge.xpath(
|
|
||||||
res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@data-lazy-src');
|
|
||||||
if (images.isEmpty) {
|
|
||||||
images = MBridge.xpath(
|
|
||||||
res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@srcset');
|
|
||||||
if (images.isEmpty) {
|
|
||||||
images = MBridge.xpath(
|
|
||||||
res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@src');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
manga.images = images;
|
|
||||||
manga.names =
|
|
||||||
MBridge.xpath(res, '//*[@class^="tab-thumb c-image-hover"]/a/@title');
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, String> getHeader(String url) {
|
|
||||||
final headers = {
|
|
||||||
"Referer": "$url/",
|
|
||||||
};
|
|
||||||
return headers;
|
|
||||||
}
|
|
||||||
319
manga/multisrc/madara/madara-v0.0.35.dart
Normal file
319
manga/multisrc/madara/madara-v0.0.35.dart
Normal file
@@ -0,0 +1,319 @@
|
|||||||
|
import 'package:mangayomi/bridge_lib.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class Madara extends MProvider {
|
||||||
|
Madara();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getPopular(MSource source, int page) async {
|
||||||
|
final url = "${source.baseUrl}/manga/page/$page/?m_orderby=views";
|
||||||
|
final data = {"url": url, "sourceId": source.id};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> mangaList = [];
|
||||||
|
final urls = xpath(res, '//*[@class^="post-title"]/h3/a/@href');
|
||||||
|
final names = xpath(res, '//*[@id^="manga-item"]/a/@title');
|
||||||
|
var images = xpath(res, '//*[@id^="manga-item"]/a/img/@data-src');
|
||||||
|
if (images.isEmpty) {
|
||||||
|
images = xpath(res, '//*[@id^="manga-item"]/a/img/@data-lazy-src');
|
||||||
|
if (images.isEmpty) {
|
||||||
|
images = xpath(res, '//*[@id^="manga-item"]/a/img/@srcset');
|
||||||
|
if (images.isEmpty) {
|
||||||
|
images = xpath(res, '//*[@id^="manga-item"]/a/img/@src');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.name = names[i];
|
||||||
|
manga.imageUrl = images[i];
|
||||||
|
manga.link = urls[i];
|
||||||
|
mangaList.add(manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(mangaList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||||
|
final url = "${source.baseUrl}/manga/page/$page/?m_orderby=latest";
|
||||||
|
final data = {"url": url, "sourceId": source.id};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> mangaList = [];
|
||||||
|
final urls = xpath(res, '//*[@class^="post-title"]/h3/a/@href');
|
||||||
|
final names = xpath(res, '//*[@id^="manga-item"]/a/@title');
|
||||||
|
var images = xpath(res, '//*[@id^="manga-item"]/a/img/@data-src');
|
||||||
|
if (images.isEmpty) {
|
||||||
|
images = xpath(res, '//*[@id^="manga-item"]/a/img/@data-lazy-src');
|
||||||
|
if (images.isEmpty) {
|
||||||
|
images = xpath(res, '//*[@id^="manga-item"]/a/img/@srcset');
|
||||||
|
if (images.isEmpty) {
|
||||||
|
images = xpath(res, '//*[@id^="manga-item"]/a/img/@src');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.name = names[i];
|
||||||
|
manga.imageUrl = images[i];
|
||||||
|
manga.link = urls[i];
|
||||||
|
mangaList.add(manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(mangaList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> search(MSource source, String query, int page) async {
|
||||||
|
final data = {
|
||||||
|
"url": "${source.baseUrl}/?s=$query&post_type=wp-manga",
|
||||||
|
"sourceId": source.id
|
||||||
|
};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> mangaList = [];
|
||||||
|
final urls = xpath(res, '//*[@class^="tab-thumb c-image-hover"]/a/@href');
|
||||||
|
final names = xpath(res, '//*[@class^="tab-thumb c-image-hover"]/a/@title');
|
||||||
|
var images =
|
||||||
|
xpath(res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@data-src');
|
||||||
|
if (images.isEmpty) {
|
||||||
|
images = xpath(
|
||||||
|
res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@data-lazy-src');
|
||||||
|
if (images.isEmpty) {
|
||||||
|
images =
|
||||||
|
xpath(res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@srcset');
|
||||||
|
if (images.isEmpty) {
|
||||||
|
images =
|
||||||
|
xpath(res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@src');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.name = names[i];
|
||||||
|
manga.imageUrl = images[i];
|
||||||
|
manga.link = urls[i];
|
||||||
|
mangaList.add(manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(mangaList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MManga> getDetail(MSource source, String url) async {
|
||||||
|
final statusList = [
|
||||||
|
{
|
||||||
|
"OnGoing": 0,
|
||||||
|
"Продолжается": 0,
|
||||||
|
"Updating": 0,
|
||||||
|
"Em Lançamento": 0,
|
||||||
|
"Em lançamento": 0,
|
||||||
|
"Em andamento": 0,
|
||||||
|
"Em Andamento": 0,
|
||||||
|
"En cours": 0,
|
||||||
|
"Ativo": 0,
|
||||||
|
"Lançando": 0,
|
||||||
|
"Đang Tiến Hành": 0,
|
||||||
|
"Devam Ediyor": 0,
|
||||||
|
"Devam ediyor": 0,
|
||||||
|
"In Corso": 0,
|
||||||
|
"In Arrivo": 0,
|
||||||
|
"مستمرة": 0,
|
||||||
|
"مستمر": 0,
|
||||||
|
"En Curso": 0,
|
||||||
|
"En curso": 0,
|
||||||
|
"Emision": 0,
|
||||||
|
"En marcha": 0,
|
||||||
|
"Publicandose": 0,
|
||||||
|
"En emision": 0,
|
||||||
|
"连载中": 0,
|
||||||
|
"Completed": 1,
|
||||||
|
"Completo": 1,
|
||||||
|
"Completado": 1,
|
||||||
|
"Concluído": 1,
|
||||||
|
"Concluido": 1,
|
||||||
|
"Finalizado": 1,
|
||||||
|
"Terminé": 1,
|
||||||
|
"Hoàn Thành": 1,
|
||||||
|
"مكتملة": 1,
|
||||||
|
"مكتمل": 1,
|
||||||
|
"已完结": 1,
|
||||||
|
"On Hold": 2,
|
||||||
|
"Pausado": 2,
|
||||||
|
"En espera": 2,
|
||||||
|
"Canceled": 3,
|
||||||
|
"Cancelado": 3,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
MManga manga = MManga();
|
||||||
|
String res = "";
|
||||||
|
final datas = {"url": url, "sourceId": source.id};
|
||||||
|
res = await http('GET', json.encode(datas));
|
||||||
|
|
||||||
|
final author = querySelectorAll(res,
|
||||||
|
selector: "div.author-content > a",
|
||||||
|
typeElement: 0,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0);
|
||||||
|
if (author.isNotEmpty) {
|
||||||
|
manga.author = author.first;
|
||||||
|
}
|
||||||
|
final description = querySelectorAll(res,
|
||||||
|
selector:
|
||||||
|
"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,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0);
|
||||||
|
if (description.isNotEmpty) {
|
||||||
|
manga.description = description.first;
|
||||||
|
}
|
||||||
|
final imageUrl = querySelectorAll(res,
|
||||||
|
selector: "div.summary_image img",
|
||||||
|
typeElement: 2,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 2);
|
||||||
|
if (imageUrl.isNotEmpty) {
|
||||||
|
manga.imageUrl = imageUrl.first;
|
||||||
|
}
|
||||||
|
final mangaId = querySelectorAll(res,
|
||||||
|
selector: "div[id^=manga-chapters-holder]",
|
||||||
|
typeElement: 3,
|
||||||
|
attributes: "data-id",
|
||||||
|
typeRegExp: 0)
|
||||||
|
.first;
|
||||||
|
final status = querySelectorAll(res,
|
||||||
|
selector: "div.summary-content",
|
||||||
|
typeElement: 0,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0);
|
||||||
|
if (status.isNotEmpty) {
|
||||||
|
manga.status = parseStatus(status.last, statusList);
|
||||||
|
}
|
||||||
|
|
||||||
|
manga.genre = querySelectorAll(res,
|
||||||
|
selector: "div.genres-content a",
|
||||||
|
typeElement: 0,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0);
|
||||||
|
|
||||||
|
final baseUrl = "${source.baseUrl}/";
|
||||||
|
final headers = {
|
||||||
|
"Referer": baseUrl,
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
"X-Requested-With": "XMLHttpRequest"
|
||||||
|
};
|
||||||
|
final urll =
|
||||||
|
"${baseUrl}wp-admin/admin-ajax.php?action=manga_get_chapters&manga=$mangaId";
|
||||||
|
final datasP = {"url": urll, "headers": headers, "sourceId": source.id};
|
||||||
|
res = await http('POST', json.encode(datasP));
|
||||||
|
if (res == "error") {
|
||||||
|
final urlP = "${url}ajax/chapters";
|
||||||
|
final datasP = {"url": urlP, "headers": headers, "sourceId": source.id};
|
||||||
|
res = await http('POST', json.encode(datasP));
|
||||||
|
}
|
||||||
|
|
||||||
|
var chapUrls = xpath(res, "//li/a/@href");
|
||||||
|
var chaptersNames = xpath(res, "//li/a/text()");
|
||||||
|
var dateF = xpath(res, "//li/span/i/text()");
|
||||||
|
if (dateF.isEmpty) {
|
||||||
|
final resWebview = await getHtmlViaWebview(
|
||||||
|
url, "//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/@href");
|
||||||
|
chapUrls = xpath(resWebview,
|
||||||
|
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/@href");
|
||||||
|
chaptersNames = xpath(resWebview,
|
||||||
|
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/text()");
|
||||||
|
dateF = xpath(resWebview,
|
||||||
|
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/span/i/text()");
|
||||||
|
}
|
||||||
|
var dateUploads =
|
||||||
|
parseDates(dateF, source.dateFormat, source.dateFormatLocale);
|
||||||
|
if (dateF.length < chaptersNames.length) {
|
||||||
|
final length = chaptersNames.length - dateF.length;
|
||||||
|
String date = "${DateTime.now().millisecondsSinceEpoch}";
|
||||||
|
for (var i = 0; i < length - 1; i++) {
|
||||||
|
date += "--..${DateTime.now().millisecondsSinceEpoch}";
|
||||||
|
}
|
||||||
|
|
||||||
|
final dateFF =
|
||||||
|
parseDates(dateF, source.dateFormat, source.dateFormatLocale);
|
||||||
|
List<String> chapterDate = date.split('--..');
|
||||||
|
|
||||||
|
for (var date in dateFF) {
|
||||||
|
chapterDate.add(date);
|
||||||
|
}
|
||||||
|
dateUploads = chapterDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MChapter>? chaptersList = [];
|
||||||
|
for (var i = 0; i < chaptersNames.length; i++) {
|
||||||
|
MChapter chapter = MChapter();
|
||||||
|
chapter.name = chaptersNames[i];
|
||||||
|
chapter.url = chapUrls[i];
|
||||||
|
chapter.dateUpload = dateUploads[i];
|
||||||
|
chaptersList.add(chapter);
|
||||||
|
}
|
||||||
|
manga.chapters = chaptersList;
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<String>> getPageList(MSource source, String url) async {
|
||||||
|
final datas = {"url": url, "sourceId": source.id};
|
||||||
|
final res = await http('GET', json.encode(datas));
|
||||||
|
|
||||||
|
final pagesSelectorRes = querySelectorAll(res,
|
||||||
|
selector:
|
||||||
|
"div.page-break, li.blocks-gallery-item, .reading-content, .text-left img",
|
||||||
|
typeElement: 1,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0)
|
||||||
|
.first;
|
||||||
|
final imgs = querySelectorAll(pagesSelectorRes,
|
||||||
|
selector: "img", typeElement: 2, attributes: "", typeRegExp: 2);
|
||||||
|
var pageUrls = [];
|
||||||
|
|
||||||
|
if (imgs.length == 1) {
|
||||||
|
final pages = querySelectorAll(res,
|
||||||
|
selector: "#single-pager",
|
||||||
|
typeElement: 2,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0)
|
||||||
|
.first;
|
||||||
|
|
||||||
|
final pagesNumber = querySelectorAll(pages,
|
||||||
|
selector: "option", typeElement: 2, attributes: "", typeRegExp: 0);
|
||||||
|
|
||||||
|
for (var i = 0; i < pagesNumber.length; i++) {
|
||||||
|
final val = i + 1;
|
||||||
|
if (i.toString().length == 1) {
|
||||||
|
pageUrls.add(querySelectorAll(pagesSelectorRes,
|
||||||
|
selector: "img",
|
||||||
|
typeElement: 2,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 2)
|
||||||
|
.first
|
||||||
|
.replaceAll("01", '0$val'));
|
||||||
|
} else {
|
||||||
|
pageUrls.add(querySelectorAll(pagesSelectorRes,
|
||||||
|
selector: "img",
|
||||||
|
typeElement: 2,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 2)
|
||||||
|
.first
|
||||||
|
.replaceAll("01", val.toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return imgs;
|
||||||
|
}
|
||||||
|
return pageUrls;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Madara main() {
|
||||||
|
return Madara();
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import '../../../model/source.dart';
|
import '../../../model/source.dart';
|
||||||
import '../../../utils/utils.dart';
|
import '../../../utils/utils.dart';
|
||||||
|
|
||||||
const madaraVersion = "0.0.3";
|
const madaraVersion = "0.0.35";
|
||||||
const madaraSourceCodeUrl =
|
const madaraSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/madara/madara-v$madaraVersion.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/madara/madara-v$madaraVersion.dart";
|
||||||
const defaultDateFormat = "MMMM dd, yyyy";
|
const defaultDateFormat = "MMMM dd, yyyy";
|
||||||
|
|||||||
@@ -1,193 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
getPopularManga(MManga manga) async {
|
|
||||||
final url =
|
|
||||||
"${manga.baseUrl}${getMangaUrlDirectory(manga.source)}/?page=${manga.page}&order=popular";
|
|
||||||
final data = {"url": url, "sourceId": manga.sourceId};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.urls =
|
|
||||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href');
|
|
||||||
manga.names =
|
|
||||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title');
|
|
||||||
manga.images = MBridge.xpath(
|
|
||||||
res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src');
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesManga(MManga manga) async {
|
|
||||||
final url =
|
|
||||||
"${manga.baseUrl}${getMangaUrlDirectory(manga.source)}/?page=${manga.page}&order=update";
|
|
||||||
final data = {"url": url, "sourceId": manga.sourceId};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.urls =
|
|
||||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href');
|
|
||||||
manga.names =
|
|
||||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title');
|
|
||||||
manga.images = MBridge.xpath(
|
|
||||||
res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src');
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getMangaDetail(MManga 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 response = await MBridge.http('GET', json.encode(datas));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.author = MBridge.xpath(
|
|
||||||
res,
|
|
||||||
'//*[@class="imptdt" and contains(text(), "Author") or @class="infotable" and contains(text(), "Author") or @class="infotable" and contains(text(), "Auteur") or @class="fmed" and contains(text(), "Auteur") or @class="infotable" and contains(text(), "Autor")]/text()',
|
|
||||||
'')
|
|
||||||
.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(MManga manga) async {
|
|
||||||
final url =
|
|
||||||
"${manga.baseUrl}${getMangaUrlDirectory(manga.source)}/?&title=${manga.query}&page=${manga.page}";
|
|
||||||
final data = {"url": url, "sourceId": manga.sourceId};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.urls =
|
|
||||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href');
|
|
||||||
manga.names =
|
|
||||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title');
|
|
||||||
manga.images = MBridge.xpath(
|
|
||||||
res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src');
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getChapterPages(MManga manga) async {
|
|
||||||
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
|
||||||
final response = await MBridge.http('GET', json.encode(datas));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
var pages = [];
|
|
||||||
List<String> pagesUrl = [];
|
|
||||||
pages = MBridge.xpath(res, '//*[@id="readerarea"]/p/img/@src');
|
|
||||||
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";
|
|
||||||
}
|
|
||||||
208
manga/multisrc/mangareader/mangareader-v0.0.45.dart
Normal file
208
manga/multisrc/mangareader/mangareader-v0.0.45.dart
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
import 'package:mangayomi/bridge_lib.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class MangaReader extends MProvider {
|
||||||
|
MangaReader();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getPopular(MSource source, int page) async {
|
||||||
|
final url =
|
||||||
|
"${source.baseUrl}${getMangaUrlDirectory(source.name)}/?page=$page&order=popular";
|
||||||
|
final data = {"url": url, "sourceId": source.id};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
return mangaRes(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||||
|
final url =
|
||||||
|
"${source.baseUrl}${getMangaUrlDirectory(source.name)}/?page=$page&order=update";
|
||||||
|
final data = {"url": url, "sourceId": source.id};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
return mangaRes(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> search(MSource source, String query, int page) async {
|
||||||
|
final url =
|
||||||
|
"${source.baseUrl}${getMangaUrlDirectory(source.name)}/?&title=$query&page=$page";
|
||||||
|
final data = {"url": url, "sourceId": source.id};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
return mangaRes(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MManga> getDetail(MSource source, String url) 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,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
MManga manga = MManga();
|
||||||
|
final datas = {"url": url, "sourceId": source.id};
|
||||||
|
final res = await http('GET', json.encode(datas));
|
||||||
|
|
||||||
|
final author = 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()',
|
||||||
|
'');
|
||||||
|
|
||||||
|
if (author.isNotEmpty) {
|
||||||
|
manga.author = author.first
|
||||||
|
.replaceAll("Autor", "")
|
||||||
|
.replaceAll("Author", "")
|
||||||
|
.replaceAll("Auteur", "")
|
||||||
|
.replaceAll("[Add, ]", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
final description = querySelectorAll(res,
|
||||||
|
selector: ".desc, .entry-content[itemprop=description]",
|
||||||
|
typeElement: 0,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0);
|
||||||
|
if (description.isNotEmpty) {
|
||||||
|
manga.description = description.first;
|
||||||
|
}
|
||||||
|
|
||||||
|
final status = 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()',
|
||||||
|
'');
|
||||||
|
|
||||||
|
if (status.isNotEmpty) {
|
||||||
|
manga.status = parseStatus(
|
||||||
|
status.first
|
||||||
|
.replaceAll("Status", "")
|
||||||
|
.replaceAll("Estado", "")
|
||||||
|
.replaceAll("Statut", ""),
|
||||||
|
statusList);
|
||||||
|
}
|
||||||
|
|
||||||
|
manga.genre = xpath(res,
|
||||||
|
'//*[@class="gnr" or @class="mgen" or @class="seriestugenre" ]/a/text()');
|
||||||
|
|
||||||
|
var chapUrls = xpath(res,
|
||||||
|
'//*[@class="bxcl" or @class="cl" or @class="chbox" or @class="eph-num" or @id="chapterlist"]/div/a[not(@href="#/chapter-{{number}}")]/@href');
|
||||||
|
var chaptersNames = 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()');
|
||||||
|
var chapterDates = 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()');
|
||||||
|
|
||||||
|
var dateUploads =
|
||||||
|
parseDates(chapterDates, source.dateFormat, source.dateFormatLocale);
|
||||||
|
|
||||||
|
List<MChapter>? chaptersList = [];
|
||||||
|
for (var i = 0; i < chaptersNames.length; i++) {
|
||||||
|
MChapter chapter = MChapter();
|
||||||
|
chapter.name = chaptersNames[i];
|
||||||
|
chapter.url = chapUrls[i];
|
||||||
|
chapter.dateUpload = dateUploads[i];
|
||||||
|
chaptersList.add(chapter);
|
||||||
|
}
|
||||||
|
manga.chapters = chaptersList;
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<String>> getPageList(MSource source, String url) async {
|
||||||
|
final datas = {"url": url, "sourceId": source.id};
|
||||||
|
final res = await http('GET', json.encode(datas));
|
||||||
|
|
||||||
|
List<String> pages = [];
|
||||||
|
List<String> pagesUrl = [];
|
||||||
|
pages = xpath(res, '//*[@id="readerarea"]/p/img/@src');
|
||||||
|
if (pages.isEmpty || pages.length == 1) {
|
||||||
|
pages = xpath(res, '//*[@id="readerarea"]/img/@src');
|
||||||
|
}
|
||||||
|
if (pages.isEmpty || pages.length == 1) {
|
||||||
|
final images = regExp(res, "\"images\"\\s*:\\s*(\\[.*?])", "", 1, 1);
|
||||||
|
final pages = json.decode(images) as List;
|
||||||
|
for (var page in pages) {
|
||||||
|
pagesUrl.add(page);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return pages;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pagesUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
MPages mangaRes(String res) {
|
||||||
|
List<MManga> mangaList = [];
|
||||||
|
final urls = xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href');
|
||||||
|
final names = xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title');
|
||||||
|
final images =
|
||||||
|
xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src');
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.name = names[i];
|
||||||
|
manga.imageUrl = images[i];
|
||||||
|
manga.link = urls[i];
|
||||||
|
mangaList.add(manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(mangaList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getMangaUrlDirectory(String sourceName) {
|
||||||
|
if (sourceName == "Sushi-Scan") {
|
||||||
|
return "/catalogue";
|
||||||
|
}
|
||||||
|
return "/manga";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MangaReader main() {
|
||||||
|
return MangaReader();
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import '../../../model/source.dart';
|
import '../../../model/source.dart';
|
||||||
import '../../../utils/utils.dart';
|
import '../../../utils/utils.dart';
|
||||||
|
|
||||||
const mangareaderVersion = "0.0.4";
|
const mangareaderVersion = "0.0.45";
|
||||||
const mangareaderSourceCodeUrl =
|
const mangareaderSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/mangareader/mangareader-v$mangareaderVersion.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/mangareader/mangareader-v$mangareaderVersion.dart";
|
||||||
const defaultDateFormat = "MMMM dd, yyyy";
|
const defaultDateFormat = "MMMM dd, yyyy";
|
||||||
@@ -9,6 +9,24 @@ const defaultDateFormatLocale = "en_US";
|
|||||||
|
|
||||||
List<Source> get mangareaderSourcesList => _mangareaderSourcesList;
|
List<Source> get mangareaderSourcesList => _mangareaderSourcesList;
|
||||||
List<Source> _mangareaderSourcesList = [
|
List<Source> _mangareaderSourcesList = [
|
||||||
|
Source(
|
||||||
|
name: "Beast Scans",
|
||||||
|
baseUrl: "https://beast-scans.com",
|
||||||
|
lang: "ar",
|
||||||
|
iconUrl: getIconUrl("asurascans", "en"),
|
||||||
|
dateFormat: "MMMM dd, yyyy",
|
||||||
|
dateFormatLocale: "ar",
|
||||||
|
version: mangareaderVersion,
|
||||||
|
sourceCodeUrl: mangareaderSourceCodeUrl),
|
||||||
|
Source(
|
||||||
|
name: "Lelmanga",
|
||||||
|
baseUrl: "https://www.lelmanga.com",
|
||||||
|
lang: "fr",
|
||||||
|
iconUrl: getIconUrl("lelmanga", "fr"),
|
||||||
|
dateFormat: "MMMM d, yyyy",
|
||||||
|
dateFormatLocale: "en",
|
||||||
|
version: mangareaderVersion,
|
||||||
|
sourceCodeUrl: mangareaderSourceCodeUrl),
|
||||||
Source(
|
Source(
|
||||||
name: "Asura Scans",
|
name: "Asura Scans",
|
||||||
baseUrl: "https://asuratoon.com/",
|
baseUrl: "https://asuratoon.com/",
|
||||||
|
|||||||
@@ -1,155 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
searchManga(MManga manga) async {
|
|
||||||
final url = "${manga.baseUrl}/search?query=${manga.query}";
|
|
||||||
final data = {"url": url, "sourceId": manga.sourceId};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
final jsonList = json.decode(res)["suggestions"];
|
|
||||||
List<String> urls = [];
|
|
||||||
List<String> names = [];
|
|
||||||
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(MManga manga) async {
|
|
||||||
final url =
|
|
||||||
"${manga.baseUrl}/filterList?page=${manga.page}&sortBy=views&asc=false";
|
|
||||||
final data = {"url": url, "sourceId": manga.sourceId};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.urls = MBridge.xpath(res, '//*[ @class="chart-title"]/@href');
|
|
||||||
manga.names = MBridge.xpath(res, '//*[ @class="chart-title"]/text()');
|
|
||||||
List<String> images = [];
|
|
||||||
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(MManga 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 response = await MBridge.http('GET', json.encode(datas));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.author = MBridge.xpath(res,
|
|
||||||
'//*[@class="dl-horizontal"]/dt[contains(text(), "Auteur(s)") or contains(text(), "Author(s)") or contains(text(), "Autor(es)") or contains(text(), "Yazar(lar) or contains(text(), "Mangaka(lar)")]//following-sibling::dd[1]/text()')
|
|
||||||
.first;
|
|
||||||
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(MManga manga) async {
|
|
||||||
final url = "${manga.baseUrl}/latest-release?page=${manga.page}";
|
|
||||||
final data = {"url": url, "sourceId": manga.sourceId};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.urls = MBridge.xpath(res, '//*[@class="manga-item"]/h3/a/@href');
|
|
||||||
manga.names = MBridge.xpath(res, '//*[@class="manga-item"]/h3/a/text()');
|
|
||||||
List<String> images = [];
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
getChapterPages(MManga manga) async {
|
|
||||||
final datas = {"url": manga.link, "sourceId": manga.sourceId};
|
|
||||||
final response = await MBridge.http('GET', json.encode(datas));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
List<String> pagesUrl = [];
|
|
||||||
final pages = MBridge.xpath(
|
|
||||||
res, '//*[@id="all"]/img[@class="img-responsive"]/@data-src');
|
|
||||||
for (var page in pages) {
|
|
||||||
if (page.startsWith('//')) {
|
|
||||||
pagesUrl.add(page.replaceAll('//', 'https://'));
|
|
||||||
} else {
|
|
||||||
pagesUrl.add(page);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return pagesUrl;
|
|
||||||
}
|
|
||||||
196
manga/multisrc/mmrcms/mmrcms-v0.0.35.dart
Normal file
196
manga/multisrc/mmrcms/mmrcms-v0.0.35.dart
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
import 'package:mangayomi/bridge_lib.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class MMRCMS extends MProvider {
|
||||||
|
MMRCMS();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getPopular(MSource source, int page) async {
|
||||||
|
final url =
|
||||||
|
"${source.baseUrl}/filterList?page=$page&sortBy=views&asc=false";
|
||||||
|
final data = {"url": url, "sourceId": source.id};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> mangaList = [];
|
||||||
|
final urls = xpath(res, '//*[ @class="chart-title"]/@href');
|
||||||
|
final names = xpath(res, '//*[ @class="chart-title"]/text()');
|
||||||
|
List<String> images = [];
|
||||||
|
for (var url in urls) {
|
||||||
|
String slug = substringAfterLast(url, '/');
|
||||||
|
if (source.name == "Manga-FR") {
|
||||||
|
images.add("${source.baseUrl}/uploads/manga/${slug}.jpg");
|
||||||
|
} else {
|
||||||
|
images.add(
|
||||||
|
"${source.baseUrl}/uploads/manga/${slug}/cover/cover_250x350.jpg");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.name = names[i];
|
||||||
|
manga.imageUrl = images[i];
|
||||||
|
manga.link = urls[i];
|
||||||
|
mangaList.add(manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(mangaList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||||
|
final url = "${source.baseUrl}/latest-release?page=$page";
|
||||||
|
final data = {"url": url, "sourceId": source.id};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> mangaList = [];
|
||||||
|
final urls = xpath(res, '//*[@class="manga-item"]/h3/a/@href');
|
||||||
|
final names = xpath(res, '//*[@class="manga-item"]/h3/a/text()');
|
||||||
|
List<String> images = [];
|
||||||
|
for (var url in urls) {
|
||||||
|
String slug = substringAfterLast(url, '/');
|
||||||
|
if (source.name == "Manga-FR") {
|
||||||
|
images.add("${source.baseUrl}/uploads/manga/${slug}.jpg");
|
||||||
|
} else {
|
||||||
|
images.add(
|
||||||
|
"${source.baseUrl}/uploads/manga/${slug}/cover/cover_250x350.jpg");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.name = names[i];
|
||||||
|
manga.imageUrl = images[i];
|
||||||
|
manga.link = urls[i];
|
||||||
|
mangaList.add(manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(mangaList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> search(MSource source, String query, int page) async {
|
||||||
|
final url = "${source.baseUrl}/search?query=$query";
|
||||||
|
final data = {"url": url, "sourceId": source.id};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> mangaList = [];
|
||||||
|
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 (source.name == 'Scan VF') {
|
||||||
|
urls.add('${source.baseUrl}/$data');
|
||||||
|
} else if (source.name == 'Manga-FR') {
|
||||||
|
urls.add('${source.baseUrl}/lecture-en-ligne/$data');
|
||||||
|
} else {
|
||||||
|
urls.add('${source.baseUrl}/manga/$data');
|
||||||
|
}
|
||||||
|
names.add(value);
|
||||||
|
if (source.name == "Manga-FR") {
|
||||||
|
images.add("${source.baseUrl}/uploads/manga/$data.jpg");
|
||||||
|
} else {
|
||||||
|
images.add(
|
||||||
|
"${source.baseUrl}/uploads/manga/$data/cover/cover_250x350.jpg");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.name = names[i];
|
||||||
|
manga.imageUrl = images[i];
|
||||||
|
manga.link = urls[i];
|
||||||
|
mangaList.add(manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(mangaList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MManga> getDetail(MSource source, String url) 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
|
||||||
|
}
|
||||||
|
];
|
||||||
|
MManga manga = MManga();
|
||||||
|
final datas = {"url": url, "sourceId": source.id};
|
||||||
|
final res = await http('GET', json.encode(datas));
|
||||||
|
|
||||||
|
final author = 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()');
|
||||||
|
if (author.isNotEmpty) {
|
||||||
|
manga.author = author.first;
|
||||||
|
}
|
||||||
|
final status = 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()');
|
||||||
|
if (status.isNotEmpty) {
|
||||||
|
manga.status = parseStatus(status.first, statusList);
|
||||||
|
}
|
||||||
|
|
||||||
|
final description =
|
||||||
|
xpath(res, '//*[@class="well" or @class="manga well"]/p/text()');
|
||||||
|
if (description.isNotEmpty) {
|
||||||
|
manga.description = description.first;
|
||||||
|
}
|
||||||
|
|
||||||
|
manga.genre = 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()');
|
||||||
|
|
||||||
|
var chapUrls = xpath(res, '//*[@class="chapter-title-rtl"]/a/@href');
|
||||||
|
var chaptersNames = xpath(res, '//*[@class="chapter-title-rtl"]/a/text()');
|
||||||
|
var chaptersDates =
|
||||||
|
xpath(res, '//*[@class="date-chapter-title-rtl"]/text()');
|
||||||
|
|
||||||
|
var dateUploads =
|
||||||
|
parseDates(chaptersDates, source.dateFormat, source.dateFormatLocale);
|
||||||
|
|
||||||
|
List<MChapter>? chaptersList = [];
|
||||||
|
for (var i = 0; i < chaptersNames.length; i++) {
|
||||||
|
MChapter chapter = MChapter();
|
||||||
|
chapter.name = chaptersNames[i];
|
||||||
|
chapter.url = chapUrls[i];
|
||||||
|
chapter.dateUpload = dateUploads[i];
|
||||||
|
chaptersList.add(chapter);
|
||||||
|
}
|
||||||
|
manga.chapters = chaptersList;
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<String>> getPageList(MSource source, String url) async {
|
||||||
|
final datas = {"url": url, "sourceId": source.id};
|
||||||
|
final res = await http('GET', json.encode(datas));
|
||||||
|
|
||||||
|
List<String> pagesUrl = [];
|
||||||
|
final pages =
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MMRCMS main() {
|
||||||
|
return MMRCMS();
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import '../../../model/source.dart';
|
import '../../../model/source.dart';
|
||||||
import '../../../utils/utils.dart';
|
import '../../../utils/utils.dart';
|
||||||
|
|
||||||
const mmrcmsVersion = "0.0.3";
|
const mmrcmsVersion = "0.0.35";
|
||||||
const mmrcmsSourceCodeUrl =
|
const mmrcmsSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/mmrcms/mmrcms-v$mmrcmsVersion.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/mmrcms/mmrcms-v$mmrcmsVersion.dart";
|
||||||
const defaultDateFormat = "d MMM. yyyy";
|
const defaultDateFormat = "d MMM. yyyy";
|
||||||
|
|||||||
@@ -1,224 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
getPopularManga(MManga manga) async {
|
|
||||||
final data = {"url": "${manga.baseUrl}/search/"};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
final directory = directoryFromDocument(res);
|
|
||||||
final resSort = MBridge.sortMapList(json.decode(directory), "vm", 1);
|
|
||||||
|
|
||||||
return parseDirectory(resSort, manga);
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesManga(MManga manga) async {
|
|
||||||
final data = {"url": "${manga.baseUrl}/search/"};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
final directory = directoryFromDocument(res);
|
|
||||||
final resSort = MBridge.sortMapList(json.decode(directory), "lt", 1);
|
|
||||||
|
|
||||||
return parseDirectory(resSort, manga);
|
|
||||||
}
|
|
||||||
|
|
||||||
searchManga(MManga manga) async {
|
|
||||||
final data = {"url": "${manga.baseUrl}/search/"};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
final directory = directoryFromDocument(res);
|
|
||||||
final resSort = MBridge.sortMapList(json.decode(directory), "lt", 1);
|
|
||||||
final datas = json.decode(resSort) as List;
|
|
||||||
final queryRes = datas.where((e) {
|
|
||||||
String name = e['s'];
|
|
||||||
return name.toLowerCase().contains(manga.query.toLowerCase());
|
|
||||||
}).toList();
|
|
||||||
manga.hasNextPage = false;
|
|
||||||
if (queryRes.length > 50) {
|
|
||||||
manga.hasNextPage = true;
|
|
||||||
}
|
|
||||||
return parseDirectory(json.encode(queryRes), manga);
|
|
||||||
}
|
|
||||||
|
|
||||||
getMangaDetail(MManga manga) async {
|
|
||||||
final statusList = [
|
|
||||||
{"Ongoing": 0, "Completed": 1, "Cancelled": 3, "Hiatus": 2}
|
|
||||||
];
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
final url = '${manga.baseUrl}/manga/${manga.link}';
|
|
||||||
final data = {"url": url, "headers": headers};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.author = MBridge.xpath(res,
|
|
||||||
'//li[contains(@class,"list-group-item") and contains(text(),"Author")]/a/text()')
|
|
||||||
.first;
|
|
||||||
manga.description = MBridge.xpath(res,
|
|
||||||
'//li[contains(@class,"list-group-item") and contains(text(),"Description:")]/div/text()')
|
|
||||||
.first;
|
|
||||||
final status = MBridge.xpath(res,
|
|
||||||
'//li[contains(@class,"list-group-item") and contains(text(),"Status")]/a/text()')
|
|
||||||
.first;
|
|
||||||
manga.status = MBridge.parseStatus(toStatus(status), statusList);
|
|
||||||
manga.genre = MBridge.xpath(res,
|
|
||||||
'//li[contains(@class,"list-group-item") and contains(text(),"Genre(s)")]/a/text()');
|
|
||||||
|
|
||||||
final script =
|
|
||||||
MBridge.xpath(res, '//script[contains(text(), "MainFunction")]/text()')
|
|
||||||
.first;
|
|
||||||
final vmChapters = MBridge.substringBefore(
|
|
||||||
MBridge.substringAfter(script, "vm.Chapters = "), ";");
|
|
||||||
final chapters = json.decode(vmChapters) as List;
|
|
||||||
manga.names = chapters.map((ch) {
|
|
||||||
String name = ch['ChapterName'] ?? "";
|
|
||||||
String indexChapter = ch['Chapter'];
|
|
||||||
if (name.isEmpty) {
|
|
||||||
name = '${ch['Type']} ${chapterImage(indexChapter, true)}';
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}).toList();
|
|
||||||
|
|
||||||
manga.urls = chapters
|
|
||||||
.map((ch) =>
|
|
||||||
'/read-online/${MBridge.substringAfter(manga.link, "/manga/")}${chapterURLEncode(ch['Chapter'])}')
|
|
||||||
.toList();
|
|
||||||
final chapterDates = chapters.map((ch) => ch['Date']).toList();
|
|
||||||
manga.chaptersDateUploads = MBridge.listParseDateTime(
|
|
||||||
chapterDates, manga.dateFormat, manga.dateFormatLocale);
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getChapterPages(MManga manga) async {
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
final url = '${manga.baseUrl}${manga.link}';
|
|
||||||
List<String> pages = [];
|
|
||||||
final data = {"url": url, "headers": headers};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
|
|
||||||
final script =
|
|
||||||
MBridge.xpath(res, '//script[contains(text(), "MainFunction")]/text()')
|
|
||||||
.first;
|
|
||||||
final chapScript = json.decode(MBridge.substringBefore(
|
|
||||||
MBridge.substringAfter(script, "vm.CurChapter = "), ";"));
|
|
||||||
final pathName = MBridge.substringBefore(
|
|
||||||
MBridge.substringAfter(script, "vm.CurPathName = \"", ""), "\"");
|
|
||||||
var directory = chapScript['Directory'] ?? '';
|
|
||||||
if (directory.length > 0) {
|
|
||||||
directory += '/';
|
|
||||||
}
|
|
||||||
final mangaName = MBridge.substringBefore(
|
|
||||||
MBridge.substringAfter(manga.link, "/read-online/"), "-chapter");
|
|
||||||
var chNum = chapterImage(chapScript['Chapter'], false);
|
|
||||||
var totalPages = MBridge.intParse(chapScript['Page']);
|
|
||||||
for (int page = 1; page <= totalPages; page++) {
|
|
||||||
String paddedPageNumber = "$page".padLeft(3, '0');
|
|
||||||
String pageUrl =
|
|
||||||
'https://$pathName/manga/$mangaName/$directory$chNum-$paddedPageNumber.png';
|
|
||||||
|
|
||||||
pages.add(pageUrl);
|
|
||||||
}
|
|
||||||
return pages;
|
|
||||||
}
|
|
||||||
|
|
||||||
String chapterImage(String e, bool cleanString) {
|
|
||||||
var a = e.substring(1, e.length - 1);
|
|
||||||
if (cleanString) {
|
|
||||||
a = MBridge.regExp(a, r'^0+', "", 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
var b = MBridge.intParse(e.substring(e.length - 1));
|
|
||||||
|
|
||||||
if (b == 0 && a.isNotEmpty) {
|
|
||||||
return a;
|
|
||||||
} else if (b == 0 && a.isEmpty) {
|
|
||||||
return '0';
|
|
||||||
} else {
|
|
||||||
return '$a.$b';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String toStatus(String status) {
|
|
||||||
if (status.contains("Ongoing")) {
|
|
||||||
return "Ongoing";
|
|
||||||
} else if (status.contains("Complete")) {
|
|
||||||
return "Complete";
|
|
||||||
} else if (status.contains("Cancelled")) {
|
|
||||||
return "Cancelled";
|
|
||||||
} else if (status.contains("Hiatus")) {
|
|
||||||
return "Hiatus";
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
String directoryFromDocument(String res) {
|
|
||||||
final script =
|
|
||||||
MBridge.xpath(res, '//script[contains(text(), "MainFunction")]/text()')
|
|
||||||
.first;
|
|
||||||
return MBridge.substringBefore(
|
|
||||||
MBridge.substringAfter(script, "vm.Directory = "), "vm.GetIntValue")
|
|
||||||
.replaceAll(";", " ");
|
|
||||||
}
|
|
||||||
|
|
||||||
MManga parseDirectory(String resSort, MManga manga) {
|
|
||||||
final datas = json.decode(resSort) as List;
|
|
||||||
manga.names = datas.map((e) => e["s"]).toList();
|
|
||||||
manga.images = datas
|
|
||||||
.map((e) => 'https://temp.compsci88.com/cover/${e['i']}.jpg')
|
|
||||||
.toList();
|
|
||||||
manga.urls = datas.map((e) => e["i"]).toList();
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, String> getHeader(String url) {
|
|
||||||
final headers = {
|
|
||||||
'Referer': '$url/',
|
|
||||||
"User-Agent":
|
|
||||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/77.0"
|
|
||||||
};
|
|
||||||
return headers;
|
|
||||||
}
|
|
||||||
|
|
||||||
String chapterURLEncode(String e) {
|
|
||||||
var index = ''.toString();
|
|
||||||
var t = MBridge.intParse(e.substring(0, 1));
|
|
||||||
|
|
||||||
if (t != 1) {
|
|
||||||
index = '-index-$t';
|
|
||||||
}
|
|
||||||
|
|
||||||
var dgt = 0;
|
|
||||||
var inta = MBridge.intParse(e);
|
|
||||||
if (inta < 100100) {
|
|
||||||
dgt = 4;
|
|
||||||
} else if (inta < 101000) {
|
|
||||||
dgt = 3;
|
|
||||||
} else if (inta < 110000) {
|
|
||||||
dgt = 2;
|
|
||||||
} else {
|
|
||||||
dgt = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
final n = e.substring(dgt, e.length - 1);
|
|
||||||
var suffix = ''.toString();
|
|
||||||
final path = MBridge.intParse(e.substring(e.length - 1));
|
|
||||||
|
|
||||||
if (path != 0) {
|
|
||||||
suffix = '.$path';
|
|
||||||
}
|
|
||||||
|
|
||||||
return '-chapter-$n$suffix$index.html';
|
|
||||||
}
|
|
||||||
220
manga/multisrc/nepnep/nepnep-v0.0.25.dart
Normal file
220
manga/multisrc/nepnep/nepnep-v0.0.25.dart
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
import 'package:mangayomi/bridge_lib.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class NepNep extends MProvider {
|
||||||
|
NepNep();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getPopular(MSource source, int page) async {
|
||||||
|
final data = {"url": "${source.baseUrl}/search/"};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
final directory = directoryFromDocument(res);
|
||||||
|
final resSort = sortMapList(json.decode(directory), "vm", 1);
|
||||||
|
|
||||||
|
return parseDirectory(resSort);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||||
|
final data = {"url": "${source.baseUrl}/search/"};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
final directory = directoryFromDocument(res);
|
||||||
|
final resSort = sortMapList(json.decode(directory), "lt", 1);
|
||||||
|
|
||||||
|
return parseDirectory(resSort);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> search(MSource source, String query, int page) async {
|
||||||
|
final data = {"url": "${source.baseUrl}/search/"};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
final directory = directoryFromDocument(res);
|
||||||
|
final resSort = sortMapList(json.decode(directory), "lt", 1);
|
||||||
|
final datas = json.decode(resSort) as List;
|
||||||
|
final queryRes = datas.where((e) {
|
||||||
|
String name = e['s'];
|
||||||
|
return name.toLowerCase().contains(query.toLowerCase());
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
return parseDirectory(json.encode(queryRes));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MManga> getDetail(MSource source, String url) async {
|
||||||
|
final statusList = [
|
||||||
|
{"Ongoing": 0, "Completed": 1, "Cancelled": 3, "Hiatus": 2}
|
||||||
|
];
|
||||||
|
final headers = getHeader(source.baseUrl);
|
||||||
|
final data = {"url": '${source.baseUrl}/manga/$url', "headers": headers};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.author = xpath(res,
|
||||||
|
'//li[contains(@class,"list-group-item") and contains(text(),"Author")]/a/text()')
|
||||||
|
.first;
|
||||||
|
manga.description = xpath(res,
|
||||||
|
'//li[contains(@class,"list-group-item") and contains(text(),"Description:")]/div/text()')
|
||||||
|
.first;
|
||||||
|
final status = xpath(res,
|
||||||
|
'//li[contains(@class,"list-group-item") and contains(text(),"Status")]/a/text()')
|
||||||
|
.first;
|
||||||
|
|
||||||
|
manga.status = parseStatus(toStatus(status), statusList);
|
||||||
|
manga.genre = xpath(res,
|
||||||
|
'//li[contains(@class,"list-group-item") and contains(text(),"Genre(s)")]/a/text()');
|
||||||
|
|
||||||
|
final script =
|
||||||
|
xpath(res, '//script[contains(text(), "MainFunction")]/text()').first;
|
||||||
|
final vmChapters =
|
||||||
|
substringBefore(substringAfter(script, "vm.Chapters = "), ";");
|
||||||
|
final chapters = json.decode(vmChapters) as List;
|
||||||
|
|
||||||
|
List<MChapter> chaptersList = [];
|
||||||
|
|
||||||
|
for (var ch in chapters) {
|
||||||
|
MChapter chapter = MChapter();
|
||||||
|
String name = ch['ChapterName'] ?? "";
|
||||||
|
String indexChapter = ch['Chapter'];
|
||||||
|
if (name.isEmpty) {
|
||||||
|
name = '${ch['Type']} ${chapterImage(indexChapter, true)}';
|
||||||
|
}
|
||||||
|
chapter.name = name;
|
||||||
|
chapter.url =
|
||||||
|
'/read-online/${substringAfter(url, "/manga/")}${chapterURLEncode(ch['Chapter'])}';
|
||||||
|
chapter.dateUpload =
|
||||||
|
parseDates([ch['Date']], source.dateFormat, source.dateFormatLocale)
|
||||||
|
.first;
|
||||||
|
chaptersList.add(chapter);
|
||||||
|
}
|
||||||
|
manga.chapters = chaptersList;
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<String>> getPageList(MSource source, String url) async {
|
||||||
|
final headers = getHeader(source.baseUrl);
|
||||||
|
List<String> pages = [];
|
||||||
|
final data = {"url": '${source.baseUrl}$url', "headers": headers};
|
||||||
|
print(data);
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
final script =
|
||||||
|
xpath(res, '//script[contains(text(), "MainFunction")]/text()').first;
|
||||||
|
final chapScript = json.decode(
|
||||||
|
substringBefore(substringAfter(script, "vm.CurChapter = "), ";"));
|
||||||
|
final pathName = substringBefore(
|
||||||
|
substringAfter(script, "vm.CurPathName = \"", ""), "\"");
|
||||||
|
var directory = chapScript['Directory'] ?? '';
|
||||||
|
if (directory.length > 0) {
|
||||||
|
directory += '/';
|
||||||
|
}
|
||||||
|
final mangaName =
|
||||||
|
substringBefore(substringAfter(url, "/read-online/"), "-chapter");
|
||||||
|
var chNum = chapterImage(chapScript['Chapter'], false);
|
||||||
|
var totalPages = int.parse(chapScript['Page']);
|
||||||
|
for (int page = 1; page <= totalPages; page++) {
|
||||||
|
String paddedPageNumber = "$page".padLeft(3, '0');
|
||||||
|
String pageUrl =
|
||||||
|
'https://$pathName/manga/$mangaName/$directory$chNum-$paddedPageNumber.png';
|
||||||
|
|
||||||
|
pages.add(pageUrl);
|
||||||
|
}
|
||||||
|
return pages;
|
||||||
|
}
|
||||||
|
|
||||||
|
String directoryFromDocument(String res) {
|
||||||
|
final script =
|
||||||
|
xpath(res, '//script[contains(text(), "MainFunction")]/text()').first;
|
||||||
|
return substringBefore(
|
||||||
|
substringAfter(script, "vm.Directory = "), "vm.GetIntValue")
|
||||||
|
.replaceAll(";", " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
MPages parseDirectory(String res) {
|
||||||
|
List<MManga> mangaList = [];
|
||||||
|
final datas = json.decode(res) as List;
|
||||||
|
for (var data in datas) {
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.name = data["s"];
|
||||||
|
manga.imageUrl = 'https://temp.compsci88.com/cover/${data['i']}.jpg';
|
||||||
|
manga.link = data["i"];
|
||||||
|
mangaList.add(manga);
|
||||||
|
}
|
||||||
|
return MPages(mangaList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
String chapterImage(String e, bool cleanString) {
|
||||||
|
var a = e.substring(1, e.length - 1);
|
||||||
|
if (cleanString) {
|
||||||
|
a = regExp(a, r'^0+', "", 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var b = int.parse(e.substring(e.length - 1));
|
||||||
|
|
||||||
|
if (b == 0 && a.isNotEmpty) {
|
||||||
|
return a;
|
||||||
|
} else if (b == 0 && a.isEmpty) {
|
||||||
|
return '0';
|
||||||
|
} else {
|
||||||
|
return '$a.$b';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String toStatus(String status) {
|
||||||
|
if (status.contains("Ongoing")) {
|
||||||
|
return "Ongoing";
|
||||||
|
} else if (status.contains("Complete")) {
|
||||||
|
return "Complete";
|
||||||
|
} else if (status.contains("Cancelled")) {
|
||||||
|
return "Cancelled";
|
||||||
|
} else if (status.contains("Hiatus")) {
|
||||||
|
return "Hiatus";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
String chapterURLEncode(String e) {
|
||||||
|
var index = ''.toString();
|
||||||
|
var t = int.parse(e.substring(0, 1));
|
||||||
|
|
||||||
|
if (t != 1) {
|
||||||
|
index = '-index-$t';
|
||||||
|
}
|
||||||
|
|
||||||
|
var dgt = 0;
|
||||||
|
var inta = int.parse(e);
|
||||||
|
if (inta < 100100) {
|
||||||
|
dgt = 4;
|
||||||
|
} else if (inta < 101000) {
|
||||||
|
dgt = 3;
|
||||||
|
} else if (inta < 110000) {
|
||||||
|
dgt = 2;
|
||||||
|
} else {
|
||||||
|
dgt = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
final n = e.substring(dgt, e.length - 1);
|
||||||
|
var suffix = ''.toString();
|
||||||
|
final path = int.parse(e.substring(e.length - 1));
|
||||||
|
|
||||||
|
if (path != 0) {
|
||||||
|
suffix = '.$path';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '-chapter-$n$suffix$index.html';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> getHeader(String url) {
|
||||||
|
final headers = {
|
||||||
|
'Referer': '$url/',
|
||||||
|
"User-Agent":
|
||||||
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/77.0"
|
||||||
|
};
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
NepNep main() {
|
||||||
|
return NepNep();
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import '../../../model/source.dart';
|
import '../../../model/source.dart';
|
||||||
import '../../../utils/utils.dart';
|
import '../../../utils/utils.dart';
|
||||||
|
|
||||||
const nepnepVersion = "0.0.2";
|
const nepnepVersion = "0.0.25";
|
||||||
const nepnepSourceCodeUrl =
|
const nepnepSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/nepnep/nepnep-v$nepnepVersion.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/nepnep/nepnep-v$nepnepVersion.dart";
|
||||||
const defaultDateFormat = "yyyy-MM-dd HH:mm:ss";
|
const defaultDateFormat = "yyyy-MM-dd HH:mm:ss";
|
||||||
@@ -15,6 +15,7 @@ List<Source> _nepnepSourcesList = [
|
|||||||
lang: "en",
|
lang: "en",
|
||||||
typeSource: "nepnep",
|
typeSource: "nepnep",
|
||||||
iconUrl: getIconUrl("mangasee", "en"),
|
iconUrl: getIconUrl("mangasee", "en"),
|
||||||
|
isFullData: true,
|
||||||
dateFormat: defaultDateFormat,
|
dateFormat: defaultDateFormat,
|
||||||
dateFormatLocale: defaultDateFormatLocale,
|
dateFormatLocale: defaultDateFormatLocale,
|
||||||
version: nepnepVersion,
|
version: nepnepVersion,
|
||||||
@@ -26,6 +27,7 @@ List<Source> _nepnepSourcesList = [
|
|||||||
lang: "en",
|
lang: "en",
|
||||||
typeSource: "nepnep",
|
typeSource: "nepnep",
|
||||||
iconUrl: getIconUrl("mangalife", "en"),
|
iconUrl: getIconUrl("mangalife", "en"),
|
||||||
|
isFullData: true,
|
||||||
dateFormat: defaultDateFormat,
|
dateFormat: defaultDateFormat,
|
||||||
dateFormatLocale: defaultDateFormatLocale,
|
dateFormatLocale: defaultDateFormatLocale,
|
||||||
version: nepnepVersion,
|
version: nepnepVersion,
|
||||||
|
|||||||
@@ -1,228 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
getPopularManga(MManga manga) async {
|
|
||||||
final url =
|
|
||||||
"${manga.baseUrl}/browse?${lang(manga.lang)}&sort=views_a&page=${manga.page}";
|
|
||||||
final data = {"url": url, "sourceId": manga.sourceId};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
return mangaElementM(res, manga);
|
|
||||||
}
|
|
||||||
|
|
||||||
String lang(String lang) {
|
|
||||||
lang = lang.replaceAll("-", "_");
|
|
||||||
if (lang == "all") {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return "langs=$lang";
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesManga(MManga manga) async {
|
|
||||||
final url =
|
|
||||||
"${manga.baseUrl}/browse?${lang(manga.lang)}&sort=update&page=${manga.page}";
|
|
||||||
final data = {"url": url, "sourceId": manga.sourceId};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
return mangaElementM(res, manga);
|
|
||||||
}
|
|
||||||
|
|
||||||
searchManga(MManga manga) async {
|
|
||||||
final data = {
|
|
||||||
"url": "${manga.baseUrl}/search?word=${manga.query}&page=${manga.page}",
|
|
||||||
"sourceId": manga.sourceId
|
|
||||||
};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
return mangaElementM(res, manga);
|
|
||||||
}
|
|
||||||
|
|
||||||
getMangaDetail(MManga 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 response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
|
|
||||||
final workStatus = MBridge.xpath(res,
|
|
||||||
'//*[@class="attr-item"]/b[contains(text(),"Original work")]/following-sibling::span[1]/text()')
|
|
||||||
.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
getChapterPages(MManga manga) async {
|
|
||||||
final datas = {
|
|
||||||
"url": "${manga.baseUrl}${manga.link}",
|
|
||||||
"sourceId": manga.sourceId
|
|
||||||
};
|
|
||||||
final response = await MBridge.http('GET', json.encode(datas));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
final script = MBridge.xpath(res,
|
|
||||||
'//script[contains(text(), "imgHttpLis") and contains(text(), "batoWord") and contains(text(), "batoPass")]/text()')
|
|
||||||
.first;
|
|
||||||
final imgHttpLisString = MBridge.substringBefore(
|
|
||||||
MBridge.substringAfterLast(script, 'const imgHttpLis ='), ';');
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
MManga mangaElementM(String res, MManga manga) async {
|
|
||||||
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()');
|
|
||||||
manga.hasNextPage = true;
|
|
||||||
|
|
||||||
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",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
226
manga/src/all/batoto/batoto-v0.0.35.dart
Normal file
226
manga/src/all/batoto/batoto-v0.0.35.dart
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
import 'package:mangayomi/bridge_lib.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class Batoto extends MProvider {
|
||||||
|
Batoto();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getPopular(MSource source, int page) async {
|
||||||
|
final url =
|
||||||
|
"${source.baseUrl}/browse?${lang(source.lang)}&sort=views_a&page=$page";
|
||||||
|
final data = {"url": url};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
return mangaElementM(res, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||||
|
final url =
|
||||||
|
"${source.baseUrl}/browse?${lang(source.lang)}&sort=update&page=$page";
|
||||||
|
final data = {"url": url};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
return mangaElementM(res, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> search(MSource source, String query, int page) async {
|
||||||
|
final url = "${source.baseUrl}/search?word=$query&page=$page";
|
||||||
|
final data = {"url": url};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
return mangaElementM(res, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MManga> getDetail(MSource source, String url) async {
|
||||||
|
final statusList = [
|
||||||
|
{"Ongoing": 0, "Completed": 1, "Cancelled": 3, "Hiatus": 2}
|
||||||
|
];
|
||||||
|
|
||||||
|
final data = {"url": "${source.baseUrl}$url"};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
MManga manga = MManga();
|
||||||
|
final workStatus = xpath(res,
|
||||||
|
'//*[@class="attr-item"]/b[contains(text(),"Original work")]/following-sibling::span[1]/text()')
|
||||||
|
.first;
|
||||||
|
manga.status = parseStatus(workStatus, statusList);
|
||||||
|
|
||||||
|
manga.author = xpath(res,
|
||||||
|
'//*[@class="attr-item"]/b[contains(text(),"Authors")]/following-sibling::span[1]/text()')
|
||||||
|
.first;
|
||||||
|
manga.genre = xpath(res,
|
||||||
|
'//*[@class="attr-item"]/b[contains(text(),"Genres")]/following-sibling::span[1]/text()')
|
||||||
|
.first
|
||||||
|
.split(",");
|
||||||
|
manga.description = xpath(res, '//*[@class="limit-html"]/text()').first;
|
||||||
|
|
||||||
|
List<String> chapsElement = 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 = querySelectorAll(element,
|
||||||
|
selector: "a.chapt",
|
||||||
|
typeElement: 2,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0)
|
||||||
|
.first;
|
||||||
|
final group = xpath(element, '//*[@class="extra"]/a/text()').first;
|
||||||
|
final name = xpath(urlElement, '//a/text()').first;
|
||||||
|
final url = xpath(urlElement, '//a/@href').first;
|
||||||
|
final time =
|
||||||
|
xpath(element, '//*[@class="extra"]/i[@class="ps-3"]/text()').first;
|
||||||
|
times.add(time);
|
||||||
|
chapsUrls.add(url);
|
||||||
|
scanlators.add(group);
|
||||||
|
chapsNames.add(name.replaceAll("\n ", "").replaceAll(" ", ""));
|
||||||
|
}
|
||||||
|
var dateUploads =
|
||||||
|
parseDates(times, source.dateFormat, source.dateFormatLocale);
|
||||||
|
List<MChapter>? chaptersList = [];
|
||||||
|
for (var i = 0; i < chapsNames.length; i++) {
|
||||||
|
MChapter chapter = MChapter();
|
||||||
|
chapter.name = chapsNames[i];
|
||||||
|
chapter.url = chapsUrls[i];
|
||||||
|
chapter.scanlator = scanlators[i];
|
||||||
|
chapter.dateUpload = dateUploads[i];
|
||||||
|
chaptersList.add(chapter);
|
||||||
|
}
|
||||||
|
manga.chapters = chaptersList;
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<String>> getPageList(MSource source, String url) async {
|
||||||
|
final datas = {"url": "${source.baseUrl}$url"};
|
||||||
|
final res = await http('GET', json.encode(datas));
|
||||||
|
|
||||||
|
final script = xpath(res,
|
||||||
|
'//script[contains(text(), "imgHttpLis") and contains(text(), "batoWord") and contains(text(), "batoPass")]/text()')
|
||||||
|
.first;
|
||||||
|
final imgHttpLisString =
|
||||||
|
substringBefore(substringAfterLast(script, 'const imgHttpLis ='), ';');
|
||||||
|
var imgHttpLis = json.decode(imgHttpLisString);
|
||||||
|
final batoWord =
|
||||||
|
substringBefore(substringAfterLast(script, 'const batoWord ='), ';');
|
||||||
|
final batoPass =
|
||||||
|
substringBefore(substringAfterLast(script, 'const batoPass ='), ';');
|
||||||
|
final evaluatedPass = deobfuscateJsPassword(batoPass);
|
||||||
|
final imgAccListString =
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
MPages mangaElementM(String res, MSource source) async {
|
||||||
|
final lang = source.lang.replaceAll("-", "_");
|
||||||
|
|
||||||
|
var resB = 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 (source.lang == "all" ||
|
||||||
|
source.lang == "en" && element.contains('no-flag') ||
|
||||||
|
element.contains('data-lang="$lang"')) {
|
||||||
|
final item = querySelectorAll(element,
|
||||||
|
selector: "a.item-cover",
|
||||||
|
typeElement: 2,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0)
|
||||||
|
.first;
|
||||||
|
final img = querySelectorAll(item,
|
||||||
|
selector: "img",
|
||||||
|
typeElement: 3,
|
||||||
|
attributes: "src",
|
||||||
|
typeRegExp: 0)
|
||||||
|
.first;
|
||||||
|
final url = querySelectorAll(item,
|
||||||
|
selector: "a",
|
||||||
|
typeElement: 3,
|
||||||
|
attributes: "href",
|
||||||
|
typeRegExp: 0)
|
||||||
|
.first;
|
||||||
|
images.add(img);
|
||||||
|
urls.add(url);
|
||||||
|
final title = querySelectorAll(element,
|
||||||
|
selector: "a.item-title",
|
||||||
|
typeElement: 0,
|
||||||
|
attributes: "",
|
||||||
|
typeRegExp: 0)
|
||||||
|
.first;
|
||||||
|
names.add(title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<MManga> mangaList = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < urls.length; i++) {
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.name = names[i];
|
||||||
|
manga.imageUrl = images[i];
|
||||||
|
manga.link = urls[i];
|
||||||
|
mangaList.add(manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(mangaList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
String lang(String lang) {
|
||||||
|
lang = lang.replaceAll("-", "_");
|
||||||
|
if (lang == "all") {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return "langs=$lang";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Batoto main() {
|
||||||
|
return Batoto();
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import '../../../../model/source.dart';
|
import '../../../../model/source.dart';
|
||||||
import '../../../../utils/utils.dart';
|
import '../../../../utils/utils.dart';
|
||||||
|
|
||||||
const batotoVersion = "0.0.3";
|
const batotoVersion = "0.0.35";
|
||||||
const batotoSourceCodeUrl =
|
const batotoSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/src/all/batoto/batoto-v$batotoVersion.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/src/all/batoto/batoto-v$batotoVersion.dart";
|
||||||
|
|
||||||
|
|||||||
@@ -1,149 +0,0 @@
|
|||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
getLatestUpdatesManga(MManga manga) async {
|
|
||||||
final url =
|
|
||||||
"${manga.apiUrl}/v1.0/search?sort=uploaded&page=${manga.page}&tachiyomi=true";
|
|
||||||
final data = {"url": url, "headers": getHeader(manga.baseUrl)};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.names = MBridge.jsonPathToList(res, r'$.title', 0);
|
|
||||||
List<String> ids = MBridge.jsonPathToList(res, r'$.hid', 0);
|
|
||||||
List<String> mangaUrls = [];
|
|
||||||
for (var id in ids) {
|
|
||||||
mangaUrls.add("/comic/$id/#");
|
|
||||||
}
|
|
||||||
manga.urls = mangaUrls;
|
|
||||||
manga.images = MBridge.jsonPathToList(res, r'$.cover_url', 0);
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getMangaDetail(MManga manga) async {
|
|
||||||
final statusList = [
|
|
||||||
{
|
|
||||||
"1": 0,
|
|
||||||
"2": 1,
|
|
||||||
"3": 3,
|
|
||||||
"4": 2,
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
|
|
||||||
final urll =
|
|
||||||
"${manga.apiUrl}${manga.link.replaceAll("#", '')}?tachiyomi=true";
|
|
||||||
final data = {"url": urll, "headers": headers};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.author = MBridge.jsonPathToString(res, r'$.authors[*].name', '');
|
|
||||||
manga.genre =
|
|
||||||
MBridge.jsonPathToString(res, r'$.genres[*].name', "_.").split("_.");
|
|
||||||
manga.description = MBridge.jsonPathToString(res, r'$..desc', '');
|
|
||||||
manga.status = MBridge.parseStatus(
|
|
||||||
MBridge.jsonPathToString(res, r'$..comic.status', ''), statusList);
|
|
||||||
final chapUrlReq =
|
|
||||||
"${manga.apiUrl}${manga.link.replaceAll("#", '')}chapters?lang=${manga.lang}&tachiyomi=true&page=1";
|
|
||||||
final dataReq = {"url": chapUrlReq, "headers": headers};
|
|
||||||
final request = await MBridge.http('GET', json.encode(dataReq));
|
|
||||||
if (request.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
var total = MBridge.jsonPathToString(request.body, r'$.total', '');
|
|
||||||
final chapterLimit = MBridge.intParse("$total");
|
|
||||||
final newChapUrlReq =
|
|
||||||
"${manga.apiUrl}${manga.link.replaceAll("#", '')}chapters?limit=$chapterLimit&lang=${manga.lang}&tachiyomi=true&page=1";
|
|
||||||
|
|
||||||
final newDataReq = {"url": newChapUrlReq, "headers": headers};
|
|
||||||
final newRequest = await MBridge.http('GET', json.encode(newDataReq));
|
|
||||||
if (newRequest.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
manga.urls =
|
|
||||||
MBridge.jsonPathToString(newRequest.body, r'$.chapters[*].hid', "_.")
|
|
||||||
.split("_.");
|
|
||||||
final chapDate = MBridge.jsonPathToString(
|
|
||||||
newRequest.body, r'$.chapters[*].created_at', "_.")
|
|
||||||
.split("_.");
|
|
||||||
manga.chaptersDateUploads =
|
|
||||||
MBridge.listParseDateTime(chapDate, "yyyy-MM-dd'T'HH:mm:ss'Z'", "en");
|
|
||||||
manga.chaptersVolumes =
|
|
||||||
MBridge.jsonPathToString(newRequest.body, r'$.chapters[*].vol', "_.")
|
|
||||||
.split("_.");
|
|
||||||
manga.chaptersScanlators = MBridge.jsonPathToString(
|
|
||||||
newRequest.body, r'$.chapters[*].group_name', "_.")
|
|
||||||
.split("_.");
|
|
||||||
manga.names =
|
|
||||||
MBridge.jsonPathToString(newRequest.body, r'$.chapters[*].title', "_.")
|
|
||||||
.split("_.");
|
|
||||||
manga.chaptersChaps =
|
|
||||||
MBridge.jsonPathToString(newRequest.body, r'$.chapters[*].chap', "_.")
|
|
||||||
.split("_.");
|
|
||||||
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getPopularManga(MManga manga) async {
|
|
||||||
final urll =
|
|
||||||
"${manga.apiUrl}/v1.0/search?sort=follow&page=${manga.page}&tachiyomi=true";
|
|
||||||
final data = {"url": urll, "headers": getHeader(manga.baseUrl)};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.names = MBridge.jsonPathToList(res, r'$.title', 0);
|
|
||||||
List<String> ids = MBridge.jsonPathToList(res, r'$.hid', 0);
|
|
||||||
List<String> mangaUrls = [];
|
|
||||||
for (var id in ids) {
|
|
||||||
mangaUrls.add("/comic/$id/#");
|
|
||||||
}
|
|
||||||
manga.urls = mangaUrls;
|
|
||||||
manga.images = MBridge.jsonPathToList(res, r'$.cover_url', 0);
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
searchManga(MManga manga) async {
|
|
||||||
final urll = "${manga.apiUrl}/v1.0/search?q=${manga.query}&tachiyomi=true";
|
|
||||||
final data = {"url": urll, "headers": getHeader(manga.baseUrl)};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.names = MBridge.jsonPathToList(res, r'$.title', 0);
|
|
||||||
List<String> ids = MBridge.jsonPathToList(res, r'$.hid', 0);
|
|
||||||
List<String> mangaUrls = [];
|
|
||||||
for (var id in ids) {
|
|
||||||
mangaUrls.add("/comic/$id/#");
|
|
||||||
}
|
|
||||||
manga.urls = mangaUrls;
|
|
||||||
manga.images = MBridge.jsonPathToList(res, r'$.cover_url', 0);
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getChapterPages(MManga manga) async {
|
|
||||||
final url = "${manga.apiUrl}/chapter/${manga.link}?tachiyomi=true";
|
|
||||||
final data = {"url": url, "headers": getHeader(url)};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
return MBridge.jsonPathToString(res, r'$.chapter.images[*].url', '_.')
|
|
||||||
.split('_.');
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, String> getHeader(String url) {
|
|
||||||
final headers = {
|
|
||||||
"Referer": "$url/",
|
|
||||||
'User-Agent':
|
|
||||||
"Tachiyomi Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:110.0) Gecko/20100101 Firefox/110.0"
|
|
||||||
};
|
|
||||||
return headers;
|
|
||||||
}
|
|
||||||
182
manga/src/all/comick/comick-v0.0.35.dart
Normal file
182
manga/src/all/comick/comick-v0.0.35.dart
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
import 'package:mangayomi/bridge_lib.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class ComickFun extends MProvider {
|
||||||
|
ComickFun();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getPopular(MSource source, int page) async {
|
||||||
|
final url =
|
||||||
|
"${source.apiUrl}/v1.0/search?sort=follow&page=$page&tachiyomi=true";
|
||||||
|
final data = {"url": url, "headers": getHeader(source.baseUrl)};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
return mangaRes(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||||
|
final url =
|
||||||
|
"${source.apiUrl}/v1.0/search?sort=uploaded&page=$page&tachiyomi=true";
|
||||||
|
final data = {"url": url, "headers": getHeader(source.baseUrl)};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
return mangaRes(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> search(MSource source, String query, int page) async {
|
||||||
|
final url = "${source.apiUrl}/v1.0/search?q=$query&tachiyomi=true";
|
||||||
|
final data = {"url": url, "headers": getHeader(source.baseUrl)};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
return mangaRes(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MManga> getDetail(MSource source, String url) async {
|
||||||
|
final statusList = [
|
||||||
|
{"1": 0, "2": 1, "3": 3, "4": 2}
|
||||||
|
];
|
||||||
|
|
||||||
|
final headers = getHeader(source.baseUrl);
|
||||||
|
|
||||||
|
final urll = "${source.apiUrl}${url.replaceAll("#", '')}?tachiyomi=true";
|
||||||
|
final data = {"url": urll, "headers": headers};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.author = jsonPathToString(res, r'$.authors[*].name', '');
|
||||||
|
manga.genre = jsonPathToString(res, r'$.genres[*].name', "_.").split("_.");
|
||||||
|
manga.description = jsonPathToString(res, r'$..desc', '');
|
||||||
|
manga.status =
|
||||||
|
parseStatus(jsonPathToString(res, r'$..comic.status', ''), statusList);
|
||||||
|
final chapUrlReq =
|
||||||
|
"${source.apiUrl}${url.replaceAll("#", '')}chapters?lang=${source.lang}&tachiyomi=true&page=1";
|
||||||
|
final dataReq = {"url": chapUrlReq, "headers": headers};
|
||||||
|
final request = await http('GET', json.encode(dataReq));
|
||||||
|
var total = jsonPathToString(request, r'$.total', '');
|
||||||
|
final chapterLimit = int.parse(total);
|
||||||
|
final newChapUrlReq =
|
||||||
|
"${source.apiUrl}${url.replaceAll("#", '')}chapters?limit=$chapterLimit&lang=${source.lang}&tachiyomi=true&page=1";
|
||||||
|
|
||||||
|
final newDataReq = {"url": newChapUrlReq, "headers": headers};
|
||||||
|
final newRequest = await http('GET', json.encode(newDataReq));
|
||||||
|
|
||||||
|
final chapsUrls =
|
||||||
|
jsonPathToString(newRequest, r'$.chapters[*].hid', "_.").split("_.");
|
||||||
|
final chapDate =
|
||||||
|
jsonPathToString(newRequest, r'$.chapters[*].created_at', "_.")
|
||||||
|
.split("_.");
|
||||||
|
final chaptersVolumes =
|
||||||
|
jsonPathToString(newRequest, r'$.chapters[*].vol', "_.").split("_.");
|
||||||
|
final chaptersScanlators =
|
||||||
|
jsonPathToString(newRequest, r'$.chapters[*].group_name', "_.")
|
||||||
|
.split("_.");
|
||||||
|
final chapsNames =
|
||||||
|
jsonPathToString(newRequest, r'$.chapters[*].title', "_.").split("_.");
|
||||||
|
final chaptersChaps =
|
||||||
|
jsonPathToString(newRequest, r'$.chapters[*].chap', "_.").split("_.");
|
||||||
|
|
||||||
|
var dateUploads =
|
||||||
|
parseDates(chapDate, source.dateFormat, source.dateFormatLocale);
|
||||||
|
List<MChapter>? chaptersList = [];
|
||||||
|
for (var i = 0; i < chapsNames.length; i++) {
|
||||||
|
String title = "";
|
||||||
|
String scanlator = "";
|
||||||
|
if (chaptersChaps.isNotEmpty && chaptersVolumes.isNotEmpty) {
|
||||||
|
title = beautifyChapterName(
|
||||||
|
chaptersVolumes[i], chaptersChaps[i], chapsNames[i], source.lang);
|
||||||
|
} else {
|
||||||
|
title = chapsNames[i];
|
||||||
|
}
|
||||||
|
if (chaptersScanlators.isNotEmpty) {
|
||||||
|
scanlator = chaptersScanlators[i]
|
||||||
|
.toString()
|
||||||
|
.replaceAll(']', "")
|
||||||
|
.replaceAll("[", "");
|
||||||
|
}
|
||||||
|
MChapter chapter = MChapter();
|
||||||
|
chapter.name = title;
|
||||||
|
chapter.url = chapsUrls[i];
|
||||||
|
chapter.scanlator = scanlator == "null" ? "" : scanlator;
|
||||||
|
chapter.dateUpload = dateUploads[i];
|
||||||
|
chaptersList.add(chapter);
|
||||||
|
}
|
||||||
|
manga.chapters = chaptersList;
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<String>> getPageList(MSource source, String url) async {
|
||||||
|
final urll = "${source.apiUrl}/chapter/$url?tachiyomi=true";
|
||||||
|
final data = {"url": urll, "headers": getHeader(url)};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
return jsonPathToString(res, r'$.chapter.images[*].url', '_.').split('_.');
|
||||||
|
}
|
||||||
|
|
||||||
|
MPages mangaRes(String res) async {
|
||||||
|
final names = jsonPathToList(res, r'$.title', 0);
|
||||||
|
List<String> ids = jsonPathToList(res, r'$.hid', 0);
|
||||||
|
List<String> mangaUrls = [];
|
||||||
|
for (var id in ids) {
|
||||||
|
mangaUrls.add("/comic/$id/#");
|
||||||
|
}
|
||||||
|
final urls = mangaUrls;
|
||||||
|
final images = jsonPathToList(res, r'$.cover_url', 0);
|
||||||
|
List<MManga> mangaList = [];
|
||||||
|
for (var i = 0; i < urls.length; i++) {
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.name = names[i];
|
||||||
|
manga.imageUrl = images[i];
|
||||||
|
manga.link = urls[i];
|
||||||
|
mangaList.add(manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(mangaList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
String beautifyChapterName(
|
||||||
|
String vol, String chap, String title, String lang) {
|
||||||
|
String result = "";
|
||||||
|
|
||||||
|
if (vol != "null" && vol.isNotEmpty) {
|
||||||
|
if (chap != "null" && chap.isEmpty) {
|
||||||
|
result += "Volume $vol ";
|
||||||
|
} else {
|
||||||
|
result += "Vol. $vol ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chap != "null" && chap.isNotEmpty) {
|
||||||
|
if (vol != "null" && vol.isEmpty) {
|
||||||
|
if (lang != "null" && lang == "fr") {
|
||||||
|
result += "Chapitre $chap";
|
||||||
|
} else {
|
||||||
|
result += "Chapter $chap";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result += "Ch. $chap ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (title != "null" && title.isNotEmpty) {
|
||||||
|
if (chap != "null" && chap.isEmpty) {
|
||||||
|
result += title;
|
||||||
|
} else {
|
||||||
|
result += " : $title";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> getHeader(String url) {
|
||||||
|
final headers = {
|
||||||
|
"Referer": "$url/",
|
||||||
|
'User-Agent':
|
||||||
|
"Tachiyomi Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:110.0) Gecko/20100101 Firefox/110.0"
|
||||||
|
};
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
ComickFun main() {
|
||||||
|
return ComickFun();
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import '../../../../model/source.dart';
|
import '../../../../model/source.dart';
|
||||||
import '../../../../utils/utils.dart';
|
import '../../../../utils/utils.dart';
|
||||||
|
|
||||||
const comickVersion = "0.0.3";
|
const comickVersion = "0.0.35";
|
||||||
const comickSourceCodeUrl =
|
const comickSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/src/all/comick/comick-v$comickVersion.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/src/all/comick/comick-v$comickVersion.dart";
|
||||||
|
|
||||||
|
|||||||
@@ -1,333 +0,0 @@
|
|||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
getPopularManga(MManga manga) async {
|
|
||||||
int page = (20 * (manga.page - 1));
|
|
||||||
final url =
|
|
||||||
"https://api.mangadex.org/manga?limit=20&offset=$page&availableTranslatedLanguage[]=en&includes[]=cover_art${getMDXContentRating()}&order[followedCount]=desc";
|
|
||||||
final datas = {"url": url};
|
|
||||||
final response = await MBridge.http('GET', json.encode(datas));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
return parseManga(response.body, manga);
|
|
||||||
}
|
|
||||||
|
|
||||||
getLatestUpdatesManga(MManga manga) async {
|
|
||||||
int page = (20 * (manga.page - 1));
|
|
||||||
final urll =
|
|
||||||
"https://api.mangadex.org/chapter?limit=20&offset=$page&translatedLanguage[]=${manga.lang}&includeFutureUpdates=0&order[publishAt]=desc&includeFuturePublishAt=0&includeEmptyPages=0";
|
|
||||||
final datas = {"url": urll};
|
|
||||||
final response = await MBridge.http('GET', json.encode(datas));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String ress = response.body;
|
|
||||||
|
|
||||||
final mangaIds = MBridge.listParse(
|
|
||||||
MBridge.jsonPathToString(ress, r'$.data[*].relationships[*].id', '.--')
|
|
||||||
.split('.--'),
|
|
||||||
3);
|
|
||||||
String mangaa = "".toString();
|
|
||||||
for (var id in mangaIds) {
|
|
||||||
mangaa += "&ids[]=$id";
|
|
||||||
}
|
|
||||||
final newUrl =
|
|
||||||
"https://api.mangadex.org/manga?includes[]=cover_art&limit=${mangaIds.length}${getMDXContentRating()}$mangaa";
|
|
||||||
final datass = {"url": newUrl};
|
|
||||||
final res = await MBridge.http('GET', json.encode(datass));
|
|
||||||
if (res.hasError) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
return parseManga(res.body, manga);
|
|
||||||
}
|
|
||||||
|
|
||||||
searchManga(MManga manga) async {
|
|
||||||
final url =
|
|
||||||
"https://api.mangadex.org/manga?includes[]=cover_art&offset=0&limit=20&title=${manga.query}${getMDXContentRating()}&order[followedCount]=desc&availableTranslatedLanguage[]=${manga.lang}";
|
|
||||||
final datas = {"url": url};
|
|
||||||
final res = await MBridge.http('GET', json.encode(datas));
|
|
||||||
if (res.hasError) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
return parseManga(res.body, manga);
|
|
||||||
}
|
|
||||||
|
|
||||||
getMangaDetail(MManga manga) async {
|
|
||||||
final statusList = [
|
|
||||||
{
|
|
||||||
"ongoing": 0,
|
|
||||||
"completed": 1,
|
|
||||||
"hiatus": 2,
|
|
||||||
"cancelled": 3,
|
|
||||||
}
|
|
||||||
];
|
|
||||||
final url =
|
|
||||||
"https://api.mangadex.org${manga.link}?includes[]=cover_art&includes[]=author&includes[]=artist";
|
|
||||||
final datas = {"url": url};
|
|
||||||
final response = await MBridge.http('GET', json.encode(datas));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.author = MBridge.jsonPathToString(
|
|
||||||
res, r'$..data.relationships[*].attributes.name', ', ');
|
|
||||||
|
|
||||||
String expressionDescriptionA = r'$..data.attributes.description.en';
|
|
||||||
String expressionDescription = MBridge.regExp(
|
|
||||||
r'$..data.attributes.description[a]', r'\[a\]', ".${manga.lang}", 0, 1);
|
|
||||||
|
|
||||||
String description = MBridge.jsonPathToString(res, expressionDescription, '');
|
|
||||||
if (description.isEmpty) {
|
|
||||||
description = MBridge.jsonPathToString(res, expressionDescriptionA, '');
|
|
||||||
}
|
|
||||||
manga.description = description;
|
|
||||||
List<String> genres = [];
|
|
||||||
|
|
||||||
final genre = MBridge.listParse(
|
|
||||||
MBridge.jsonPathToString(
|
|
||||||
res, r'$..data.attributes.tags[*].attributes.name.en', '.-')
|
|
||||||
.split('.-'),
|
|
||||||
0);
|
|
||||||
genres = genre;
|
|
||||||
String contentRating =
|
|
||||||
MBridge.jsonPathToString(res, r'$..data.attributes.contentRating', '');
|
|
||||||
if (contentRating == "safe") {
|
|
||||||
} else {
|
|
||||||
genres.add(contentRating);
|
|
||||||
}
|
|
||||||
String publicationDemographic = MBridge.jsonPathToString(
|
|
||||||
res, r'$..data.attributes.publicationDemographic', '');
|
|
||||||
if (publicationDemographic == "null") {
|
|
||||||
} else {
|
|
||||||
genres.add(publicationDemographic);
|
|
||||||
}
|
|
||||||
manga.genre = genres;
|
|
||||||
String statusRes =
|
|
||||||
MBridge.jsonPathToString(res, r'$..data.attributes.status', '');
|
|
||||||
manga.status = MBridge.parseStatus(statusRes, statusList);
|
|
||||||
final mangaId = MBridge.listParse(manga.link.split('/'), 2)[0];
|
|
||||||
final paginatedChapterList =
|
|
||||||
await paginatedChapterListRequest(mangaId, 0, manga.lang);
|
|
||||||
final chapterList =
|
|
||||||
MBridge.jsonPathToString(paginatedChapterList, r'$.data[*]', '_.')
|
|
||||||
.split('_.');
|
|
||||||
int limit = MBridge.intParse(
|
|
||||||
MBridge.jsonPathToString(paginatedChapterList, r'$.limit', ''));
|
|
||||||
int offset = MBridge.intParse(
|
|
||||||
MBridge.jsonPathToString(paginatedChapterList, r'$.offset', ''));
|
|
||||||
int total = MBridge.intParse(
|
|
||||||
MBridge.jsonPathToString(paginatedChapterList, r'$.total', ''));
|
|
||||||
List<MManga> chapterListA = [];
|
|
||||||
List<String> chapNames = [];
|
|
||||||
List<String> scanlators = [];
|
|
||||||
List<String> chapterUrl = [];
|
|
||||||
List<String> chapterDate = [];
|
|
||||||
|
|
||||||
final list = getChapters(
|
|
||||||
manga, MBridge.intParse("${chapterList.length}"), paginatedChapterList);
|
|
||||||
|
|
||||||
chapterListA.add(list);
|
|
||||||
var hasMoreResults = (limit + offset) < total;
|
|
||||||
while (hasMoreResults) {
|
|
||||||
offset += limit;
|
|
||||||
var newRequest =
|
|
||||||
await paginatedChapterListRequest(mangaId, offset, manga.lang);
|
|
||||||
int total =
|
|
||||||
MBridge.intParse(MBridge.jsonPathToString(newRequest, r'$.total', ''));
|
|
||||||
final chapterList =
|
|
||||||
MBridge.jsonPathToString(paginatedChapterList, r'$.data[*]', '_.')
|
|
||||||
.split('_.');
|
|
||||||
final list = getChapters(
|
|
||||||
manga, MBridge.intParse("${chapterList.length}"), newRequest);
|
|
||||||
chapterListA.add(list);
|
|
||||||
hasMoreResults = (limit + offset) < total;
|
|
||||||
}
|
|
||||||
for (var element in chapterListA) {
|
|
||||||
for (var name in element.names) {
|
|
||||||
if (name.isNotEmpty) {
|
|
||||||
chapNames.add(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (var element in chapterListA) {
|
|
||||||
for (var url in element.urls) {
|
|
||||||
if (url.isNotEmpty) {
|
|
||||||
chapterUrl.add(url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (var element in chapterListA) {
|
|
||||||
for (var chapDate in element.chaptersDateUploads) {
|
|
||||||
if (chapDate.isNotEmpty) {
|
|
||||||
chapterDate.add(chapDate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (var element in chapterListA) {
|
|
||||||
for (var scanlator in element.chaptersScanlators) {
|
|
||||||
if (scanlator.isNotEmpty) {
|
|
||||||
scanlators.add(scanlator);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
manga.urls = chapterUrl;
|
|
||||||
manga.chaptersDateUploads = chapterDate;
|
|
||||||
manga.chaptersScanlators = scanlators;
|
|
||||||
manga.names = chapNames;
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
getChapterPages(MManga manga) async {
|
|
||||||
final url = "https://api.mangadex.org/at-home/server/${manga.link}";
|
|
||||||
final data = {"url": url};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
final dataRes = json.decode(response.body);
|
|
||||||
final host = dataRes["baseUrl"];
|
|
||||||
final hash = dataRes["chapter"]["hash"];
|
|
||||||
final chapterDatas = dataRes["chapter"]["data"] as List;
|
|
||||||
return chapterDatas.map((e) => "$host/data/$hash/$e").toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
String getMDXContentRating() {
|
|
||||||
String ctnRating =
|
|
||||||
"&contentRating[]=suggestive&contentRating[]=safe&contentRating[]=erotica&contentRating[]=pornographic";
|
|
||||||
return ctnRating;
|
|
||||||
}
|
|
||||||
|
|
||||||
MManga getChapters(MManga manga, int length, String paginatedChapterListA) {
|
|
||||||
String scanlators = "".toString();
|
|
||||||
String chapNames = "".toString();
|
|
||||||
String chapDate = "".toString();
|
|
||||||
String chapterUrl = "".toString();
|
|
||||||
String paginatedChapterList = paginatedChapterListA.toString();
|
|
||||||
final dataList =
|
|
||||||
MBridge.jsonPathToList(paginatedChapterList, r'$.data[*]', 0);
|
|
||||||
for (var res in dataList) {
|
|
||||||
String scan = "".toString();
|
|
||||||
final groups = MBridge.jsonPathToList(res,
|
|
||||||
r'$.relationships[?@.id!="00e03853-1b96-4f41-9542-c71b8692033b"]', 0);
|
|
||||||
String chapName = "".toString();
|
|
||||||
for (var element in groups) {
|
|
||||||
final data = MBridge.getMapValue(element, "attributes", encode: true);
|
|
||||||
if (data.isEmpty) {
|
|
||||||
} else {
|
|
||||||
final name = MBridge.getMapValue(data, "name");
|
|
||||||
scan += "$name".toString();
|
|
||||||
final username = MBridge.getMapValue(data, "username");
|
|
||||||
if (username.isEmpty) {
|
|
||||||
} else {
|
|
||||||
if (scan.isEmpty) {
|
|
||||||
scan += "Uploaded by $username".toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (scan.isEmpty) {
|
|
||||||
scan = "No Group".toString();
|
|
||||||
}
|
|
||||||
final dataRes = MBridge.getMapValue(res, "attributes", encode: true);
|
|
||||||
if (dataRes.isEmpty) {
|
|
||||||
} else {
|
|
||||||
final data = MBridge.getMapValue(res, "attributes", encode: true);
|
|
||||||
final volume = MBridge.getMapValue(data, "volume");
|
|
||||||
if (volume.isEmpty) {
|
|
||||||
} else {
|
|
||||||
if (volume == "null") {
|
|
||||||
} else {
|
|
||||||
chapName = "Vol.$volume ".toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final chapter = MBridge.getMapValue(data, "chapter");
|
|
||||||
if (chapter.isEmpty) {
|
|
||||||
} else {
|
|
||||||
if (chapter == "null") {
|
|
||||||
} else {
|
|
||||||
chapName += "Ch.$chapter ".toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final title = MBridge.getMapValue(data, "title");
|
|
||||||
if (title.isEmpty) {
|
|
||||||
} else {
|
|
||||||
if (title == "null") {
|
|
||||||
} else {
|
|
||||||
if (chapName.isEmpty) {
|
|
||||||
} else {
|
|
||||||
chapName += "- ".toString();
|
|
||||||
}
|
|
||||||
chapName += "$title".toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (chapName.isEmpty) {
|
|
||||||
chapName += "Oneshot".toString();
|
|
||||||
}
|
|
||||||
final date = MBridge.getMapValue(data, "publishAt");
|
|
||||||
final id = MBridge.getMapValue(res, "id");
|
|
||||||
chapterUrl += "._$id";
|
|
||||||
chapDate += "._._$date";
|
|
||||||
scanlators += "._$scan";
|
|
||||||
chapNames += "._$chapName";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
manga.chaptersDateUploads = MBridge.listParseDateTime(
|
|
||||||
chapDate.split("._._"), "yyyy-MM-dd'T'HH:mm:ss+SSS", "en_US");
|
|
||||||
|
|
||||||
manga.urls = chapterUrl.split("._");
|
|
||||||
manga.chaptersScanlators = scanlators.split("._");
|
|
||||||
manga.names = chapNames.split("._");
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String> paginatedChapterListRequest(
|
|
||||||
String mangaId, int offset, String lang) async {
|
|
||||||
final url =
|
|
||||||
'https://api.mangadex.org/manga/$mangaId/feed?limit=500&offset=$offset&includes[]=user&includes[]=scanlation_group&order[volume]=desc&order[chapter]=desc&translatedLanguage[]=$lang&includeFuturePublishAt=0&includeEmptyPages=0${getMDXContentRating()}';
|
|
||||||
final datas = {"url": url};
|
|
||||||
final response = await MBridge.http('GET', json.encode(datas));
|
|
||||||
return response.body;
|
|
||||||
}
|
|
||||||
|
|
||||||
String findTitle(Map<String, dynamic> dataRes, String lang) {
|
|
||||||
final altTitlesJ = dataRes["attributes"]["altTitles"];
|
|
||||||
final titleJ = dataRes["attributes"]["title"];
|
|
||||||
final title = MBridge.getMapValue(json.encode(titleJ), "en");
|
|
||||||
if (title.isEmpty) {
|
|
||||||
for (var r in altTitlesJ) {
|
|
||||||
final altTitle = MBridge.getMapValue(json.encode(r), "en");
|
|
||||||
if (altTitle.isNotEmpty) {
|
|
||||||
return altTitle;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
String getCover(Map<String, dynamic> dataRes) {
|
|
||||||
final relationships = dataRes["relationships"];
|
|
||||||
String coverFileName = "".toString();
|
|
||||||
for (var a in relationships) {
|
|
||||||
final relationType = a["type"];
|
|
||||||
if (relationType == "cover_art") {
|
|
||||||
if (coverFileName.isEmpty) {
|
|
||||||
coverFileName =
|
|
||||||
"https://uploads.mangadex.org/covers/${dataRes["id"]}/${a["attributes"]["fileName"]}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return coverFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
MManga parseManga(String res, MManga manga) {
|
|
||||||
if (res.isEmpty) {
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
final datasRes = json.decode(res);
|
|
||||||
final resJson = datasRes["data"] as List;
|
|
||||||
manga.names = resJson.map((e) => findTitle(e, manga.lang)).toList();
|
|
||||||
manga.urls = resJson.map((e) => "/manga/${e["id"]}").toList();
|
|
||||||
manga.images = resJson.map((e) => getCover(e)).toList();
|
|
||||||
return manga;
|
|
||||||
}
|
|
||||||
265
manga/src/all/mangadex/mangadex-v0.0.35.dart
Normal file
265
manga/src/all/mangadex/mangadex-v0.0.35.dart
Normal file
@@ -0,0 +1,265 @@
|
|||||||
|
import 'package:mangayomi/bridge_lib.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class MangaDex extends MProvider {
|
||||||
|
MangaDex();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getPopular(MSource source, int page) async {
|
||||||
|
page = (20 * (page - 1));
|
||||||
|
final url =
|
||||||
|
"https://api.mangadex.org/manga?limit=20&offset=$page&availableTranslatedLanguage[]=en&includes[]=cover_art${getMDXContentRating()}&order[followedCount]=desc";
|
||||||
|
final datas = {"url": url};
|
||||||
|
final res = await http('GET', json.encode(datas));
|
||||||
|
return mangaRes(res, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||||
|
page = (20 * (page - 1));
|
||||||
|
final urll =
|
||||||
|
"https://api.mangadex.org/chapter?limit=20&offset=$page&translatedLanguage[]=${source.lang}&includeFutureUpdates=0&order[publishAt]=desc&includeFuturePublishAt=0&includeEmptyPages=0";
|
||||||
|
final datas = {"url": urll};
|
||||||
|
final ress = await http('GET', json.encode(datas));
|
||||||
|
final mangaIds =
|
||||||
|
jsonPathToString(ress, r'$.data[*].relationships[*].id', '.--')
|
||||||
|
.split('.--');
|
||||||
|
String mangaIdss = "".toString();
|
||||||
|
for (var id in mangaIds) {
|
||||||
|
mangaIdss += "&ids[]=$id";
|
||||||
|
}
|
||||||
|
final newUrl =
|
||||||
|
"https://api.mangadex.org/manga?includes[]=cover_art&limit=${mangaIds.length}${getMDXContentRating()}$mangaIdss";
|
||||||
|
final res = await http('GET', json.encode({"url": newUrl}));
|
||||||
|
return mangaRes(res, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> search(MSource source, String query, int page) async {
|
||||||
|
final url =
|
||||||
|
"https://api.mangadex.org/manga?includes[]=cover_art&offset=0&limit=20&title=$query${getMDXContentRating()}&order[followedCount]=desc&availableTranslatedLanguage[]=${source.lang}";
|
||||||
|
|
||||||
|
final res = await http('GET', json.encode({"url": url}));
|
||||||
|
return mangaRes(res, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MManga> getDetail(MSource source, String url) async {
|
||||||
|
final statusList = [
|
||||||
|
{"ongoing": 0, "completed": 1, "hiatus": 2, "cancelled": 3}
|
||||||
|
];
|
||||||
|
|
||||||
|
final urll =
|
||||||
|
"https://api.mangadex.org$url?includes[]=cover_art&includes[]=author&includes[]=artist";
|
||||||
|
final res = await http('GET', json.encode({"url": urll}));
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.author = jsonPathToString(
|
||||||
|
res, r'$..data.relationships[*].attributes.name', ', ');
|
||||||
|
|
||||||
|
String expressionDescriptionA = r'$..data.attributes.description.en';
|
||||||
|
String expressionDescription = regExp(r'$..data.attributes.description[a]',
|
||||||
|
r'\[a\]', ".${source.lang}", 0, 1);
|
||||||
|
|
||||||
|
String description = jsonPathToString(res, expressionDescription, '');
|
||||||
|
if (description.isEmpty) {
|
||||||
|
description = jsonPathToString(res, expressionDescriptionA, '');
|
||||||
|
}
|
||||||
|
manga.description = description;
|
||||||
|
List<String> genres = [];
|
||||||
|
|
||||||
|
genres = jsonPathToString(
|
||||||
|
res, r'$..data.attributes.tags[*].attributes.name.en', '.-')
|
||||||
|
.split('.-');
|
||||||
|
|
||||||
|
String contentRating =
|
||||||
|
jsonPathToString(res, r'$..data.attributes.contentRating', '');
|
||||||
|
if (contentRating != "safe") {
|
||||||
|
genres.add(contentRating);
|
||||||
|
}
|
||||||
|
String publicationDemographic =
|
||||||
|
jsonPathToString(res, r'$..data.attributes.publicationDemographic', '');
|
||||||
|
if (publicationDemographic == "null") {
|
||||||
|
} else {
|
||||||
|
genres.add(publicationDemographic);
|
||||||
|
}
|
||||||
|
manga.genre = genres;
|
||||||
|
String statusRes = jsonPathToString(res, r'$..data.attributes.status', '');
|
||||||
|
manga.status = parseStatus(statusRes, statusList);
|
||||||
|
final mangaId = url.split('/').last;
|
||||||
|
|
||||||
|
final paginatedChapterList =
|
||||||
|
await paginatedChapterListRequest(mangaId, 0, source.lang);
|
||||||
|
final chapterList =
|
||||||
|
jsonPathToString(paginatedChapterList, r'$.data[*]', '_.').split('_.');
|
||||||
|
int limit =
|
||||||
|
int.parse(jsonPathToString(paginatedChapterList, r'$.limit', ''));
|
||||||
|
int offset =
|
||||||
|
int.parse(jsonPathToString(paginatedChapterList, r'$.offset', ''));
|
||||||
|
int total =
|
||||||
|
int.parse(jsonPathToString(paginatedChapterList, r'$.total', ''));
|
||||||
|
List<MChapter> chapterListA = [];
|
||||||
|
|
||||||
|
final list =
|
||||||
|
getChapters(int.parse("${chapterList.length}"), paginatedChapterList);
|
||||||
|
|
||||||
|
chapterListA.addAll(list);
|
||||||
|
var hasMoreResults = (limit + offset) < total;
|
||||||
|
while (hasMoreResults) {
|
||||||
|
offset += limit;
|
||||||
|
var newRequest =
|
||||||
|
await paginatedChapterListRequest(mangaId, offset, source.lang);
|
||||||
|
int total = int.parse(jsonPathToString(newRequest, r'$.total', ''));
|
||||||
|
final chapterList =
|
||||||
|
jsonPathToString(paginatedChapterList, r'$.data[*]', '_.')
|
||||||
|
.split('_.');
|
||||||
|
final list = getChapters(int.parse("${chapterList.length}"), newRequest);
|
||||||
|
chapterListA.addAll(list);
|
||||||
|
hasMoreResults = (limit + offset) < total;
|
||||||
|
}
|
||||||
|
|
||||||
|
manga.chapters = chapterListA;
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<String>> getPageList(MSource source, String url) async {
|
||||||
|
final urll = "https://api.mangadex.org/at-home/server/$url";
|
||||||
|
|
||||||
|
final res = await http('GET', json.encode({"url": urll}));
|
||||||
|
|
||||||
|
final dataRes = json.decode(res);
|
||||||
|
final host = dataRes["baseUrl"];
|
||||||
|
final hash = dataRes["chapter"]["hash"];
|
||||||
|
final chapterDatas = dataRes["chapter"]["data"] as List;
|
||||||
|
return chapterDatas.map((e) => "$host/data/$hash/$e").toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
MPages mangaRes(String res, MSource source) {
|
||||||
|
final datasRes = json.decode(res);
|
||||||
|
final resJson = datasRes["data"] as List;
|
||||||
|
List<MManga> mangaList = [];
|
||||||
|
for (var e in resJson) {
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.name = findTitle(e, source.lang);
|
||||||
|
manga.imageUrl = getCover(e);
|
||||||
|
manga.link = "/manga/${e["id"]}";
|
||||||
|
mangaList.add(manga);
|
||||||
|
}
|
||||||
|
return MPages(mangaList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MChapter> getChapters(int length, String paginatedChapterListA) {
|
||||||
|
List<MChapter> chaptersList = [];
|
||||||
|
String paginatedChapterList = paginatedChapterListA.toString();
|
||||||
|
final dataList = jsonPathToList(paginatedChapterList, r'$.data[*]', 0);
|
||||||
|
for (var res in dataList) {
|
||||||
|
String scan = "".toString();
|
||||||
|
final groups = jsonPathToList(res,
|
||||||
|
r'$.relationships[?@.id!="00e03853-1b96-4f41-9542-c71b8692033b"]', 0);
|
||||||
|
String chapName = "".toString();
|
||||||
|
for (var element in groups) {
|
||||||
|
final data = getMapValue(element, "attributes", encode: true);
|
||||||
|
if (data.isNotEmpty) {
|
||||||
|
final name = getMapValue(data, "name");
|
||||||
|
scan += "$name".toString();
|
||||||
|
final username = getMapValue(data, "username");
|
||||||
|
if (username.isNotEmpty) {
|
||||||
|
if (scan.isEmpty) {
|
||||||
|
scan += "Uploaded by $username".toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (scan.isEmpty) {
|
||||||
|
scan = "No Group".toString();
|
||||||
|
}
|
||||||
|
final dataRes = getMapValue(res, "attributes", encode: true);
|
||||||
|
if (dataRes.isNotEmpty) {
|
||||||
|
final data = getMapValue(res, "attributes", encode: true);
|
||||||
|
final volume = getMapValue(data, "volume");
|
||||||
|
if (volume.isNotEmpty) {
|
||||||
|
if (volume != "null") {
|
||||||
|
chapName = "Vol.$volume ".toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final chapter = getMapValue(data, "chapter");
|
||||||
|
if (chapter.isNotEmpty) {
|
||||||
|
if (chapter != "null") {
|
||||||
|
chapName += "Ch.$chapter ".toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final title = getMapValue(data, "title");
|
||||||
|
if (title.isNotEmpty) {
|
||||||
|
if (title != "null") {
|
||||||
|
if (chapName.isNotEmpty) {
|
||||||
|
chapName += "- ".toString();
|
||||||
|
}
|
||||||
|
chapName += "$title".toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (chapName.isEmpty) {
|
||||||
|
chapName += "Oneshot".toString();
|
||||||
|
}
|
||||||
|
final date = getMapValue(data, "publishAt");
|
||||||
|
final id = getMapValue(res, "id");
|
||||||
|
MChapter chapterr = MChapter();
|
||||||
|
chapterr.name = chapName;
|
||||||
|
chapterr.url = id;
|
||||||
|
chapterr.scanlator = scan;
|
||||||
|
chapterr.dateUpload =
|
||||||
|
parseDates([date], "yyyy-MM-dd'T'HH:mm:ss+SSS", "en_US").first;
|
||||||
|
chaptersList.add(chapterr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return chaptersList;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<String> paginatedChapterListRequest(
|
||||||
|
String mangaId, int offset, String lang) async {
|
||||||
|
final url =
|
||||||
|
'https://api.mangadex.org/manga/$mangaId/feed?limit=500&offset=$offset&includes[]=user&includes[]=scanlation_group&order[volume]=desc&order[chapter]=desc&translatedLanguage[]=$lang&includeFuturePublishAt=0&includeEmptyPages=0${getMDXContentRating()}';
|
||||||
|
final res = await http('GET', json.encode({"url": url}));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getMDXContentRating() {
|
||||||
|
String ctnRating =
|
||||||
|
"&contentRating[]=suggestive&contentRating[]=safe&contentRating[]=erotica&contentRating[]=pornographic";
|
||||||
|
return ctnRating;
|
||||||
|
}
|
||||||
|
|
||||||
|
String findTitle(Map<String, dynamic> dataRes, String lang) {
|
||||||
|
final altTitlesJ = dataRes["attributes"]["altTitles"];
|
||||||
|
final titleJ = dataRes["attributes"]["title"];
|
||||||
|
final title = getMapValue(json.encode(titleJ), "en");
|
||||||
|
if (title.isEmpty) {
|
||||||
|
for (var r in altTitlesJ) {
|
||||||
|
final altTitle = getMapValue(json.encode(r), "en");
|
||||||
|
if (altTitle.isNotEmpty) {
|
||||||
|
return altTitle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getCover(Map<String, dynamic> dataRes) {
|
||||||
|
final relationships = dataRes["relationships"];
|
||||||
|
String coverFileName = "".toString();
|
||||||
|
for (var a in relationships) {
|
||||||
|
final relationType = a["type"];
|
||||||
|
if (relationType == "cover_art") {
|
||||||
|
if (coverFileName.isEmpty) {
|
||||||
|
coverFileName =
|
||||||
|
"https://uploads.mangadex.org/covers/${dataRes["id"]}/${a["attributes"]["fileName"]}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return coverFileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MangaDex main() {
|
||||||
|
return MangaDex();
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ import '../../../../utils/utils.dart';
|
|||||||
const apiUrl = 'https://api.mangadex.org';
|
const apiUrl = 'https://api.mangadex.org';
|
||||||
const baseUrl = 'https://mangadex.org';
|
const baseUrl = 'https://mangadex.org';
|
||||||
const isNsfw = true;
|
const isNsfw = true;
|
||||||
const mangadexVersion = "0.0.3";
|
const mangadexVersion = "0.0.35";
|
||||||
const mangadexSourceCodeUrl =
|
const mangadexSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/src/all/mangadex/mangadex-v$mangadexVersion.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/src/all/mangadex/mangadex-v$mangadexVersion.dart";
|
||||||
String _iconUrl = getIconUrl("mangadex", "all");
|
String _iconUrl = getIconUrl("mangadex", "all");
|
||||||
|
|||||||
@@ -1,190 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'package:bridge_lib/bridge_lib.dart';
|
|
||||||
|
|
||||||
searchManga(MManga 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 response = await MBridge.http('POST', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.names = MBridge.xpath(
|
|
||||||
res, '//*[contains(@class, "manga-list-4-list")]/li/a/@title');
|
|
||||||
manga.images = MBridge.xpath(res,
|
|
||||||
'//*[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(MManga manga) async {
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
final url = "${manga.baseUrl}/directory/${manga.page}.htm?latest";
|
|
||||||
|
|
||||||
final data = {"url": url, "headers": headers};
|
|
||||||
final response = await MBridge.http('POST', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.names = MBridge.xpath(
|
|
||||||
res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@title');
|
|
||||||
manga.images = MBridge.xpath(res,
|
|
||||||
'//*[ 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(MManga 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 response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
manga.author =
|
|
||||||
MBridge.xpath(res, '//*[@class="detail-info-right-say"]/a/text()').first;
|
|
||||||
manga.description =
|
|
||||||
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(MManga manga) async {
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
final url = "${manga.baseUrl}/directory/${manga.page}.htm";
|
|
||||||
|
|
||||||
final data = {"url": url, "headers": headers};
|
|
||||||
final response = await MBridge.http('POST', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
|
|
||||||
manga.names = MBridge.xpath(
|
|
||||||
res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@title');
|
|
||||||
manga.images = MBridge.xpath(res,
|
|
||||||
'//*[ 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
getChapterPages(MManga manga) async {
|
|
||||||
final headers = getHeader(manga.baseUrl);
|
|
||||||
final url = "${manga.baseUrl}${manga.link}";
|
|
||||||
final data = {"url": url, "headers": headers};
|
|
||||||
final response = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (response.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
String res = response.body;
|
|
||||||
final pages = MBridge.xpath(res, "//body/div/div/span/a/text()");
|
|
||||||
List<String> pageUrls = [];
|
|
||||||
if (pages.isEmpty) {
|
|
||||||
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 = deobfuscatedScript.substring(a, b).split("','");
|
|
||||||
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 = "".toString();
|
|
||||||
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 ress = await MBridge.http('GET', json.encode(data));
|
|
||||||
if (ress.hasError) {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
responseText = ress.body;
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
217
manga/src/en/mangahere/mangahere-v0.0.35.dart
Normal file
217
manga/src/en/mangahere/mangahere-v0.0.35.dart
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
import 'package:mangayomi/bridge_lib.dart';
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
class MangaHere extends MProvider {
|
||||||
|
MangaHere();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getPopular(MSource source, int page) async {
|
||||||
|
final headers = getHeader(source.baseUrl);
|
||||||
|
final url = "${source.baseUrl}/directory/$page.htm";
|
||||||
|
|
||||||
|
final data = {"url": url, "headers": headers};
|
||||||
|
final res = await http('POST', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> mangaList = [];
|
||||||
|
final names =
|
||||||
|
xpath(res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@title');
|
||||||
|
final images = xpath(res,
|
||||||
|
'//*[ contains(@class, "manga-list-1-list")]/li/a/img[@class="manga-list-1-cover"]/@src');
|
||||||
|
final urls =
|
||||||
|
xpath(res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@href');
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.name = names[i];
|
||||||
|
manga.imageUrl = images[i];
|
||||||
|
manga.link = urls[i];
|
||||||
|
mangaList.add(manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(mangaList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||||
|
final headers = getHeader(source.baseUrl);
|
||||||
|
final url = "${source.baseUrl}/directory/$page.htm?latest";
|
||||||
|
|
||||||
|
final data = {"url": url, "headers": headers};
|
||||||
|
final res = await http('POST', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> mangaList = [];
|
||||||
|
final names =
|
||||||
|
xpath(res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@title');
|
||||||
|
final images = xpath(res,
|
||||||
|
'//*[ contains(@class, "manga-list-1-list")]/li/a/img[@class="manga-list-1-cover"]/@src');
|
||||||
|
final urls =
|
||||||
|
xpath(res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@href');
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.name = names[i];
|
||||||
|
manga.imageUrl = images[i];
|
||||||
|
manga.link = urls[i];
|
||||||
|
mangaList.add(manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(mangaList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MPages> search(MSource source, String query, int page) async {
|
||||||
|
final headers = getHeader(source.baseUrl);
|
||||||
|
final url = "${source.baseUrl}/search?title=$query&page=$page";
|
||||||
|
|
||||||
|
final data = {"url": url, "headers": headers};
|
||||||
|
final res = await http('POST', json.encode(data));
|
||||||
|
|
||||||
|
List<MManga> mangaList = [];
|
||||||
|
final names =
|
||||||
|
xpath(res, '//*[contains(@class, "manga-list-4-list")]/li/a/@title');
|
||||||
|
final images = xpath(res,
|
||||||
|
'//*[contains(@class, "manga-list-4-list")]/li/a/img[@class="manga-list-4-cover"]/@src');
|
||||||
|
final urls =
|
||||||
|
xpath(res, '//*[contains(@class, "manga-list-4-list")]/li/a/@href');
|
||||||
|
|
||||||
|
for (var i = 0; i < names.length; i++) {
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.name = names[i];
|
||||||
|
manga.imageUrl = images[i];
|
||||||
|
manga.link = urls[i];
|
||||||
|
mangaList.add(manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPages(mangaList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<MManga> getDetail(MSource source, String url) async {
|
||||||
|
final statusList = [
|
||||||
|
{"Ongoing": 0, "Completed": 1}
|
||||||
|
];
|
||||||
|
final headers = getHeader(source.baseUrl);
|
||||||
|
final data = {"url": "${source.baseUrl}/$url", "headers": headers};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
MManga manga = MManga();
|
||||||
|
manga.author =
|
||||||
|
xpath(res, '//*[@class="detail-info-right-say"]/a/text()').first;
|
||||||
|
manga.description = xpath(res, '//*[@class="fullcontent"]/text()').first;
|
||||||
|
final status =
|
||||||
|
xpath(res, '//*[@class="detail-info-right-title-tip"]/text()').first;
|
||||||
|
manga.status = parseStatus(status, statusList);
|
||||||
|
manga.genre =
|
||||||
|
xpath(res, '//*[@class="detail-info-right-tag-list"]/a/text()');
|
||||||
|
|
||||||
|
var chapUrls = xpath(res, '//*[@class="detail-main-list"]/li/a/@href');
|
||||||
|
var chaptersNames = xpath(res,
|
||||||
|
'//*[@class="detail-main-list"]/li/a/div/p[@class="title3"]/text()');
|
||||||
|
final chapterDates = xpath(res,
|
||||||
|
'//*[@class="detail-main-list"]/li/a/div/p[@class="title2"]/text()');
|
||||||
|
var dateUploads =
|
||||||
|
parseDates(chapterDates, source.dateFormat, source.dateFormatLocale);
|
||||||
|
|
||||||
|
List<MChapter>? chaptersList = [];
|
||||||
|
for (var i = 0; i < chaptersNames.length; i++) {
|
||||||
|
MChapter chapter = MChapter();
|
||||||
|
chapter.name = chaptersNames[i];
|
||||||
|
chapter.url = chapUrls[i];
|
||||||
|
chapter.dateUpload = dateUploads[i];
|
||||||
|
chaptersList.add(chapter);
|
||||||
|
}
|
||||||
|
manga.chapters = chaptersList;
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<String>> getPageList(MSource source, String url) async {
|
||||||
|
final headers = getHeader(source.baseUrl);
|
||||||
|
final urll = "${source.baseUrl}$url";
|
||||||
|
final data = {"url": urll, "headers": headers};
|
||||||
|
final res = await http('GET', json.encode(data));
|
||||||
|
final pages = xpath(res, "//body/div/div/span/a/text()");
|
||||||
|
List<String> pageUrls = [];
|
||||||
|
if (pages.isEmpty) {
|
||||||
|
final script = xpath(
|
||||||
|
res, "//script[contains(text(),'function(p,a,c,k,e,d)')]/text()")
|
||||||
|
.first
|
||||||
|
.replaceAll("eval", "");
|
||||||
|
String deobfuscatedScript = evalJs(script);
|
||||||
|
int a = deobfuscatedScript.indexOf("newImgs=['") + 10;
|
||||||
|
int b = deobfuscatedScript.indexOf("'];");
|
||||||
|
List<String> urls = deobfuscatedScript.substring(a, b).split("','");
|
||||||
|
for (var url in urls) {
|
||||||
|
pageUrls.add("https:$url");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final pagesNumberList = pages;
|
||||||
|
int pagesNumber = int.parse(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 = 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 = urll.substring(0, urll.lastIndexOf("/"));
|
||||||
|
for (int i = 1; i <= pagesNumber; i++) {
|
||||||
|
String pageLink =
|
||||||
|
"$pageBase/chapterfun.ashx?cid=$chapterId&page=$i&key=$secretKey";
|
||||||
|
String responseText = "".toString();
|
||||||
|
for (int tr = 1; tr <= 3; tr++) {
|
||||||
|
if (responseText.isEmpty) {
|
||||||
|
final headers = {
|
||||||
|
"Referer": urll,
|
||||||
|
"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 ress = await http('GET', json.encode(data));
|
||||||
|
|
||||||
|
responseText = ress;
|
||||||
|
|
||||||
|
if (responseText.isEmpty) {
|
||||||
|
secretKey = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String deobfuscatedScript = 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
MangaHere main() {
|
||||||
|
return MangaHere();
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ import '../../../../model/source.dart';
|
|||||||
import '../../../../utils/utils.dart';
|
import '../../../../utils/utils.dart';
|
||||||
|
|
||||||
Source get mangahereSource => _mangahereSource;
|
Source get mangahereSource => _mangahereSource;
|
||||||
const mangahereVersion = "0.0.3";
|
const mangahereVersion = "0.0.35";
|
||||||
const mangahereSourceCodeUrl =
|
const mangahereSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/src/en/mangahere/mangahere-v$mangahereVersion.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/src/en/mangahere/mangahere-v$mangahereVersion.dart";
|
||||||
Source _mangahereSource = Source(
|
Source _mangahereSource = Source(
|
||||||
|
|||||||
Reference in New Issue
Block a user