mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-15 11:21:11 +00:00
WIP
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import 'package:mangayomi/bridge_lib.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
class HeanCms extends MSourceProvider {
|
||||
class HeanCms extends MProvider {
|
||||
HeanCms();
|
||||
|
||||
@override
|
||||
Future<MPages> getPopular(MSource sourceInfo, int page) async {
|
||||
final headers = getHeader(sourceInfo.baseUrl);
|
||||
Future<MPages> getPopular(MSource source, int page) async {
|
||||
final headers = getHeader(source.baseUrl);
|
||||
String res = "";
|
||||
if (!useNewQueryEndpoint(sourceInfo.name)) {
|
||||
final url = "${sourceInfo.apiUrl}/series/querysearch";
|
||||
if (!useNewQueryEndpoint(source.name)) {
|
||||
final url = "${source.apiUrl}/series/querysearch";
|
||||
|
||||
final body = {
|
||||
"page": page,
|
||||
@@ -19,23 +19,23 @@ class HeanCms extends MSourceProvider {
|
||||
"series_type": "Comic"
|
||||
};
|
||||
final data = {"url": url, "headers": headers, "body": body};
|
||||
res = await MBridge.http('POST', json.encode(data));
|
||||
res = await http('POST', json.encode(data));
|
||||
} else {
|
||||
final newEndpointUrl =
|
||||
"${sourceInfo.apiUrl}/query/?page=$page&query_string=&series_status=All&order=desc&orderBy=total_views&perPage=12&tags_ids=[]&series_type=Comic";
|
||||
"${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 MBridge.http('GET', json.encode(newEndpointData));
|
||||
res = await http('GET', json.encode(newEndpointData));
|
||||
}
|
||||
return mMangaRes(res, sourceInfo);
|
||||
return mMangaRes(res, source);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> getLatestUpdates(MSource sourceInfo, int page) async {
|
||||
final headers = getHeader(sourceInfo.baseUrl);
|
||||
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||
final headers = getHeader(source.baseUrl);
|
||||
String res = "";
|
||||
if (!useNewQueryEndpoint(sourceInfo.name)) {
|
||||
final url = "${sourceInfo.apiUrl}/series/querysearch";
|
||||
if (!useNewQueryEndpoint(source.name)) {
|
||||
final url = "${source.apiUrl}/series/querysearch";
|
||||
final body = {
|
||||
"page": page,
|
||||
"order": "desc",
|
||||
@@ -44,55 +44,54 @@ class HeanCms extends MSourceProvider {
|
||||
"series_type": "Comic"
|
||||
};
|
||||
final data = {"url": url, "headers": headers, "body": body};
|
||||
res = await MBridge.http('POST', json.encode(data));
|
||||
res = await http('POST', json.encode(data));
|
||||
} else {
|
||||
final newEndpointUrl =
|
||||
"${sourceInfo.apiUrl}/query/?page=$page&query_string=&series_status=All&order=desc&orderBy=latest&perPage=12&tags_ids=[]&series_type=Comic";
|
||||
"${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 MBridge.http('GET', json.encode(newEndpointData));
|
||||
res = await http('GET', json.encode(newEndpointData));
|
||||
}
|
||||
return mMangaRes(res, sourceInfo);
|
||||
return mMangaRes(res, source);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> search(MSource sourceInfo, String query, int page) async {
|
||||
final headers = getHeader(sourceInfo.baseUrl);
|
||||
Future<MPages> search(MSource source, String query, int page) async {
|
||||
final headers = getHeader(source.baseUrl);
|
||||
String res = "";
|
||||
if (!useNewQueryEndpoint(sourceInfo.source)) {
|
||||
final url = "${sourceInfo.apiUrl}/series/search";
|
||||
if (!useNewQueryEndpoint(source.source)) {
|
||||
final url = "${source.apiUrl}/series/search";
|
||||
final body = {"term": query};
|
||||
final data = {"url": url, "headers": headers, "body": body};
|
||||
res = await MBridge.http('POST', json.encode(data));
|
||||
res = await http('POST', json.encode(data));
|
||||
} else {
|
||||
final newEndpointUrl =
|
||||
"${sourceInfo.apiUrl}/query/?page=$page&query_string=$query&series_status=All&order=desc&orderBy=total_views&perPage=12&tags_ids=[]&series_type=Comic";
|
||||
"${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 MBridge.http('GET', json.encode(newEndpointData));
|
||||
res = await http('GET', json.encode(newEndpointData));
|
||||
}
|
||||
return mMangaRes(res, sourceInfo);
|
||||
return mMangaRes(res, source);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MManga> getDetail(MSource sourceInfo, String url) async {
|
||||
Future<MManga> getDetail(MSource source, String url) async {
|
||||
MManga manga = MManga();
|
||||
String currentSlug = MBridge.substringAfterLast(url, "/");
|
||||
final headers = getHeader(sourceInfo.baseUrl);
|
||||
String currentSlug = substringAfterLast(url, "/");
|
||||
final headers = getHeader(source.baseUrl);
|
||||
final data = {
|
||||
"url": "${sourceInfo.apiUrl}/series/$currentSlug",
|
||||
"url": "${source.apiUrl}/series/$currentSlug",
|
||||
"headers": headers
|
||||
};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
manga.author = MBridge.getMapValue(res, "author");
|
||||
manga.description = MBridge.getMapValue(res, "description");
|
||||
manga.genre =
|
||||
MBridge.jsonPathToString(res, r"$.tags[*].name", "._").split("._");
|
||||
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(sourceInfo.name)) {
|
||||
if (!useNewQueryEndpoint(source.name)) {
|
||||
for (var chapter in json.decode(res)["chapters"]) {
|
||||
final chapterName = chapter["chapter_name"];
|
||||
final chapterSlug = chapter["chapter_slug"];
|
||||
@@ -114,8 +113,7 @@ class HeanCms extends MSourceProvider {
|
||||
chapterDates.add(createdAt);
|
||||
}
|
||||
}
|
||||
final dateUploads =
|
||||
MBridge.parseDates(chapterDates, "dd MMMM yyyy", "fr");
|
||||
final dateUploads = parseDates(chapterDates, "dd MMMM yyyy", "fr");
|
||||
List<MChapter>? chaptersList = [];
|
||||
for (var i = 0; i < chapterTitles.length; i++) {
|
||||
MChapter chapter = MChapter();
|
||||
@@ -124,7 +122,7 @@ class HeanCms extends MSourceProvider {
|
||||
chapter.dateUpload = dateUploads[i];
|
||||
chaptersList.add(chapter);
|
||||
}
|
||||
if (!useNewQueryEndpoint(sourceInfo.name)) {
|
||||
if (!useNewQueryEndpoint(source.name)) {
|
||||
chaptersList = chaptersList.reversed.toList();
|
||||
}
|
||||
|
||||
@@ -133,48 +131,48 @@ class HeanCms extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<String>> getPageList(MSource sourceInfo, String url) async {
|
||||
final headers = getHeader(sourceInfo.baseUrl);
|
||||
Future<List<String>> getPageList(MSource source, String url) async {
|
||||
final headers = getHeader(source.baseUrl);
|
||||
|
||||
String res = "".toString();
|
||||
if (!useslugStrategy(sourceInfo.name)) {
|
||||
String chapterId = MBridge.substringAfter(url, '#');
|
||||
if (!useslugStrategy(source.name)) {
|
||||
String chapterId = substringAfter(url, '#');
|
||||
final data = {
|
||||
"url": "${sourceInfo.apiUrl}/series/chapter/$chapterId",
|
||||
"url": "${source.apiUrl}/series/chapter/$chapterId",
|
||||
"headers": headers
|
||||
};
|
||||
res = await MBridge.http('GET', json.encode(data));
|
||||
res = await http('GET', json.encode(data));
|
||||
} else {
|
||||
final data = {"url": "${sourceInfo.baseUrl}$url", "headers": headers};
|
||||
res = await MBridge.http('GET', json.encode(data));
|
||||
final data = {"url": "${source.baseUrl}$url", "headers": headers};
|
||||
res = await http('GET', json.encode(data));
|
||||
|
||||
List<String> pageUrls = [];
|
||||
var imagesRes = MBridge.querySelectorAll(res,
|
||||
var imagesRes = 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 = xpath(imagesRes.first, '//img/@src');
|
||||
|
||||
pageUrls.addAll(MBridge.xpath(imagesRes.first, '//img/@data-src'));
|
||||
pageUrls.addAll(xpath(imagesRes.first, '//img/@data-src'));
|
||||
|
||||
return pageUrls.where((e) => e.isNotEmpty).toList();
|
||||
}
|
||||
|
||||
final pages = MBridge.jsonPathToList(res, r"$.content.images[*]", 0);
|
||||
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("${sourceInfo.apiUrl}/$url");
|
||||
pageUrls.add("${source.apiUrl}/$url");
|
||||
}
|
||||
}
|
||||
return pageUrls;
|
||||
}
|
||||
|
||||
MPages mMangaRes(String res, MSource sourceInfo) {
|
||||
MPages mMangaRes(String res, MSource source) {
|
||||
bool hasNextPage = true;
|
||||
List<MManga> mangaList = [];
|
||||
List<String> names = [];
|
||||
@@ -186,7 +184,7 @@ class HeanCms extends MSourceProvider {
|
||||
if (thumbnail.startsWith("https://")) {
|
||||
images.add(thumbnail);
|
||||
} else {
|
||||
images.add("${sourceInfo.apiUrl}/cover/$thumbnail");
|
||||
images.add("${source.apiUrl}/cover/$thumbnail");
|
||||
}
|
||||
names.add(a["title"]);
|
||||
final seriesSlug = a["series_slug"];
|
||||
@@ -198,7 +196,7 @@ class HeanCms extends MSourceProvider {
|
||||
if (thumbnail.startsWith("https://")) {
|
||||
images.add(thumbnail);
|
||||
} else {
|
||||
images.add("${sourceInfo.apiUrl}/cover/$thumbnail");
|
||||
images.add("${source.apiUrl}/cover/$thumbnail");
|
||||
}
|
||||
names.add(a["title"]);
|
||||
final seriesSlug = a["series_slug"];
|
||||
@@ -217,16 +215,6 @@ class HeanCms extends MSourceProvider {
|
||||
return MPages(mangaList, hasNextPage);
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -238,11 +226,21 @@ class HeanCms extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<MVideo>> getVideoList(MSource sourceInfo, String url) async {
|
||||
Future<List<MVideo>> getVideoList(MSource source, String url) async {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
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,26 +1,26 @@
|
||||
import 'package:mangayomi/bridge_lib.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
class Madara extends MSourceProvider {
|
||||
class Madara extends MProvider {
|
||||
Madara();
|
||||
|
||||
@override
|
||||
Future<MPages> getPopular(MSource sourceInfo, int page) async {
|
||||
final url = "${sourceInfo.baseUrl}/manga/page/$page/?m_orderby=views";
|
||||
final data = {"url": url, "sourceId": sourceInfo.id};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
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 = MBridge.xpath(res, '//*[@class^="post-title"]/h3/a/@href');
|
||||
final names = MBridge.xpath(res, '//*[@id^="manga-item"]/a/@title');
|
||||
var images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-src');
|
||||
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 =
|
||||
MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-lazy-src');
|
||||
xpath(res, '//*[@id^="manga-item"]/a/img/@data-lazy-src');
|
||||
if (images.isEmpty) {
|
||||
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@srcset');
|
||||
images = xpath(res, '//*[@id^="manga-item"]/a/img/@srcset');
|
||||
if (images.isEmpty) {
|
||||
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@src');
|
||||
images = xpath(res, '//*[@id^="manga-item"]/a/img/@src');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,22 +37,22 @@ class Madara extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> getLatestUpdates(MSource sourceInfo, int page) async {
|
||||
final url = "${sourceInfo.baseUrl}/manga/page/$page/?m_orderby=latest";
|
||||
final data = {"url": url, "sourceId": sourceInfo.id};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
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 = MBridge.xpath(res, '//*[@class^="post-title"]/h3/a/@href');
|
||||
final names = MBridge.xpath(res, '//*[@id^="manga-item"]/a/@title');
|
||||
var images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-src');
|
||||
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 =
|
||||
MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@data-lazy-src');
|
||||
xpath(res, '//*[@id^="manga-item"]/a/img/@data-lazy-src');
|
||||
if (images.isEmpty) {
|
||||
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@srcset');
|
||||
images = xpath(res, '//*[@id^="manga-item"]/a/img/@srcset');
|
||||
if (images.isEmpty) {
|
||||
images = MBridge.xpath(res, '//*[@id^="manga-item"]/a/img/@src');
|
||||
images = xpath(res, '//*[@id^="manga-item"]/a/img/@src');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,28 +69,28 @@ class Madara extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> search(MSource sourceInfo, String query, int page) async {
|
||||
Future<MPages> search(MSource source, String query, int page) async {
|
||||
final data = {
|
||||
"url": "${sourceInfo.baseUrl}/?s=$query&post_type=wp-manga",
|
||||
"sourceId": sourceInfo.id
|
||||
"url": "${source.baseUrl}/?s=$query&post_type=wp-manga",
|
||||
"sourceId": source.id
|
||||
};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
final res = await http('GET', json.encode(data));
|
||||
|
||||
List<MManga> mangaList = [];
|
||||
final urls =
|
||||
MBridge.xpath(res, '//*[@class^="tab-thumb c-image-hover"]/a/@href');
|
||||
xpath(res, '//*[@class^="tab-thumb c-image-hover"]/a/@href');
|
||||
final names =
|
||||
MBridge.xpath(res, '//*[@class^="tab-thumb c-image-hover"]/a/@title');
|
||||
var images = MBridge.xpath(
|
||||
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 = MBridge.xpath(
|
||||
images = xpath(
|
||||
res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@data-lazy-src');
|
||||
if (images.isEmpty) {
|
||||
images = MBridge.xpath(
|
||||
images = xpath(
|
||||
res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@srcset');
|
||||
if (images.isEmpty) {
|
||||
images = MBridge.xpath(
|
||||
images = xpath(
|
||||
res, '//*[@class^="tab-thumb c-image-hover"]/a/img/@src');
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ class Madara extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MManga> getDetail(MSource sourceInfo, String url) async {
|
||||
Future<MManga> getDetail(MSource source, String url) async {
|
||||
final statusList = [
|
||||
{
|
||||
"OnGoing": 0,
|
||||
@@ -155,36 +155,36 @@ class Madara extends MSourceProvider {
|
||||
];
|
||||
MManga manga = MManga();
|
||||
String res = "";
|
||||
final datas = {"url": url, "sourceId": sourceInfo.id};
|
||||
res = await MBridge.http('GET', json.encode(datas));
|
||||
final datas = {"url": url, "sourceId": source.id};
|
||||
res = await http('GET', json.encode(datas));
|
||||
|
||||
manga.author = MBridge.querySelectorAll(res,
|
||||
manga.author = querySelectorAll(res,
|
||||
selector: "div.author-content > a",
|
||||
typeElement: 0,
|
||||
attributes: "",
|
||||
typeRegExp: 0)
|
||||
.first;
|
||||
manga.description = MBridge.querySelectorAll(res,
|
||||
manga.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)
|
||||
.first;
|
||||
manga.imageUrl = MBridge.querySelectorAll(res,
|
||||
manga.imageUrl = querySelectorAll(res,
|
||||
selector: "div.summary_image img",
|
||||
typeElement: 2,
|
||||
attributes: "",
|
||||
typeRegExp: 2)
|
||||
.first;
|
||||
final mangaId = MBridge.querySelectorAll(res,
|
||||
final mangaId = querySelectorAll(res,
|
||||
selector: "div[id^=manga-chapters-holder]",
|
||||
typeElement: 3,
|
||||
attributes: "data-id",
|
||||
typeRegExp: 0)
|
||||
.first;
|
||||
manga.status = MBridge.parseStatus(
|
||||
MBridge.querySelectorAll(res,
|
||||
manga.status = parseStatus(
|
||||
querySelectorAll(res,
|
||||
selector: "div.summary-content",
|
||||
typeElement: 0,
|
||||
attributes: "",
|
||||
@@ -192,13 +192,13 @@ class Madara extends MSourceProvider {
|
||||
.last,
|
||||
statusList);
|
||||
|
||||
manga.genre = MBridge.querySelectorAll(res,
|
||||
manga.genre = querySelectorAll(res,
|
||||
selector: "div.genres-content a",
|
||||
typeElement: 0,
|
||||
attributes: "",
|
||||
typeRegExp: 0);
|
||||
|
||||
final baseUrl = "${sourceInfo.baseUrl}/";
|
||||
final baseUrl = "${source.baseUrl}/";
|
||||
final headers = {
|
||||
"Referer": baseUrl,
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
@@ -206,33 +206,33 @@ class Madara extends MSourceProvider {
|
||||
};
|
||||
final urll =
|
||||
"${baseUrl}wp-admin/admin-ajax.php?action=manga_get_chapters&manga=$mangaId";
|
||||
final datasP = {"url": urll, "headers": headers, "sourceId": sourceInfo.id};
|
||||
res = await MBridge.http('POST', json.encode(datasP));
|
||||
final datasP = {"url": urll, "headers": headers, "sourceId": source.id};
|
||||
res = await http('POST', json.encode(datasP));
|
||||
if (res == "400") {
|
||||
final urlP = "${url}ajax/chapters";
|
||||
final datasP = {
|
||||
"url": urlP,
|
||||
"headers": headers,
|
||||
"sourceId": sourceInfo.id
|
||||
"sourceId": source.id
|
||||
};
|
||||
res = await MBridge.http('POST', json.encode(datasP));
|
||||
res = await http('POST', json.encode(datasP));
|
||||
}
|
||||
|
||||
var chapUrls = MBridge.xpath(res, "//li/a/@href");
|
||||
var chaptersNames = MBridge.xpath(res, "//li/a/text()");
|
||||
var dateF = MBridge.xpath(res, "//li/span/i/text()");
|
||||
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 MBridge.getHtmlViaWebview(
|
||||
final resWebview = await getHtmlViaWebview(
|
||||
url, "//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/@href");
|
||||
chapUrls = MBridge.xpath(resWebview,
|
||||
chapUrls = xpath(resWebview,
|
||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/@href");
|
||||
chaptersNames = MBridge.xpath(resWebview,
|
||||
chaptersNames = xpath(resWebview,
|
||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/text()");
|
||||
dateF = MBridge.xpath(resWebview,
|
||||
dateF = xpath(resWebview,
|
||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/span/i/text()");
|
||||
}
|
||||
var dateUploads = MBridge.parseDates(
|
||||
dateF, sourceInfo.dateFormat, sourceInfo.dateFormatLocale);
|
||||
var dateUploads = parseDates(
|
||||
dateF, source.dateFormat, source.dateFormatLocale);
|
||||
if (dateF.length < chaptersNames.length) {
|
||||
final length = chaptersNames.length - dateF.length;
|
||||
String date = "${DateTime.now().millisecondsSinceEpoch}";
|
||||
@@ -240,8 +240,8 @@ class Madara extends MSourceProvider {
|
||||
date += "--..${DateTime.now().millisecondsSinceEpoch}";
|
||||
}
|
||||
|
||||
final dateFF = MBridge.parseDates(
|
||||
dateF, sourceInfo.dateFormat, sourceInfo.dateFormatLocale);
|
||||
final dateFF = parseDates(
|
||||
dateF, source.dateFormat, source.dateFormatLocale);
|
||||
List<String> chapterDate = date.split('--..');
|
||||
|
||||
for (var date in dateFF) {
|
||||
@@ -263,36 +263,36 @@ class Madara extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<String>> getPageList(MSource sourceInfo, String url) async {
|
||||
final datas = {"url": url, "sourceId": sourceInfo.id};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
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 = MBridge.querySelectorAll(res,
|
||||
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 = MBridge.querySelectorAll(pagesSelectorRes,
|
||||
final imgs = querySelectorAll(pagesSelectorRes,
|
||||
selector: "img", typeElement: 2, attributes: "", typeRegExp: 2);
|
||||
var pageUrls = [];
|
||||
|
||||
if (imgs.length == 1) {
|
||||
final pages = MBridge.querySelectorAll(res,
|
||||
final pages = querySelectorAll(res,
|
||||
selector: "#single-pager",
|
||||
typeElement: 2,
|
||||
attributes: "",
|
||||
typeRegExp: 0)
|
||||
.first;
|
||||
|
||||
final pagesNumber = MBridge.querySelectorAll(pages,
|
||||
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(MBridge.querySelectorAll(pagesSelectorRes,
|
||||
pageUrls.add(querySelectorAll(pagesSelectorRes,
|
||||
selector: "img",
|
||||
typeElement: 2,
|
||||
attributes: "",
|
||||
@@ -300,7 +300,7 @@ class Madara extends MSourceProvider {
|
||||
.first
|
||||
.replaceAll("01", '0$val'));
|
||||
} else {
|
||||
pageUrls.add(MBridge.querySelectorAll(pagesSelectorRes,
|
||||
pageUrls.add(querySelectorAll(pagesSelectorRes,
|
||||
selector: "img",
|
||||
typeElement: 2,
|
||||
attributes: "",
|
||||
@@ -316,7 +316,7 @@ class Madara extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<MVideo>> getVideoList(MSource sourceInfo, String url) async {
|
||||
Future<List<MVideo>> getVideoList(MSource source, String url) async {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
import 'package:mangayomi/bridge_lib.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
class MangaReader extends MSourceProvider {
|
||||
class MangaReader extends MProvider {
|
||||
MangaReader();
|
||||
|
||||
@override
|
||||
Future<MPages> getPopular(MSource sourceInfo, int page) async {
|
||||
Future<MPages> getPopular(MSource source, int page) async {
|
||||
final url =
|
||||
"${sourceInfo.baseUrl}${getMangaUrlDirectory(sourceInfo.name)}/?page=$page&order=popular";
|
||||
final data = {"url": url, "sourceId": sourceInfo.id};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
"${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 sourceInfo, int page) async {
|
||||
Future<MPages> getLatestUpdates(MSource source, int page) async {
|
||||
final url =
|
||||
"${sourceInfo.baseUrl}${getMangaUrlDirectory(sourceInfo.name)}/?page=$page&order=update";
|
||||
final data = {"url": url, "sourceId": sourceInfo.id};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
"${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 sourceInfo, String query, int page) async {
|
||||
Future<MPages> search(MSource source, String query, int page) async {
|
||||
final url =
|
||||
"${sourceInfo.baseUrl}${getMangaUrlDirectory(sourceInfo.name)}/?&title=$query&page=$page";
|
||||
final data = {"url": url, "sourceId": sourceInfo.id};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
"${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 sourceInfo, String url) async {
|
||||
Future<MManga> getDetail(MSource source, String url) async {
|
||||
final statusList = [
|
||||
{
|
||||
"مستمرة": 0,
|
||||
@@ -89,10 +89,10 @@ class MangaReader extends MSourceProvider {
|
||||
];
|
||||
|
||||
MManga manga = MManga();
|
||||
final datas = {"url": url, "sourceId": sourceInfo.id};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
final datas = {"url": url, "sourceId": source.id};
|
||||
final res = await http('GET', json.encode(datas));
|
||||
|
||||
manga.author = MBridge.xpath(
|
||||
manga.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()',
|
||||
'')
|
||||
@@ -102,14 +102,14 @@ class MangaReader extends MSourceProvider {
|
||||
.replaceAll("Auteur", "")
|
||||
.replaceAll("[Add, ]", "");
|
||||
|
||||
manga.description = MBridge.querySelectorAll(res,
|
||||
manga.description = querySelectorAll(res,
|
||||
selector: ".desc, .entry-content[itemprop=description]",
|
||||
typeElement: 0,
|
||||
attributes: "",
|
||||
typeRegExp: 0)
|
||||
.first;
|
||||
|
||||
final status = MBridge.xpath(
|
||||
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()',
|
||||
'')
|
||||
@@ -118,20 +118,20 @@ class MangaReader extends MSourceProvider {
|
||||
.replaceAll("Estado", "")
|
||||
.replaceAll("Statut", "");
|
||||
|
||||
manga.status = MBridge.parseStatus(status, statusList);
|
||||
manga.status = parseStatus(status, statusList);
|
||||
|
||||
manga.genre = MBridge.xpath(res,
|
||||
manga.genre = xpath(res,
|
||||
'//*[@class="gnr" or @class="mgen" or @class="seriestugenre" ]/a/text()');
|
||||
|
||||
var chapUrls = MBridge.xpath(res,
|
||||
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 = MBridge.xpath(res,
|
||||
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 = MBridge.xpath(res,
|
||||
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 = MBridge.parseDates(
|
||||
chapterDates, sourceInfo.dateFormat, sourceInfo.dateFormatLocale);
|
||||
var dateUploads = parseDates(
|
||||
chapterDates, source.dateFormat, source.dateFormatLocale);
|
||||
|
||||
List<MChapter>? chaptersList = [];
|
||||
for (var i = 0; i < chaptersNames.length; i++) {
|
||||
@@ -146,20 +146,20 @@ class MangaReader extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<String>> getPageList(MSource sourceInfo, String url) async {
|
||||
final datas = {"url": url, "sourceId": sourceInfo.id};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
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 = MBridge.xpath(res, '//*[@id="readerarea"]/p/img/@src');
|
||||
pages = xpath(res, '//*[@id="readerarea"]/p/img/@src');
|
||||
if (pages.isEmpty || pages.length == 1) {
|
||||
pages = MBridge.xpath(res, '//*[@id="readerarea"]/img/@src');
|
||||
pages = 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);
|
||||
regExp(res, "\"images\"\\s*:\\s*(\\[.*?])", "", 1, 1);
|
||||
final pages = json.decode(images) as List;
|
||||
for (var page in pages) {
|
||||
pagesUrl.add(page);
|
||||
}
|
||||
@@ -173,10 +173,10 @@ class MangaReader extends MSourceProvider {
|
||||
MPages mangaRes(String res) {
|
||||
List<MManga> mangaList = [];
|
||||
final urls =
|
||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href');
|
||||
xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href');
|
||||
final names =
|
||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title');
|
||||
final images = MBridge.xpath(
|
||||
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++) {
|
||||
@@ -198,7 +198,7 @@ class MangaReader extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<MVideo>> getVideoList(MSource sourceInfo, String url) async {
|
||||
Future<List<MVideo>> getVideoList(MSource source, String url) async {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
import 'package:mangayomi/bridge_lib.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
class MMCRCms extends MSourceProvider {
|
||||
class MMCRCms extends MProvider {
|
||||
MMCRCms();
|
||||
|
||||
@override
|
||||
Future<MPages> getPopular(MSource sourceInfo, int page) async {
|
||||
Future<MPages> getPopular(MSource source, int page) async {
|
||||
final url =
|
||||
"${sourceInfo.baseUrl}/filterList?page=$page&sortBy=views&asc=false";
|
||||
final data = {"url": url, "sourceId": sourceInfo.id};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
"${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 = MBridge.xpath(res, '//*[ @class="chart-title"]/@href');
|
||||
final names = MBridge.xpath(res, '//*[ @class="chart-title"]/text()');
|
||||
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 = MBridge.substringAfterLast(url, '/');
|
||||
if (sourceInfo.name == "Manga-FR") {
|
||||
images.add("${sourceInfo.baseUrl}/uploads/manga/${slug}.jpg");
|
||||
String slug = substringAfterLast(url, '/');
|
||||
if (source.name == "Manga-FR") {
|
||||
images.add("${source.baseUrl}/uploads/manga/${slug}.jpg");
|
||||
} else {
|
||||
images.add(
|
||||
"${sourceInfo.baseUrl}/uploads/manga/${slug}/cover/cover_250x350.jpg");
|
||||
"${source.baseUrl}/uploads/manga/${slug}/cover/cover_250x350.jpg");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,22 +37,22 @@ class MMCRCms extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> getLatestUpdates(MSource sourceInfo, int page) async {
|
||||
final url = "${sourceInfo.baseUrl}/latest-release?page=$page";
|
||||
final data = {"url": url, "sourceId": sourceInfo.id};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
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 = MBridge.xpath(res, '//*[@class="manga-item"]/h3/a/@href');
|
||||
final names = MBridge.xpath(res, '//*[@class="manga-item"]/h3/a/text()');
|
||||
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 = MBridge.substringAfterLast(url, '/');
|
||||
if (sourceInfo.name == "Manga-FR") {
|
||||
images.add("${sourceInfo.baseUrl}/uploads/manga/${slug}.jpg");
|
||||
String slug = substringAfterLast(url, '/');
|
||||
if (source.name == "Manga-FR") {
|
||||
images.add("${source.baseUrl}/uploads/manga/${slug}.jpg");
|
||||
} else {
|
||||
images.add(
|
||||
"${sourceInfo.baseUrl}/uploads/manga/${slug}/cover/cover_250x350.jpg");
|
||||
"${source.baseUrl}/uploads/manga/${slug}/cover/cover_250x350.jpg");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,10 +68,10 @@ class MMCRCms extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> search(MSource sourceInfo, String query, int page) async {
|
||||
final url = "${sourceInfo.baseUrl}/search?query=$query";
|
||||
final data = {"url": url, "sourceId": sourceInfo.id};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
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"];
|
||||
@@ -81,19 +81,19 @@ class MMCRCms extends MSourceProvider {
|
||||
for (var da in jsonList) {
|
||||
String value = da["value"];
|
||||
String data = da["data"];
|
||||
if (sourceInfo.name == 'Scan VF') {
|
||||
urls.add('${sourceInfo.baseUrl}/$data');
|
||||
} else if (sourceInfo.name == 'Manga-FR') {
|
||||
urls.add('${sourceInfo.baseUrl}/lecture-en-ligne/$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('${sourceInfo.baseUrl}/manga/$data');
|
||||
urls.add('${source.baseUrl}/manga/$data');
|
||||
}
|
||||
names.add(value);
|
||||
if (sourceInfo.name == "Manga-FR") {
|
||||
images.add("${sourceInfo.baseUrl}/uploads/manga/$data.jpg");
|
||||
if (source.name == "Manga-FR") {
|
||||
images.add("${source.baseUrl}/uploads/manga/$data.jpg");
|
||||
} else {
|
||||
images.add(
|
||||
"${sourceInfo.baseUrl}/uploads/manga/$data/cover/cover_250x350.jpg");
|
||||
"${source.baseUrl}/uploads/manga/$data/cover/cover_250x350.jpg");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ class MMCRCms extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MManga> getDetail(MSource sourceInfo, String url) async {
|
||||
Future<MManga> getDetail(MSource source, String url) async {
|
||||
final statusList = [
|
||||
{
|
||||
"complete": 1,
|
||||
@@ -128,23 +128,23 @@ class MMCRCms extends MSourceProvider {
|
||||
}
|
||||
];
|
||||
MManga manga = MManga();
|
||||
final datas = {"url": url, "sourceId": sourceInfo.id};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
final datas = {"url": url, "sourceId": source.id};
|
||||
final res = await http('GET', json.encode(datas));
|
||||
|
||||
manga.author = MBridge.xpath(res,
|
||||
manga.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()')
|
||||
.first;
|
||||
final status = MBridge.xpath(res,
|
||||
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()')
|
||||
.first;
|
||||
manga.status = MBridge.parseStatus(status, statusList);
|
||||
manga.status = parseStatus(status, statusList);
|
||||
manga.description =
|
||||
MBridge.xpath(res, '//*[@class="well" or @class="manga well"]/p/text()')
|
||||
xpath(res, '//*[@class="well" or @class="manga well"]/p/text()')
|
||||
.first;
|
||||
manga.genre = MBridge.xpath(res,
|
||||
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()');
|
||||
|
||||
final baseUrl = "${sourceInfo.baseUrl}/";
|
||||
final baseUrl = "${source.baseUrl}/";
|
||||
final headers = {
|
||||
"Referer": baseUrl,
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
@@ -152,14 +152,14 @@ class MMCRCms extends MSourceProvider {
|
||||
};
|
||||
|
||||
var chapUrls =
|
||||
MBridge.xpath(res, '//*[@class="chapter-title-rtl"]/a/@href');
|
||||
xpath(res, '//*[@class="chapter-title-rtl"]/a/@href');
|
||||
var chaptersNames =
|
||||
MBridge.xpath(res, '//*[@class="chapter-title-rtl"]/a/text()');
|
||||
xpath(res, '//*[@class="chapter-title-rtl"]/a/text()');
|
||||
var chaptersDates =
|
||||
MBridge.xpath(res, '//*[@class="date-chapter-title-rtl"]/text()');
|
||||
xpath(res, '//*[@class="date-chapter-title-rtl"]/text()');
|
||||
|
||||
var dateUploads = MBridge.parseDates(
|
||||
chaptersDates, sourceInfo.dateFormat, sourceInfo.dateFormatLocale);
|
||||
var dateUploads = parseDates(
|
||||
chaptersDates, source.dateFormat, source.dateFormatLocale);
|
||||
|
||||
List<MChapter>? chaptersList = [];
|
||||
for (var i = 0; i < chaptersNames.length; i++) {
|
||||
@@ -174,12 +174,12 @@ class MMCRCms extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<String>> getPageList(MSource sourceInfo, String url) async {
|
||||
final datas = {"url": url, "sourceId": sourceInfo.id};
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
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 = MBridge.xpath(
|
||||
final pages = xpath(
|
||||
res, '//*[@id="all"]/img[@class="img-responsive"]/@data-src');
|
||||
for (var page in pages) {
|
||||
if (page.startsWith('//')) {
|
||||
@@ -193,7 +193,7 @@ class MMCRCms extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<MVideo>> getVideoList(MSource sourceInfo, String url) async {
|
||||
Future<List<MVideo>> getVideoList(MSource source, String url) async {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
import 'package:mangayomi/bridge_lib.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
class NepNep extends MSourceProvider {
|
||||
class NepNep extends MProvider {
|
||||
NepNep();
|
||||
|
||||
@override
|
||||
Future<MPages> getPopular(MSource sourceInfo, int page) async {
|
||||
final data = {"url": "${sourceInfo.baseUrl}/search/"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
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 = MBridge.sortMapList(json.decode(directory), "vm", 1);
|
||||
final resSort = sortMapList(json.decode(directory), "vm", 1);
|
||||
|
||||
return parseDirectory(resSort);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> getLatestUpdates(MSource sourceInfo, int page) async {
|
||||
final data = {"url": "${sourceInfo.baseUrl}/search/"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
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 = MBridge.sortMapList(json.decode(directory), "lt", 1);
|
||||
final resSort = sortMapList(json.decode(directory), "lt", 1);
|
||||
|
||||
return parseDirectory(resSort);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> search(MSource sourceInfo, String query, int page) async {
|
||||
final data = {"url": "${sourceInfo.baseUrl}/search/"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
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 = MBridge.sortMapList(json.decode(directory), "lt", 1);
|
||||
final resSort = sortMapList(json.decode(directory), "lt", 1);
|
||||
final datas = json.decode(resSort) as List;
|
||||
final queryRes = datas.where((e) {
|
||||
String name = e['s'];
|
||||
@@ -43,40 +43,36 @@ class NepNep extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MManga> getDetail(MSource sourceInfo, String url) async {
|
||||
Future<MManga> getDetail(MSource source, String url) async {
|
||||
final statusList = [
|
||||
{"Ongoing": 0, "Completed": 1, "Cancelled": 3, "Hiatus": 2}
|
||||
];
|
||||
final headers = getHeader(sourceInfo.baseUrl);
|
||||
final data = {
|
||||
"url": '${sourceInfo.baseUrl}/manga/$url',
|
||||
"headers": headers
|
||||
};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
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 = MBridge.xpath(res,
|
||||
manga.author = xpath(res,
|
||||
'//li[contains(@class,"list-group-item") and contains(text(),"Author")]/a/text()')
|
||||
.first;
|
||||
manga.description = MBridge.xpath(res,
|
||||
manga.description = xpath(res,
|
||||
'//li[contains(@class,"list-group-item") and contains(text(),"Description:")]/div/text()')
|
||||
.first;
|
||||
final status = MBridge.xpath(res,
|
||||
final status = 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,
|
||||
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 =
|
||||
MBridge.xpath(res, '//script[contains(text(), "MainFunction")]/text()')
|
||||
.first;
|
||||
final vmChapters = MBridge.substringBefore(
|
||||
MBridge.substringAfter(script, "vm.Chapters = "), ";");
|
||||
xpath(res, '//script[contains(text(), "MainFunction")]/text()').first;
|
||||
final vmChapters =
|
||||
substringBefore(substringAfter(script, "vm.Chapters = "), ";");
|
||||
final chapters = json.decode(vmChapters) as List;
|
||||
var chapUrls = chapters
|
||||
.map((ch) =>
|
||||
'/read-online/${MBridge.substringAfter(url, "/manga/")}${chapterURLEncode(ch['Chapter'])}')
|
||||
'/read-online/${substringAfter(url, "/manga/")}${chapterURLEncode(ch['Chapter'])}')
|
||||
.toList();
|
||||
|
||||
var chaptersNames = chapters.map((ch) {
|
||||
@@ -88,8 +84,8 @@ class NepNep extends MSourceProvider {
|
||||
return name;
|
||||
}).toList();
|
||||
var chaptersDates = chapters.map((ch) => ch['Date']).toList();
|
||||
var dateUploads = MBridge.parseDates(
|
||||
chaptersDates, sourceInfo.dateFormat, sourceInfo.dateFormatLocale);
|
||||
var dateUploads =
|
||||
parseDates(chaptersDates, source.dateFormat, source.dateFormatLocale);
|
||||
List<MChapter> chaptersList = [];
|
||||
|
||||
for (var ch in chapters) {
|
||||
@@ -101,10 +97,10 @@ class NepNep extends MSourceProvider {
|
||||
}
|
||||
chapter.name = name;
|
||||
chapter.url =
|
||||
'/read-online/${MBridge.substringAfter(url, "/manga/")}${chapterURLEncode(ch['Chapter'])}';
|
||||
chapter.dateUpload = MBridge.parseDates(
|
||||
[ch['Date']], sourceInfo.dateFormat, sourceInfo.dateFormatLocale)
|
||||
.first;
|
||||
'/read-online/${substringAfter(url, "/manga/")}${chapterURLEncode(ch['Chapter'])}';
|
||||
chapter.dateUpload =
|
||||
parseDates([ch['Date']], source.dateFormat, source.dateFormatLocale)
|
||||
.first;
|
||||
chaptersList.add(chapter);
|
||||
}
|
||||
manga.chapters = chaptersList;
|
||||
@@ -112,25 +108,24 @@ class NepNep extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<String>> getPageList(MSource sourceInfo, String url) async {
|
||||
final headers = getHeader(sourceInfo.baseUrl);
|
||||
Future<List<String>> getPageList(MSource source, String url) async {
|
||||
final headers = getHeader(source.baseUrl);
|
||||
List<String> pages = [];
|
||||
final data = {"url": '${sourceInfo.baseUrl}$url', "headers": headers};
|
||||
final data = {"url": '${source.baseUrl}$url', "headers": headers};
|
||||
print(data);
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
final res = await http('GET', json.encode(data));
|
||||
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 = \"", ""), "\"");
|
||||
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 = MBridge.substringBefore(
|
||||
MBridge.substringAfter(url, "/read-online/"), "-chapter");
|
||||
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++) {
|
||||
@@ -145,10 +140,9 @@ class NepNep extends MSourceProvider {
|
||||
|
||||
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")
|
||||
xpath(res, '//script[contains(text(), "MainFunction")]/text()').first;
|
||||
return substringBefore(
|
||||
substringAfter(script, "vm.Directory = "), "vm.GetIntValue")
|
||||
.replaceAll(";", " ");
|
||||
}
|
||||
|
||||
@@ -165,19 +159,10 @@ class NepNep extends MSourceProvider {
|
||||
return MPages(mangaList, true);
|
||||
}
|
||||
|
||||
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 chapterImage(String e, bool cleanString) {
|
||||
var a = e.substring(1, e.length - 1);
|
||||
if (cleanString) {
|
||||
a = MBridge.regExp(a, r'^0+', "", 0, 0);
|
||||
a = regExp(a, r'^0+', "", 0, 0);
|
||||
}
|
||||
|
||||
var b = int.parse(e.substring(e.length - 1));
|
||||
@@ -236,11 +221,20 @@ class NepNep extends MSourceProvider {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<MVideo>> getVideoList(MSource sourceInfo, String url) async {
|
||||
Future<List<MVideo>> getVideoList(MSource source, String url) async {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user