mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 02:41:39 +00:00
-
This commit is contained in:
@@ -1,203 +1,203 @@
|
||||
// import 'dart:convert';
|
||||
// import 'package:bridge_lib/bridge_lib.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
// searchManga(MangaModel manga) async {
|
||||
// final headers = getHeader(manga.baseUrl);
|
||||
// final url = "${manga.apiUrl}/series/search";
|
||||
// final body = {"term": manga.query};
|
||||
// final data = {"url": url, "headers": headers, "body": body};
|
||||
// final res = await MBridge.http(json.encode(data), 1);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// List<String> jsonList = [];
|
||||
// List<String> names = [];
|
||||
// List<String> urls = [];
|
||||
// List<String> images = [];
|
||||
// if (res.startsWith("{")) {
|
||||
// jsonList = MBridge.jsonPathToList(res, r'$.data[*]');
|
||||
// } else {
|
||||
// jsonList = MBridge.jsonDecodeToList(res);
|
||||
// }
|
||||
// for (var a in jsonList) {
|
||||
// final thumbnail = MBridge.getMapValue(a, "thumbnail", 0);
|
||||
// if (thumbnail.startsWith("https://")) {
|
||||
// images.add(thumbnail);
|
||||
// } else {
|
||||
// images.add("${manga.apiUrl}/cover/$thumbnail");
|
||||
// }
|
||||
// names.add(MBridge.getMapValue(a, "title", 0));
|
||||
// final seriesSlug = MBridge.regExp(
|
||||
// MBridge.getMapValue(a, "series_slug", 0), "-\\d+", "", 0, 0);
|
||||
// urls.add("/series/$seriesSlug");
|
||||
// }
|
||||
// manga.urls = urls;
|
||||
// manga.images = images;
|
||||
// manga.names = names;
|
||||
// return manga;
|
||||
// }
|
||||
searchManga(MangaModel manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
final url = "${manga.apiUrl}/series/search";
|
||||
final body = {"term": manga.query};
|
||||
final data = {"url": url, "headers": headers, "body": body};
|
||||
final res = await MBridge.http(json.encode(data), 1);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
List<String> jsonList = [];
|
||||
List<String> names = [];
|
||||
List<String> urls = [];
|
||||
List<String> images = [];
|
||||
if (res.startsWith("{")) {
|
||||
jsonList = MBridge.jsonPathToList(res, r'$.data[*]');
|
||||
} else {
|
||||
jsonList = MBridge.jsonDecodeToList(res);
|
||||
}
|
||||
for (var a in jsonList) {
|
||||
final thumbnail = MBridge.getMapValue(a, "thumbnail", 0);
|
||||
if (thumbnail.startsWith("https://")) {
|
||||
images.add(thumbnail);
|
||||
} else {
|
||||
images.add("${manga.apiUrl}/cover/$thumbnail");
|
||||
}
|
||||
names.add(MBridge.getMapValue(a, "title", 0));
|
||||
final seriesSlug = MBridge.regExp(
|
||||
MBridge.getMapValue(a, "series_slug", 0), "-\\d+", "", 0, 0);
|
||||
urls.add("/series/$seriesSlug");
|
||||
}
|
||||
manga.urls = urls;
|
||||
manga.images = images;
|
||||
manga.names = names;
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getPopularManga(MangaModel manga) async {
|
||||
// final headers = getHeader(manga.baseUrl);
|
||||
// final url = "${manga.apiUrl}/series/querysearch";
|
||||
// final body = {
|
||||
// "page": manga.page,
|
||||
// "order": "desc",
|
||||
// "order_by": "total_views",
|
||||
// "series_status": "Ongoing",
|
||||
// "series_type": "Comic"
|
||||
// };
|
||||
// final data = {
|
||||
// "url": url,
|
||||
// "headers": headers,
|
||||
// "sourceId": manga.sourceId,
|
||||
// "body": body
|
||||
// };
|
||||
// final res = await MBridge.http(json.encode(data), 1);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// List<String> jsonList = [];
|
||||
// List<String> names = [];
|
||||
// List<String> urls = [];
|
||||
// List<String> images = [];
|
||||
// if (res.startsWith("{")) {
|
||||
// jsonList = MBridge.jsonPathToList(res, r'$.data[*]');
|
||||
// } else {
|
||||
// jsonList = MBridge.jsonDecodeToList(res);
|
||||
// }
|
||||
// for (var a in jsonList) {
|
||||
// final thumbnail = MBridge.getMapValue(a, "thumbnail", 0);
|
||||
// if (thumbnail.startsWith("https://")) {
|
||||
// images.add(thumbnail);
|
||||
// } else {
|
||||
// images.add("${manga.apiUrl}/cover/$thumbnail");
|
||||
// }
|
||||
// names.add(MBridge.getMapValue(a, "title", 0));
|
||||
// final seriesSlug = MBridge.regExp(
|
||||
// MBridge.getMapValue(a, "series_slug", 0), "-\\d+", "", 0, 0);
|
||||
// urls.add("/series/$seriesSlug");
|
||||
// }
|
||||
// manga.urls = urls;
|
||||
// manga.images = images;
|
||||
// manga.names = names;
|
||||
// return manga;
|
||||
// }
|
||||
getPopularManga(MangaModel manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
final url = "${manga.apiUrl}/series/querysearch";
|
||||
final body = {
|
||||
"page": manga.page,
|
||||
"order": "desc",
|
||||
"order_by": "total_views",
|
||||
"series_status": "Ongoing",
|
||||
"series_type": "Comic"
|
||||
};
|
||||
final data = {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"sourceId": manga.sourceId,
|
||||
"body": body
|
||||
};
|
||||
final res = await MBridge.http(json.encode(data), 1);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
List<String> jsonList = [];
|
||||
List<String> names = [];
|
||||
List<String> urls = [];
|
||||
List<String> images = [];
|
||||
if (res.startsWith("{")) {
|
||||
jsonList = MBridge.jsonPathToList(res, r'$.data[*]');
|
||||
} else {
|
||||
jsonList = MBridge.jsonDecodeToList(res);
|
||||
}
|
||||
for (var a in jsonList) {
|
||||
final thumbnail = MBridge.getMapValue(a, "thumbnail", 0);
|
||||
if (thumbnail.startsWith("https://")) {
|
||||
images.add(thumbnail);
|
||||
} else {
|
||||
images.add("${manga.apiUrl}/cover/$thumbnail");
|
||||
}
|
||||
names.add(MBridge.getMapValue(a, "title", 0));
|
||||
final seriesSlug = MBridge.regExp(
|
||||
MBridge.getMapValue(a, "series_slug", 0), "-\\d+", "", 0, 0);
|
||||
urls.add("/series/$seriesSlug");
|
||||
}
|
||||
manga.urls = urls;
|
||||
manga.images = images;
|
||||
manga.names = names;
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getLatestUpdatesManga(MangaModel manga) async {
|
||||
// final headers = getHeader(manga.baseUrl);
|
||||
// final url = "${manga.apiUrl}/series/querysearch";
|
||||
// final body = {
|
||||
// "page": manga.page,
|
||||
// "order": "desc",
|
||||
// "order_by": "latest",
|
||||
// "series_status": "Ongoing",
|
||||
// "series_type": "Comic"
|
||||
// };
|
||||
// final data = {
|
||||
// "url": url,
|
||||
// "headers": headers,
|
||||
// "sourceId": manga.sourceId,
|
||||
// "body": body
|
||||
// };
|
||||
// final res = await MBridge.http(json.encode(data), 1);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// List<String> jsonList = [];
|
||||
// List<String> names = [];
|
||||
// List<String> urls = [];
|
||||
// List<String> images = [];
|
||||
// if (res.startsWith("{")) {
|
||||
// jsonList = MBridge.jsonPathToList(res, r'$.data[*]');
|
||||
// } else {
|
||||
// jsonList = MBridge.jsonDecodeToList(res);
|
||||
// }
|
||||
// for (var a in jsonList) {
|
||||
// final thumbnail = MBridge.getMapValue(a, "thumbnail", 0);
|
||||
// if (thumbnail.startsWith("https://")) {
|
||||
// images.add(thumbnail);
|
||||
// } else {
|
||||
// images.add("${manga.apiUrl}/cover/$thumbnail");
|
||||
// }
|
||||
// names.add(MBridge.getMapValue(a, "title", 0));
|
||||
// final seriesSlug = MBridge.regExp(
|
||||
// MBridge.getMapValue(a, "series_slug", 0), "-\\d+", "", 0, 0);
|
||||
// urls.add("/series/$seriesSlug");
|
||||
// }
|
||||
// manga.urls = urls;
|
||||
// manga.images = images;
|
||||
// manga.names = names;
|
||||
// return manga;
|
||||
// }
|
||||
getLatestUpdatesManga(MangaModel manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
final url = "${manga.apiUrl}/series/querysearch";
|
||||
final body = {
|
||||
"page": manga.page,
|
||||
"order": "desc",
|
||||
"order_by": "latest",
|
||||
"series_status": "Ongoing",
|
||||
"series_type": "Comic"
|
||||
};
|
||||
final data = {
|
||||
"url": url,
|
||||
"headers": headers,
|
||||
"sourceId": manga.sourceId,
|
||||
"body": body
|
||||
};
|
||||
final res = await MBridge.http(json.encode(data), 1);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
List<String> jsonList = [];
|
||||
List<String> names = [];
|
||||
List<String> urls = [];
|
||||
List<String> images = [];
|
||||
if (res.startsWith("{")) {
|
||||
jsonList = MBridge.jsonPathToList(res, r'$.data[*]');
|
||||
} else {
|
||||
jsonList = MBridge.jsonDecodeToList(res);
|
||||
}
|
||||
for (var a in jsonList) {
|
||||
final thumbnail = MBridge.getMapValue(a, "thumbnail", 0);
|
||||
if (thumbnail.startsWith("https://")) {
|
||||
images.add(thumbnail);
|
||||
} else {
|
||||
images.add("${manga.apiUrl}/cover/$thumbnail");
|
||||
}
|
||||
names.add(MBridge.getMapValue(a, "title", 0));
|
||||
final seriesSlug = MBridge.regExp(
|
||||
MBridge.getMapValue(a, "series_slug", 0), "-\\d+", "", 0, 0);
|
||||
urls.add("/series/$seriesSlug");
|
||||
}
|
||||
manga.urls = urls;
|
||||
manga.images = images;
|
||||
manga.names = names;
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getMangaDetail(MangaModel manga) async {
|
||||
// String currentSlug = MBridge.listParse(manga.link.split('/'), 2)[0];
|
||||
getMangaDetail(MangaModel manga) async {
|
||||
String currentSlug = MBridge.listParse(manga.link.split('/'), 2)[0];
|
||||
|
||||
// final headers = getHeader(manga.baseUrl);
|
||||
// final url = "${manga.apiUrl}/series/$currentSlug";
|
||||
// final data = {"url": url, "headers": headers};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// manga.author = MBridge.getMapValue(res, "author", 0);
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
final url = "${manga.apiUrl}/series/$currentSlug";
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.author = MBridge.getMapValue(res, "author", 0);
|
||||
|
||||
// manga.description = MBridge.getMapValue(res, "description", 0);
|
||||
// manga.genre =
|
||||
// MBridge.jsonPathToString(res, r"$.tags[*].name", "._").split("._");
|
||||
manga.description = MBridge.getMapValue(res, "description", 0);
|
||||
manga.genre =
|
||||
MBridge.jsonPathToString(res, r"$.tags[*].name", "._").split("._");
|
||||
|
||||
// final chapters = MBridge.jsonPathToList(res, r"$.chapters[*]");
|
||||
// List<String> chapterTitles = [];
|
||||
// List<String> chapterUrls = [];
|
||||
// List<String> chapterDates = [];
|
||||
// for (var chapter in chapters) {
|
||||
// final chapterName = MBridge.getMapValue(chapter, "chapter_name", 0);
|
||||
// final chapterSlug = MBridge.getMapValue(chapter, "chapter_slug", 0);
|
||||
// final chapterId = MBridge.getMapValue(chapter, "id", 0);
|
||||
// final createdAt = MBridge.getMapValue(chapter, "created_at", 0);
|
||||
// chapterUrls.add("/series/$currentSlug/$chapterSlug#$chapterId");
|
||||
// chapterTitles.add(chapterName);
|
||||
// chapterDates.add(createdAt);
|
||||
// }
|
||||
// manga.urls = chapterUrls;
|
||||
// manga.names = chapterTitles;
|
||||
// manga.chaptersDateUploads = MBridge.listParse(
|
||||
// MBridge.listParseDateTime(
|
||||
// chapterDates, manga.dateFormat, manga.dateFormatLocale),
|
||||
// 0);
|
||||
// return manga;
|
||||
// }
|
||||
final chapters = MBridge.jsonPathToList(res, r"$.chapters[*]");
|
||||
List<String> chapterTitles = [];
|
||||
List<String> chapterUrls = [];
|
||||
List<String> chapterDates = [];
|
||||
for (var chapter in chapters) {
|
||||
final chapterName = MBridge.getMapValue(chapter, "chapter_name", 0);
|
||||
final chapterSlug = MBridge.getMapValue(chapter, "chapter_slug", 0);
|
||||
final chapterId = MBridge.getMapValue(chapter, "id", 0);
|
||||
final createdAt = MBridge.getMapValue(chapter, "created_at", 0);
|
||||
chapterUrls.add("/series/$currentSlug/$chapterSlug#$chapterId");
|
||||
chapterTitles.add(chapterName);
|
||||
chapterDates.add(createdAt);
|
||||
}
|
||||
manga.urls = chapterUrls;
|
||||
manga.names = chapterTitles;
|
||||
manga.chaptersDateUploads = MBridge.listParse(
|
||||
MBridge.listParseDateTime(
|
||||
chapterDates, manga.dateFormat, manga.dateFormatLocale),
|
||||
0);
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getChapterUrl(MangaModel manga) async {
|
||||
// String chapterId = MBridge.listParse(manga.link.split('#'), 2)[0];
|
||||
getChapterUrl(MangaModel manga) async {
|
||||
String chapterId = MBridge.listParse(manga.link.split('#'), 2)[0];
|
||||
|
||||
// final headers = getHeader(manga.baseUrl);
|
||||
// final url = "${manga.apiUrl}/series/chapter/$chapterId";
|
||||
// final data = {"url": url, "headers": headers};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return [];
|
||||
// }
|
||||
// final pages = MBridge.jsonPathToList(res, r"$.content.images[*]");
|
||||
// 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;
|
||||
// }
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
final url = "${manga.apiUrl}/series/chapter/$chapterId";
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
final pages = MBridge.jsonPathToList(res, r"$.content.images[*]");
|
||||
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;
|
||||
// }
|
||||
Map<String, String> getHeader(String url) {
|
||||
final headers = {
|
||||
'Origin': url,
|
||||
'Referer': '$url/',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Content-Type': 'application/json'
|
||||
};
|
||||
return headers;
|
||||
}
|
||||
|
||||
@@ -1,282 +1,282 @@
|
||||
// import 'dart:convert';
|
||||
import 'dart:convert';
|
||||
|
||||
// getPopularManga(MangaModel manga) async {
|
||||
// final url = "${manga.baseUrl}/manga/page/${manga.page}/?m_orderby=views";
|
||||
// final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// manga.urls = MBridge.xpath(res, '//*[@class^="post-title"]/h3/a/@href', '-.')
|
||||
// .split("-.");
|
||||
// String 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.split("-.");
|
||||
// manga.names =
|
||||
// MBridge.xpath(res, '//*[@id^="manga-item"]/a/@title', '-.').split("-.");
|
||||
getPopularManga(MangaModel manga) async {
|
||||
final url = "${manga.baseUrl}/manga/page/${manga.page}/?m_orderby=views";
|
||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.urls = MBridge.xpath(res, '//*[@class^="post-title"]/h3/a/@href', '-.')
|
||||
.split("-.");
|
||||
String 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.split("-.");
|
||||
manga.names =
|
||||
MBridge.xpath(res, '//*[@id^="manga-item"]/a/@title', '-.').split("-.");
|
||||
|
||||
// return manga;
|
||||
// }
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getMangaDetail(MangaModel 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,
|
||||
// }
|
||||
// ];
|
||||
getMangaDetail(MangaModel 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,
|
||||
}
|
||||
];
|
||||
|
||||
// final datas = {
|
||||
// "url": manga.link,
|
||||
// "headers": null,
|
||||
// "sourceId": manga.sourceId
|
||||
// };
|
||||
// final res = await MBridge.http(json.encode(datas), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// manga.author =
|
||||
// MBridge.querySelectorAll(res, "div.author-content > a", 0, "", 0, 0, "");
|
||||
// manga.description = MBridge.querySelectorAll(
|
||||
// res,
|
||||
// "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",
|
||||
// 0,
|
||||
// "",
|
||||
// 0,
|
||||
// 0,
|
||||
// "");
|
||||
// manga.imageUrl =
|
||||
// MBridge.querySelectorAll(res, "div.summary_image img", 2, "", 2, 1, "");
|
||||
// final mangaId = MBridge.querySelectorAll(
|
||||
// res, "div[id^=manga-chapters-holder]", 3, "data-id", 0, 1, "");
|
||||
// manga.status = MBridge.parseStatus(
|
||||
// MBridge.querySelectorAll(res, "div.summary-content", 0, "", 0, 2, ""),
|
||||
// statusList);
|
||||
final datas = {
|
||||
"url": manga.link,
|
||||
"headers": null,
|
||||
"sourceId": manga.sourceId
|
||||
};
|
||||
final res = await MBridge.http(json.encode(datas), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.author =
|
||||
MBridge.querySelectorAll(res, "div.author-content > a", 0, "", 0, 0, "");
|
||||
manga.description = MBridge.querySelectorAll(
|
||||
res,
|
||||
"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",
|
||||
0,
|
||||
"",
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
manga.imageUrl =
|
||||
MBridge.querySelectorAll(res, "div.summary_image img", 2, "", 2, 1, "");
|
||||
final mangaId = MBridge.querySelectorAll(
|
||||
res, "div[id^=manga-chapters-holder]", 3, "data-id", 0, 1, "");
|
||||
manga.status = MBridge.parseStatus(
|
||||
MBridge.querySelectorAll(res, "div.summary-content", 0, "", 0, 2, ""),
|
||||
statusList);
|
||||
|
||||
// manga.genre =
|
||||
// MBridge.querySelectorAll(res, "div.genres-content a", 0, "", 0, 0, "-.")
|
||||
// .split("-.");
|
||||
manga.genre =
|
||||
MBridge.querySelectorAll(res, "div.genres-content a", 0, "", 0, 0, "-.")
|
||||
.split("-.");
|
||||
|
||||
// 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};
|
||||
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};
|
||||
|
||||
// String resP = await MBridge.http(json.encode(datasP), 1);
|
||||
// if (resP == "400") {
|
||||
// final urlP = "${manga.link}ajax/chapters";
|
||||
// final datasP = {
|
||||
// "url": urlP,
|
||||
// "headers": headers,
|
||||
// "sourceId": manga.sourceId
|
||||
// };
|
||||
// resP = await MBridge.http(json.encode(datasP), 1);
|
||||
// }
|
||||
// manga.urls = MBridge.xpath(resP, "//li/a/@href", '-.').split("-.");
|
||||
// List<dynamic> chaptersNames =
|
||||
// MBridge.xpath(resP, "//li/a/text()", '-.').split("-.");
|
||||
String resP = await MBridge.http(json.encode(datasP), 1);
|
||||
if (resP == "400") {
|
||||
final urlP = "${manga.link}ajax/chapters";
|
||||
final datasP = {
|
||||
"url": urlP,
|
||||
"headers": headers,
|
||||
"sourceId": manga.sourceId
|
||||
};
|
||||
resP = await MBridge.http(json.encode(datasP), 1);
|
||||
}
|
||||
manga.urls = MBridge.xpath(resP, "//li/a/@href", '-.').split("-.");
|
||||
List<dynamic> chaptersNames =
|
||||
MBridge.xpath(resP, "//li/a/text()", '-.').split("-.");
|
||||
|
||||
// List<dynamic> dateF =
|
||||
// MBridge.xpath(resP, "//li/span/i/text()", '-.').split("-.");
|
||||
// if (MBridge.xpath(resP, "//li/a/text()", "").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", '-.')
|
||||
// .split("-.");
|
||||
// chaptersNames = MBridge.xpath(resWebview,
|
||||
// "//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/text()", '-.')
|
||||
// .split("-.");
|
||||
// dateF = MBridge.xpath(
|
||||
// resWebview,
|
||||
// "//*[@id='manga-chapters-holder']/div[2]/div/ul/li/span/i/text()",
|
||||
// '-.')
|
||||
// .split("-.");
|
||||
// }
|
||||
List<dynamic> dateF =
|
||||
MBridge.xpath(resP, "//li/span/i/text()", '-.').split("-.");
|
||||
if (MBridge.xpath(resP, "//li/a/text()", "").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", '-.')
|
||||
.split("-.");
|
||||
chaptersNames = MBridge.xpath(resWebview,
|
||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/text()", '-.')
|
||||
.split("-.");
|
||||
dateF = MBridge.xpath(
|
||||
resWebview,
|
||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/span/i/text()",
|
||||
'-.')
|
||||
.split("-.");
|
||||
}
|
||||
|
||||
// manga.names = chaptersNames;
|
||||
// List<String> chapterDate = [];
|
||||
// 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}";
|
||||
// }
|
||||
manga.names = chaptersNames;
|
||||
List<String> chapterDate = [];
|
||||
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 = MBridge.listParse(date.split('--..'), 0);
|
||||
final dateFF = MBridge.listParseDateTime(
|
||||
dateF, manga.dateFormat, manga.dateFormatLocale);
|
||||
List<String> chapterDate = MBridge.listParse(date.split('--..'), 0);
|
||||
|
||||
// for (var date in dateFF) {
|
||||
// chapterDate.add(date);
|
||||
// }
|
||||
// manga.chaptersDateUploads = chapterDate;
|
||||
// }
|
||||
// return manga;
|
||||
// }
|
||||
for (var date in dateFF) {
|
||||
chapterDate.add(date);
|
||||
}
|
||||
manga.chaptersDateUploads = chapterDate;
|
||||
}
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getChapterUrl(MangaModel manga) async {
|
||||
// final datas = {
|
||||
// "url": manga.link,
|
||||
// "headers": null,
|
||||
// "sourceId": manga.sourceId
|
||||
// };
|
||||
// final res = await MBridge.http(json.encode(datas), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return [];
|
||||
// }
|
||||
// final pagesSelectorRes = MBridge.querySelector(
|
||||
// res,
|
||||
// "div.page-break, li.blocks-gallery-item, .reading-content, .text-left img",
|
||||
// 1,
|
||||
// "");
|
||||
// final imgs =
|
||||
// MBridge.querySelectorAll(pagesSelectorRes, "img", 2, "", 2, 0, '-.')
|
||||
// .split('-.');
|
||||
// List<dynamic> pageUrls = [];
|
||||
getChapterUrl(MangaModel manga) async {
|
||||
final datas = {
|
||||
"url": manga.link,
|
||||
"headers": null,
|
||||
"sourceId": manga.sourceId
|
||||
};
|
||||
final res = await MBridge.http(json.encode(datas), 0);
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
final pagesSelectorRes = MBridge.querySelector(
|
||||
res,
|
||||
"div.page-break, li.blocks-gallery-item, .reading-content, .text-left img",
|
||||
1,
|
||||
"");
|
||||
final imgs =
|
||||
MBridge.querySelectorAll(pagesSelectorRes, "img", 2, "", 2, 0, '-.')
|
||||
.split('-.');
|
||||
List<dynamic> pageUrls = [];
|
||||
|
||||
// if (imgs.length == 1) {
|
||||
// final pages = MBridge.querySelector(res, "#single-pager", 2, "");
|
||||
if (imgs.length == 1) {
|
||||
final pages = MBridge.querySelector(res, "#single-pager", 2, "");
|
||||
|
||||
// final pagesNumber =
|
||||
// MBridge.querySelectorAll(pages, "option", 2, "", 0, 0, '-.')
|
||||
// .split('-.');
|
||||
final pagesNumber =
|
||||
MBridge.querySelectorAll(pages, "option", 2, "", 0, 0, '-.')
|
||||
.split('-.');
|
||||
|
||||
// for (var i = 0; i < pagesNumber.length; i++) {
|
||||
// final val = i + 1;
|
||||
// if (i.toString().length == 1) {
|
||||
// pageUrls.add(
|
||||
// MBridge.querySelectorAll(pagesSelectorRes, "img", 2, "", 2, 0, "")
|
||||
// .replaceAll("01", '0$val'));
|
||||
// } else {
|
||||
// pageUrls.add(
|
||||
// MBridge.querySelectorAll(pagesSelectorRes, "img", 2, "", 2, 0, "")
|
||||
// .replaceAll("01", val.toString()));
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// return imgs;
|
||||
// }
|
||||
// return pageUrls;
|
||||
// }
|
||||
for (var i = 0; i < pagesNumber.length; i++) {
|
||||
final val = i + 1;
|
||||
if (i.toString().length == 1) {
|
||||
pageUrls.add(
|
||||
MBridge.querySelectorAll(pagesSelectorRes, "img", 2, "", 2, 0, "")
|
||||
.replaceAll("01", '0$val'));
|
||||
} else {
|
||||
pageUrls.add(
|
||||
MBridge.querySelectorAll(pagesSelectorRes, "img", 2, "", 2, 0, "")
|
||||
.replaceAll("01", val.toString()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return imgs;
|
||||
}
|
||||
return pageUrls;
|
||||
}
|
||||
|
||||
// getLatestUpdatesManga(MangaModel manga) async {
|
||||
// final url = "${manga.baseUrl}/manga/page/${manga.page}/?m_orderby=latest";
|
||||
// final datas = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
// final res = await MBridge.http(json.encode(datas), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// manga.urls = MBridge.xpath(res, '//*[@class^="post-title"]/h3/a/@href', '-.')
|
||||
// .split("-.");
|
||||
// String 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.split("-.");
|
||||
// manga.names =
|
||||
// MBridge.xpath(res, '//*[@id^="manga-item"]/a/@title', '-.').split("-.");
|
||||
// return manga;
|
||||
// }
|
||||
getLatestUpdatesManga(MangaModel manga) async {
|
||||
final url = "${manga.baseUrl}/manga/page/${manga.page}/?m_orderby=latest";
|
||||
final datas = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http(json.encode(datas), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.urls = MBridge.xpath(res, '//*[@class^="post-title"]/h3/a/@href', '-.')
|
||||
.split("-.");
|
||||
String 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.split("-.");
|
||||
manga.names =
|
||||
MBridge.xpath(res, '//*[@id^="manga-item"]/a/@title', '-.').split("-.");
|
||||
return manga;
|
||||
}
|
||||
|
||||
// searchManga(MangaModel manga) async {
|
||||
// final urll = "${manga.baseUrl}/?s=${manga.query}&post_type=wp-manga";
|
||||
// final datas = {"url": urll, "headers": null, "sourceId": manga.sourceId};
|
||||
// final res = await MBridge.http(json.encode(datas), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// manga.urls =
|
||||
// MBridge.xpath(res, '//*[@class^="tab-thumb c-image-hover"]/a/@href', '-.')
|
||||
// .split("-.");
|
||||
// String 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.split("-.");
|
||||
// manga.names = MBridge.xpath(
|
||||
// res, '//*[@class^="tab-thumb c-image-hover"]/a/@title', '-.')
|
||||
// .split("-.");
|
||||
// return manga;
|
||||
// }
|
||||
searchManga(MangaModel manga) async {
|
||||
final urll = "${manga.baseUrl}/?s=${manga.query}&post_type=wp-manga";
|
||||
final datas = {"url": urll, "headers": null, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http(json.encode(datas), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.urls =
|
||||
MBridge.xpath(res, '//*[@class^="tab-thumb c-image-hover"]/a/@href', '-.')
|
||||
.split("-.");
|
||||
String 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.split("-.");
|
||||
manga.names = MBridge.xpath(
|
||||
res, '//*[@class^="tab-thumb c-image-hover"]/a/@title', '-.')
|
||||
.split("-.");
|
||||
return manga;
|
||||
}
|
||||
|
||||
// Map<String, String> getHeader(String url) {
|
||||
// final headers = {
|
||||
// "Referer": "$url/",
|
||||
// };
|
||||
// return headers;
|
||||
// }
|
||||
Map<String, String> getHeader(String url) {
|
||||
final headers = {
|
||||
"Referer": "$url/",
|
||||
};
|
||||
return headers;
|
||||
}
|
||||
|
||||
@@ -1,194 +1,194 @@
|
||||
// import 'dart:convert';
|
||||
// import 'package:bridge_lib/bridge_lib.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
// getPopularManga(MangaModel manga) async {
|
||||
// final url = "${manga.baseUrl}/manga/?page=${manga.page}&order=popular";
|
||||
// final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// manga.urls =
|
||||
// MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href', '._')
|
||||
// .split('._');
|
||||
// manga.names =
|
||||
// MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title', '._')
|
||||
// .split('._');
|
||||
// manga.images = MBridge.xpath(
|
||||
// res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src', '._')
|
||||
// .split('._');
|
||||
// return manga;
|
||||
// }
|
||||
getPopularManga(MangaModel manga) async {
|
||||
final url = "${manga.baseUrl}/manga/?page=${manga.page}&order=popular";
|
||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.urls =
|
||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href', '._')
|
||||
.split('._');
|
||||
manga.names =
|
||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title', '._')
|
||||
.split('._');
|
||||
manga.images = MBridge.xpath(
|
||||
res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src', '._')
|
||||
.split('._');
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getLatestUpdatesManga(MangaModel manga) async {
|
||||
// final url = "${manga.baseUrl}/manga/?page=${manga.page}&order=update";
|
||||
// final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// manga.urls =
|
||||
// MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href', '._')
|
||||
// .split('._');
|
||||
// manga.names =
|
||||
// MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title', '._')
|
||||
// .split('._');
|
||||
// manga.images = MBridge.xpath(
|
||||
// res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src', '._')
|
||||
// .split('._');
|
||||
// return manga;
|
||||
// }
|
||||
getLatestUpdatesManga(MangaModel manga) async {
|
||||
final url = "${manga.baseUrl}/manga/?page=${manga.page}&order=update";
|
||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.urls =
|
||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href', '._')
|
||||
.split('._');
|
||||
manga.names =
|
||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title', '._')
|
||||
.split('._');
|
||||
manga.images = MBridge.xpath(
|
||||
res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src', '._')
|
||||
.split('._');
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getMangaDetail(MangaModel manga) async {
|
||||
// final statusList = [
|
||||
// {
|
||||
// "مستمرة": 0,
|
||||
// "En curso": 0,
|
||||
// "Ongoing": 0,
|
||||
// "On going": 0,
|
||||
// "Ativo": 0,
|
||||
// "En Cours": 0,
|
||||
// "Berjalan": 0,
|
||||
// "Продолжается": 0,
|
||||
// "Updating": 0,
|
||||
// "Lançando": 0,
|
||||
// "In Arrivo": 0,
|
||||
// "OnGoing": 0,
|
||||
// "Đang tiến hành": 0,
|
||||
// "em lançamento": 0,
|
||||
// "Онгоінг": 0,
|
||||
// "Publishing": 0,
|
||||
// "Curso": 0,
|
||||
// "En marcha": 0,
|
||||
// "Publicandose": 0,
|
||||
// "连载中": 0,
|
||||
// "Devam Ediyor": 0,
|
||||
// "Em Andamento": 0,
|
||||
// "In Corso": 0,
|
||||
// "Güncel": 0,
|
||||
// "Emision": 0,
|
||||
// "En emision": 0,
|
||||
// "مستمر": 0,
|
||||
// "Đã hoàn thành": 1,
|
||||
// "مكتملة": 1,
|
||||
// "Завершено": 1,
|
||||
// "Complété": 1,
|
||||
// "Fini": 1,
|
||||
// "Terminé": 1,
|
||||
// "Tamamlandı": 1,
|
||||
// "Tamat": 1,
|
||||
// "Completado": 1,
|
||||
// "Concluído": 1,
|
||||
// "Finished": 1,
|
||||
// "Completed": 1,
|
||||
// "Completo": 1,
|
||||
// "Concluido": 1,
|
||||
// "已完结": 1,
|
||||
// "Finalizado": 1,
|
||||
// "Completata": 1,
|
||||
// "One-Shot": 1,
|
||||
// "Bitti": 1,
|
||||
// "hiatus": 2,
|
||||
// }
|
||||
// ];
|
||||
getMangaDetail(MangaModel manga) async {
|
||||
final statusList = [
|
||||
{
|
||||
"مستمرة": 0,
|
||||
"En curso": 0,
|
||||
"Ongoing": 0,
|
||||
"On going": 0,
|
||||
"Ativo": 0,
|
||||
"En Cours": 0,
|
||||
"Berjalan": 0,
|
||||
"Продолжается": 0,
|
||||
"Updating": 0,
|
||||
"Lançando": 0,
|
||||
"In Arrivo": 0,
|
||||
"OnGoing": 0,
|
||||
"Đang tiến hành": 0,
|
||||
"em lançamento": 0,
|
||||
"Онгоінг": 0,
|
||||
"Publishing": 0,
|
||||
"Curso": 0,
|
||||
"En marcha": 0,
|
||||
"Publicandose": 0,
|
||||
"连载中": 0,
|
||||
"Devam Ediyor": 0,
|
||||
"Em Andamento": 0,
|
||||
"In Corso": 0,
|
||||
"Güncel": 0,
|
||||
"Emision": 0,
|
||||
"En emision": 0,
|
||||
"مستمر": 0,
|
||||
"Đã hoàn thành": 1,
|
||||
"مكتملة": 1,
|
||||
"Завершено": 1,
|
||||
"Complété": 1,
|
||||
"Fini": 1,
|
||||
"Terminé": 1,
|
||||
"Tamamlandı": 1,
|
||||
"Tamat": 1,
|
||||
"Completado": 1,
|
||||
"Concluído": 1,
|
||||
"Finished": 1,
|
||||
"Completed": 1,
|
||||
"Completo": 1,
|
||||
"Concluido": 1,
|
||||
"已完结": 1,
|
||||
"Finalizado": 1,
|
||||
"Completata": 1,
|
||||
"One-Shot": 1,
|
||||
"Bitti": 1,
|
||||
"hiatus": 2,
|
||||
}
|
||||
];
|
||||
|
||||
// final datas = {
|
||||
// "url": manga.link,
|
||||
// "headers": null,
|
||||
// "sourceId": manga.sourceId
|
||||
// };
|
||||
// final res = await MBridge.http(json.encode(datas), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// manga.author = MBridge.xpath(
|
||||
// res,
|
||||
// '//*[@class="imptdt" and contains(text(), "Author") or @class="infotable" and contains(text(), "Author") or @class="infotable" and contains(text(), "Auteur") or @class="infotable" and contains(text(), "Autor")]/text()',
|
||||
// '')
|
||||
// .replaceAll("Autor", "")
|
||||
// .replaceAll("Author", "")
|
||||
// .replaceAll("Auteur", "")
|
||||
// .replaceAll("[Add, ]", "");
|
||||
// manga.description = MBridge.querySelectorAll(
|
||||
// res, ".desc, .entry-content[itemprop=description]", 0, "", 0, 0, "");
|
||||
// final status = MBridge.xpath(
|
||||
// res,
|
||||
// '//*[@class="imptdt" and contains(text(), "Status") or @class="imptdt" and contains(text(), "Estado") or @class="infotable" and contains(text(), "Status") or @class="infotable" and contains(text(), "Statut")]/text()',
|
||||
// '')
|
||||
// .replaceAll("Status", "")
|
||||
// .replaceAll("Estado", "")
|
||||
// .replaceAll("Statut", "");
|
||||
// manga.status = MBridge.parseStatus(status, statusList);
|
||||
final datas = {
|
||||
"url": manga.link,
|
||||
"headers": null,
|
||||
"sourceId": manga.sourceId
|
||||
};
|
||||
final res = await MBridge.http(json.encode(datas), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.author = MBridge.xpath(
|
||||
res,
|
||||
'//*[@class="imptdt" and contains(text(), "Author") or @class="infotable" and contains(text(), "Author") or @class="infotable" and contains(text(), "Auteur") or @class="infotable" and contains(text(), "Autor")]/text()',
|
||||
'')
|
||||
.replaceAll("Autor", "")
|
||||
.replaceAll("Author", "")
|
||||
.replaceAll("Auteur", "")
|
||||
.replaceAll("[Add, ]", "");
|
||||
manga.description = MBridge.querySelectorAll(
|
||||
res, ".desc, .entry-content[itemprop=description]", 0, "", 0, 0, "");
|
||||
final status = MBridge.xpath(
|
||||
res,
|
||||
'//*[@class="imptdt" and contains(text(), "Status") or @class="imptdt" and contains(text(), "Estado") or @class="infotable" and contains(text(), "Status") or @class="infotable" and contains(text(), "Statut")]/text()',
|
||||
'')
|
||||
.replaceAll("Status", "")
|
||||
.replaceAll("Estado", "")
|
||||
.replaceAll("Statut", "");
|
||||
manga.status = MBridge.parseStatus(status, statusList);
|
||||
|
||||
// manga.genre = MBridge.xpath(
|
||||
// res,
|
||||
// '//*[@class="gnr" or @class="mgen" or @class="seriestugenre" ]/a/text()',
|
||||
// "-.")
|
||||
// .split("-.");
|
||||
// manga.urls = MBridge.xpath(
|
||||
// res,
|
||||
// '//*[@class="bxcl" or @class="cl" or @class="chbox" or @class="eph-num" or @id="chapterlist"]/div/a[not(@href="#/chapter-{{number}}")]/@href',
|
||||
// "-.")
|
||||
// .split("-.");
|
||||
// manga.names = MBridge.xpath(
|
||||
// res,
|
||||
// '//*[@class="bxcl" or @class="cl" or @class="chbox" or @class="eph-num" or @id="chapterlist"]/div/a/span[@class="chapternum" and not(text()="Chapter {{number}}") or @class="lch" and not(text()="Chapter {{number}}")]/text()',
|
||||
// "-.")
|
||||
// .split("-.");
|
||||
manga.genre = MBridge.xpath(
|
||||
res,
|
||||
'//*[@class="gnr" or @class="mgen" or @class="seriestugenre" ]/a/text()',
|
||||
"-.")
|
||||
.split("-.");
|
||||
manga.urls = MBridge.xpath(
|
||||
res,
|
||||
'//*[@class="bxcl" or @class="cl" or @class="chbox" or @class="eph-num" or @id="chapterlist"]/div/a[not(@href="#/chapter-{{number}}")]/@href',
|
||||
"-.")
|
||||
.split("-.");
|
||||
manga.names = MBridge.xpath(
|
||||
res,
|
||||
'//*[@class="bxcl" or @class="cl" or @class="chbox" or @class="eph-num" or @id="chapterlist"]/div/a/span[@class="chapternum" and not(text()="Chapter {{number}}") or @class="lch" and not(text()="Chapter {{number}}")]/text()',
|
||||
"-.")
|
||||
.split("-.");
|
||||
|
||||
// final chaptersDateUploads = MBridge.xpath(
|
||||
// res,
|
||||
// '//*[@class="bxcl" or @class="cl" or @class="chbox" or @class="eph-num" or @id="chapterlist"]/div/a/span[@class="chapterdate" and not(text()="{{date}}")]/text()',
|
||||
// "-.")
|
||||
// .split("-.");
|
||||
// manga.chaptersDateUploads = MBridge.listParseDateTime(
|
||||
// chaptersDateUploads, manga.dateFormat, manga.dateFormatLocale);
|
||||
// return manga;
|
||||
// }
|
||||
final chaptersDateUploads = MBridge.xpath(
|
||||
res,
|
||||
'//*[@class="bxcl" or @class="cl" or @class="chbox" or @class="eph-num" or @id="chapterlist"]/div/a/span[@class="chapterdate" and not(text()="{{date}}")]/text()',
|
||||
"-.")
|
||||
.split("-.");
|
||||
manga.chaptersDateUploads = MBridge.listParseDateTime(
|
||||
chaptersDateUploads, manga.dateFormat, manga.dateFormatLocale);
|
||||
return manga;
|
||||
}
|
||||
|
||||
// searchManga(MangaModel manga) async {
|
||||
// final url =
|
||||
// "${manga.baseUrl}/manga/?&title=${manga.query}&page=${manga.page}";
|
||||
// final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// manga.urls =
|
||||
// MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href', '._')
|
||||
// .split('._');
|
||||
// manga.names =
|
||||
// MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title', '._')
|
||||
// .split('._');
|
||||
// manga.images = MBridge.xpath(
|
||||
// res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src', '._')
|
||||
// .split('._');
|
||||
// return manga;
|
||||
// }
|
||||
searchManga(MangaModel manga) async {
|
||||
final url =
|
||||
"${manga.baseUrl}/manga/?&title=${manga.query}&page=${manga.page}";
|
||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.urls =
|
||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href', '._')
|
||||
.split('._');
|
||||
manga.names =
|
||||
MBridge.xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title', '._')
|
||||
.split('._');
|
||||
manga.images = MBridge.xpath(
|
||||
res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src', '._')
|
||||
.split('._');
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getChapterUrl(MangaModel manga) async {
|
||||
// final datas = {
|
||||
// "url": manga.link,
|
||||
// "headers": null,
|
||||
// "sourceId": manga.sourceId
|
||||
// };
|
||||
// final res = await MBridge.http(json.encode(datas), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return [];
|
||||
// }
|
||||
// List<String> pagesUrl = [];
|
||||
// final pages = MBridge.xpath(res, '//*[@id="readerarea"]/img/@src', "._._")
|
||||
// .split("._._");
|
||||
// if (pages.length == 1) {
|
||||
// final images =
|
||||
// MBridge.regExp(res, "\"images\"\\s*:\\s*(\\[.*?])", "", 1, 1);
|
||||
// final pages = MBridge.jsonDecodeToList(images);
|
||||
// for (var page in pages) {
|
||||
// pagesUrl.add(page);
|
||||
// }
|
||||
// } else {
|
||||
// pagesUrl = pages;
|
||||
// }
|
||||
getChapterUrl(MangaModel manga) async {
|
||||
final datas = {
|
||||
"url": manga.link,
|
||||
"headers": null,
|
||||
"sourceId": manga.sourceId
|
||||
};
|
||||
final res = await MBridge.http(json.encode(datas), 0);
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
List<String> pagesUrl = [];
|
||||
final pages = MBridge.xpath(res, '//*[@id="readerarea"]/img/@src', "._._")
|
||||
.split("._._");
|
||||
if (pages.length == 1) {
|
||||
final images =
|
||||
MBridge.regExp(res, "\"images\"\\s*:\\s*(\\[.*?])", "", 1, 1);
|
||||
final pages = MBridge.jsonDecodeToList(images);
|
||||
for (var page in pages) {
|
||||
pagesUrl.add(page);
|
||||
}
|
||||
} else {
|
||||
pagesUrl = pages;
|
||||
}
|
||||
|
||||
// return pagesUrl;
|
||||
// }
|
||||
return pagesUrl;
|
||||
}
|
||||
|
||||
@@ -1,173 +1,173 @@
|
||||
// import 'dart:convert';
|
||||
// import 'package:bridge_lib/bridge_lib.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
// searchManga(MangaModel manga) async {
|
||||
// final url = "${manga.baseUrl}/search?query=${manga.query}";
|
||||
// final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// final jsonList = MBridge.jsonPathToList(res, r'$.suggestions[*]');
|
||||
// List<String> urls = [];
|
||||
// List<String> names = [];
|
||||
// List<String> images = [];
|
||||
// for (var da in jsonList) {
|
||||
// final value = MBridge.getMapValue(da, "value", 0);
|
||||
// final data = MBridge.getMapValue(da, "data", 0);
|
||||
searchManga(MangaModel manga) async {
|
||||
final url = "${manga.baseUrl}/search?query=${manga.query}";
|
||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
final jsonList = MBridge.jsonPathToList(res, r'$.suggestions[*]');
|
||||
List<String> urls = [];
|
||||
List<String> names = [];
|
||||
List<String> images = [];
|
||||
for (var da in jsonList) {
|
||||
final value = MBridge.getMapValue(da, "value", 0);
|
||||
final data = MBridge.getMapValue(da, "data", 0);
|
||||
|
||||
// if (manga.source == 'Scan VF') {
|
||||
// urls.add('${manga.baseUrl}/$data');
|
||||
// } else {
|
||||
// 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;
|
||||
// }
|
||||
if (manga.source == 'Scan VF') {
|
||||
urls.add('${manga.baseUrl}/$data');
|
||||
} else {
|
||||
urls.add('${manga.baseUrl}/manga/$data');
|
||||
}
|
||||
names.add(value);
|
||||
if (manga.source == "Manga-FR") {
|
||||
images.add("${manga.baseUrl}/uploads/manga/$data.jpg");
|
||||
} else {
|
||||
images
|
||||
.add("${manga.baseUrl}/uploads/manga/$data/cover/cover_250x350.jpg");
|
||||
}
|
||||
}
|
||||
manga.names = names;
|
||||
manga.urls = urls;
|
||||
manga.images = images;
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getPopularManga(MangaModel manga) async {
|
||||
// final url =
|
||||
// "${manga.baseUrl}/filterList?page=${manga.page}&sortBy=views&asc=false";
|
||||
// final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// manga.urls =
|
||||
// MBridge.xpath(res, '//*[ @class="chart-title"]/@href', '._').split('._');
|
||||
// manga.names =
|
||||
// MBridge.xpath(res, '//*[ @class="chart-title"]/text()', '._').split('._');
|
||||
// List<String> images = [];
|
||||
// for (var url in manga.urls) {
|
||||
// if (manga.source == "Manga-FR") {
|
||||
// images.add(
|
||||
// "${manga.baseUrl}/uploads/manga/${MBridge.listParse(MBridge.stringParse(url).split('/'), 2)[0]}.jpg");
|
||||
// } else {
|
||||
// images.add(
|
||||
// "${manga.baseUrl}/uploads/manga/${MBridge.listParse(MBridge.stringParse(url).split('/'), 2)[0]}/cover/cover_250x350.jpg");
|
||||
// }
|
||||
// }
|
||||
// manga.images = images;
|
||||
// return manga;
|
||||
// }
|
||||
getPopularManga(MangaModel manga) async {
|
||||
final url =
|
||||
"${manga.baseUrl}/filterList?page=${manga.page}&sortBy=views&asc=false";
|
||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.urls =
|
||||
MBridge.xpath(res, '//*[ @class="chart-title"]/@href', '._').split('._');
|
||||
manga.names =
|
||||
MBridge.xpath(res, '//*[ @class="chart-title"]/text()', '._').split('._');
|
||||
List<String> images = [];
|
||||
for (var url in manga.urls) {
|
||||
if (manga.source == "Manga-FR") {
|
||||
images.add(
|
||||
"${manga.baseUrl}/uploads/manga/${MBridge.listParse(MBridge.stringParse(url).split('/'), 2)[0]}.jpg");
|
||||
} else {
|
||||
images.add(
|
||||
"${manga.baseUrl}/uploads/manga/${MBridge.listParse(MBridge.stringParse(url).split('/'), 2)[0]}/cover/cover_250x350.jpg");
|
||||
}
|
||||
}
|
||||
manga.images = images;
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getMangaDetail(MangaModel manga) async {
|
||||
// final statusList = [
|
||||
// {
|
||||
// "complete": 1,
|
||||
// "complet": 1,
|
||||
// "completo": 1,
|
||||
// "zakończone": 1,
|
||||
// "concluído": 1,
|
||||
// "مكتملة": 1,
|
||||
// "ongoing": 0,
|
||||
// "en cours": 0,
|
||||
// "em lançamento": 0,
|
||||
// "prace w toku": 0,
|
||||
// "ativo": 0,
|
||||
// "مستمرة": 0,
|
||||
// "em andamento": 0
|
||||
// }
|
||||
// ];
|
||||
getMangaDetail(MangaModel manga) async {
|
||||
final statusList = [
|
||||
{
|
||||
"complete": 1,
|
||||
"complet": 1,
|
||||
"completo": 1,
|
||||
"zakończone": 1,
|
||||
"concluído": 1,
|
||||
"مكتملة": 1,
|
||||
"ongoing": 0,
|
||||
"en cours": 0,
|
||||
"em lançamento": 0,
|
||||
"prace w toku": 0,
|
||||
"ativo": 0,
|
||||
"مستمرة": 0,
|
||||
"em andamento": 0
|
||||
}
|
||||
];
|
||||
|
||||
// final datas = {
|
||||
// "url": manga.link,
|
||||
// "headers": null,
|
||||
// "sourceId": manga.sourceId
|
||||
// };
|
||||
// final res = await MBridge.http(json.encode(datas), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// manga.author = MBridge.xpath(
|
||||
// res,
|
||||
// '//*[@class="dl-horizontal"]/dt[contains(text(), "Auteur(s)") or contains(text(), "Author(s)") or contains(text(), "Autor(es)") or contains(text(), "Yazar(lar) or contains(text(), "Mangaka(lar)")]//following-sibling::dd[1]/text()',
|
||||
// '');
|
||||
// final status = MBridge.xpath(
|
||||
// res,
|
||||
// '//*[@class="dl-horizontal"]/dt[contains(text(), "Statut") or contains(text(), "Status") or contains(text(), "Estado") or contains(text(), "Durum")]/following-sibling::dd[1]/text()',
|
||||
// '');
|
||||
// manga.status = MBridge.parseStatus(status, statusList);
|
||||
// manga.description = MBridge.xpath(
|
||||
// res, '//*[@class="well" or @class="manga well"]/p/text()', '');
|
||||
// manga.genre = MBridge.xpath(
|
||||
// res,
|
||||
// '//*[@class="dl-horizontal"]/dt[contains(text(), "Categories") or contains(text(), "Categorias") or contains(text(), "Categorías") or contains(text(), "Catégories") or contains(text(), "Kategoriler" or contains(text(), "Kategorie") or contains(text(), "Kategori") or contains(text(), "Tagi"))]/following-sibling::dd[1]/text()',
|
||||
// '')
|
||||
// .split(',');
|
||||
// manga.names =
|
||||
// MBridge.xpath(res, '//*[@class="chapter-title-rtl"]/a/text()', "-.")
|
||||
// .split("-.");
|
||||
// manga.urls =
|
||||
// MBridge.xpath(res, '//*[@class="chapter-title-rtl"]/a/@href', "-.")
|
||||
// .split("-.");
|
||||
// final date =
|
||||
// MBridge.xpath(res, '//*[@class="date-chapter-title-rtl"]/text()', "-.")
|
||||
// .split("-.");
|
||||
// manga.chaptersDateUploads =
|
||||
// MBridge.listParseDateTime(date, "d MMM. yyyy", "en_US");
|
||||
final datas = {
|
||||
"url": manga.link,
|
||||
"headers": null,
|
||||
"sourceId": manga.sourceId
|
||||
};
|
||||
final res = await MBridge.http(json.encode(datas), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.author = MBridge.xpath(
|
||||
res,
|
||||
'//*[@class="dl-horizontal"]/dt[contains(text(), "Auteur(s)") or contains(text(), "Author(s)") or contains(text(), "Autor(es)") or contains(text(), "Yazar(lar) or contains(text(), "Mangaka(lar)")]//following-sibling::dd[1]/text()',
|
||||
'');
|
||||
final status = MBridge.xpath(
|
||||
res,
|
||||
'//*[@class="dl-horizontal"]/dt[contains(text(), "Statut") or contains(text(), "Status") or contains(text(), "Estado") or contains(text(), "Durum")]/following-sibling::dd[1]/text()',
|
||||
'');
|
||||
manga.status = MBridge.parseStatus(status, statusList);
|
||||
manga.description = MBridge.xpath(
|
||||
res, '//*[@class="well" or @class="manga well"]/p/text()', '');
|
||||
manga.genre = MBridge.xpath(
|
||||
res,
|
||||
'//*[@class="dl-horizontal"]/dt[contains(text(), "Categories") or contains(text(), "Categorias") or contains(text(), "Categorías") or contains(text(), "Catégories") or contains(text(), "Kategoriler" or contains(text(), "Kategorie") or contains(text(), "Kategori") or contains(text(), "Tagi"))]/following-sibling::dd[1]/text()',
|
||||
'')
|
||||
.split(',');
|
||||
manga.names =
|
||||
MBridge.xpath(res, '//*[@class="chapter-title-rtl"]/a/text()', "-.")
|
||||
.split("-.");
|
||||
manga.urls =
|
||||
MBridge.xpath(res, '//*[@class="chapter-title-rtl"]/a/@href', "-.")
|
||||
.split("-.");
|
||||
final date =
|
||||
MBridge.xpath(res, '//*[@class="date-chapter-title-rtl"]/text()', "-.")
|
||||
.split("-.");
|
||||
manga.chaptersDateUploads =
|
||||
MBridge.listParseDateTime(date, "d MMM. yyyy", "en_US");
|
||||
|
||||
// return manga;
|
||||
// }
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getLatestUpdatesManga(MangaModel manga) async {
|
||||
// final url = "${manga.baseUrl}/latest-release?page=${manga.page}";
|
||||
// final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// manga.urls = MBridge.xpath(res, '//*[@class="manga-item"]/h3/a/@href', '._')
|
||||
// .split('._');
|
||||
// manga.names = MBridge.xpath(res, '//*[@class="manga-item"]/h3/a/text()', '._')
|
||||
// .split('._');
|
||||
// List<String> images = [];
|
||||
// for (var url in manga.urls) {
|
||||
// if (manga.source == "Manga-FR") {
|
||||
// images.add(
|
||||
// "${manga.baseUrl}/uploads/manga/${MBridge.listParse(MBridge.stringParse(url).split('/'), 2)[0]}.jpg");
|
||||
// } else {
|
||||
// images.add(
|
||||
// "${manga.baseUrl}/uploads/manga/${MBridge.listParse(MBridge.stringParse(url).split('/'), 2)[0]}/cover/cover_250x350.jpg");
|
||||
// }
|
||||
// }
|
||||
// manga.images = images;
|
||||
// return manga;
|
||||
// }
|
||||
getLatestUpdatesManga(MangaModel manga) async {
|
||||
final url = "${manga.baseUrl}/latest-release?page=${manga.page}";
|
||||
final data = {"url": url, "headers": null, "sourceId": manga.sourceId};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.urls = MBridge.xpath(res, '//*[@class="manga-item"]/h3/a/@href', '._')
|
||||
.split('._');
|
||||
manga.names = MBridge.xpath(res, '//*[@class="manga-item"]/h3/a/text()', '._')
|
||||
.split('._');
|
||||
List<String> images = [];
|
||||
for (var url in manga.urls) {
|
||||
if (manga.source == "Manga-FR") {
|
||||
images.add(
|
||||
"${manga.baseUrl}/uploads/manga/${MBridge.listParse(MBridge.stringParse(url).split('/'), 2)[0]}.jpg");
|
||||
} else {
|
||||
images.add(
|
||||
"${manga.baseUrl}/uploads/manga/${MBridge.listParse(MBridge.stringParse(url).split('/'), 2)[0]}/cover/cover_250x350.jpg");
|
||||
}
|
||||
}
|
||||
manga.images = images;
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getChapterUrl(MangaModel manga) async {
|
||||
// final datas = {
|
||||
// "url": manga.link,
|
||||
// "headers": null,
|
||||
// "sourceId": manga.sourceId
|
||||
// };
|
||||
// final res = await MBridge.http(json.encode(datas), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return [];
|
||||
// }
|
||||
// List<String> pagesUrl = [];
|
||||
// final pages = MBridge.listParse(
|
||||
// MBridge.xpath(res,
|
||||
// '//*[@id="all"]/img[@class="img-responsive"]/@data-src', "._._")
|
||||
// .split("._._"),
|
||||
// 0);
|
||||
// for (var page in pages) {
|
||||
// if (page.startsWith('//')) {
|
||||
// pagesUrl.add(page.replaceAll('//', 'https://'));
|
||||
// } else {
|
||||
// pagesUrl.add(page);
|
||||
// }
|
||||
// }
|
||||
getChapterUrl(MangaModel manga) async {
|
||||
final datas = {
|
||||
"url": manga.link,
|
||||
"headers": null,
|
||||
"sourceId": manga.sourceId
|
||||
};
|
||||
final res = await MBridge.http(json.encode(datas), 0);
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
List<String> pagesUrl = [];
|
||||
final pages = MBridge.listParse(
|
||||
MBridge.xpath(res,
|
||||
'//*[@id="all"]/img[@class="img-responsive"]/@data-src', "._._")
|
||||
.split("._._"),
|
||||
0);
|
||||
for (var page in pages) {
|
||||
if (page.startsWith('//')) {
|
||||
pagesUrl.add(page.replaceAll('//', 'https://'));
|
||||
} else {
|
||||
pagesUrl.add(page);
|
||||
}
|
||||
}
|
||||
|
||||
// return pagesUrl;
|
||||
// }
|
||||
return pagesUrl;
|
||||
}
|
||||
|
||||
@@ -1,138 +1,138 @@
|
||||
// import 'package:bridge_lib/bridge_lib.dart';
|
||||
// import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
// getLatestUpdatesManga(MangaModel manga) async {
|
||||
// final url =
|
||||
// "${manga.apiUrl}/v1.0/search?sort=uploaded&page=${manga.page}&tachiyomi=true";
|
||||
// final data = {"url": url, "headers": getHeader(manga.baseUrl)};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// manga.names = MBridge.jsonPathToList(res, r'$.title');
|
||||
// List<String> ids = MBridge.jsonPathToList(res, r'$.hid');
|
||||
// List<String> mangaUrls = [];
|
||||
// for (var id in ids) {
|
||||
// mangaUrls.add("/comic/$id/#");
|
||||
// }
|
||||
// manga.urls = mangaUrls;
|
||||
// manga.images = MBridge.jsonPathToList(res, r'$.cover_url');
|
||||
// return manga;
|
||||
// }
|
||||
getLatestUpdatesManga(MangaModel manga) async {
|
||||
final url =
|
||||
"${manga.apiUrl}/v1.0/search?sort=uploaded&page=${manga.page}&tachiyomi=true";
|
||||
final data = {"url": url, "headers": getHeader(manga.baseUrl)};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.names = MBridge.jsonPathToList(res, r'$.title');
|
||||
List<String> ids = MBridge.jsonPathToList(res, r'$.hid');
|
||||
List<String> mangaUrls = [];
|
||||
for (var id in ids) {
|
||||
mangaUrls.add("/comic/$id/#");
|
||||
}
|
||||
manga.urls = mangaUrls;
|
||||
manga.images = MBridge.jsonPathToList(res, r'$.cover_url');
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getMangaDetail(MangaModel manga) async {
|
||||
// final statusList = [
|
||||
// {
|
||||
// "1": 0,
|
||||
// "2": 1,
|
||||
// "3": 3,
|
||||
// "4": 2,
|
||||
// }
|
||||
// ];
|
||||
getMangaDetail(MangaModel manga) async {
|
||||
final statusList = [
|
||||
{
|
||||
"1": 0,
|
||||
"2": 1,
|
||||
"3": 3,
|
||||
"4": 2,
|
||||
}
|
||||
];
|
||||
|
||||
// final headers = getHeader(manga.baseUrl);
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
|
||||
// final urll =
|
||||
// "${manga.apiUrl}${manga.link.replaceAll("#", '')}?tachiyomi=true";
|
||||
// final data = {"url": urll, "headers": headers};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// 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(json.encode(dataReq), 0);
|
||||
// var total = MBridge.jsonPathToString(request, 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 urll =
|
||||
"${manga.apiUrl}${manga.link.replaceAll("#", '')}?tachiyomi=true";
|
||||
final data = {"url": urll, "headers": headers};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
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(json.encode(dataReq), 0);
|
||||
var total = MBridge.jsonPathToString(request, 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(json.encode(newDataReq), 0);
|
||||
final newDataReq = {"url": newChapUrlReq, "headers": headers};
|
||||
final newRequest = await MBridge.http(json.encode(newDataReq), 0);
|
||||
|
||||
// manga.urls = MBridge.jsonPathToString(newRequest, r'$.chapters[*].hid', "_.")
|
||||
// .split("_.");
|
||||
// final chapDate =
|
||||
// MBridge.jsonPathToString(newRequest, r'$.chapters[*].created_at', "_.")
|
||||
// .split("_.");
|
||||
// manga.chaptersDateUploads = MBridge.listParse(
|
||||
// MBridge.listParseDateTime(chapDate, "yyyy-MM-dd'T'HH:mm:ss'Z'", "en"), 0);
|
||||
// manga.chaptersVolumes =
|
||||
// MBridge.jsonPathToString(newRequest, r'$.chapters[*].vol', "_.")
|
||||
// .split("_.");
|
||||
// manga.chaptersScanlators =
|
||||
// MBridge.jsonPathToString(newRequest, r'$.chapters[*].group_name', "_.")
|
||||
// .split("_.");
|
||||
// manga.names =
|
||||
// MBridge.jsonPathToString(newRequest, r'$.chapters[*].title', "_.")
|
||||
// .split("_.");
|
||||
// manga.chaptersChaps =
|
||||
// MBridge.jsonPathToString(newRequest, r'$.chapters[*].chap', "_.")
|
||||
// .split("_.");
|
||||
manga.urls = MBridge.jsonPathToString(newRequest, r'$.chapters[*].hid', "_.")
|
||||
.split("_.");
|
||||
final chapDate =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].created_at', "_.")
|
||||
.split("_.");
|
||||
manga.chaptersDateUploads = MBridge.listParse(
|
||||
MBridge.listParseDateTime(chapDate, "yyyy-MM-dd'T'HH:mm:ss'Z'", "en"), 0);
|
||||
manga.chaptersVolumes =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].vol', "_.")
|
||||
.split("_.");
|
||||
manga.chaptersScanlators =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].group_name', "_.")
|
||||
.split("_.");
|
||||
manga.names =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].title', "_.")
|
||||
.split("_.");
|
||||
manga.chaptersChaps =
|
||||
MBridge.jsonPathToString(newRequest, r'$.chapters[*].chap', "_.")
|
||||
.split("_.");
|
||||
|
||||
// return manga;
|
||||
// }
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getPopularManga(MangaModel manga) async {
|
||||
// final urll =
|
||||
// "${manga.apiUrl}/v1.0/search?sort=follow&page=${manga.page}&tachiyomi=true";
|
||||
// final data = {"url": urll, "headers": getHeader(manga.baseUrl)};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// manga.names = MBridge.jsonPathToList(res, r'$.title');
|
||||
// List<String> ids = MBridge.jsonPathToList(res, r'$.hid');
|
||||
// List<String> mangaUrls = [];
|
||||
// for (var id in ids) {
|
||||
// mangaUrls.add("/comic/$id/#");
|
||||
// }
|
||||
// manga.urls = mangaUrls;
|
||||
// manga.images = MBridge.jsonPathToList(res, r'$.cover_url');
|
||||
// return manga;
|
||||
// }
|
||||
getPopularManga(MangaModel manga) async {
|
||||
final urll =
|
||||
"${manga.apiUrl}/v1.0/search?sort=follow&page=${manga.page}&tachiyomi=true";
|
||||
final data = {"url": urll, "headers": getHeader(manga.baseUrl)};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.names = MBridge.jsonPathToList(res, r'$.title');
|
||||
List<String> ids = MBridge.jsonPathToList(res, r'$.hid');
|
||||
List<String> mangaUrls = [];
|
||||
for (var id in ids) {
|
||||
mangaUrls.add("/comic/$id/#");
|
||||
}
|
||||
manga.urls = mangaUrls;
|
||||
manga.images = MBridge.jsonPathToList(res, r'$.cover_url');
|
||||
return manga;
|
||||
}
|
||||
|
||||
// searchManga(MangaModel manga) async {
|
||||
// final urll = "${manga.apiUrl}/v1.0/search?q=${manga.query}&tachiyomi=true";
|
||||
// final data = {"url": urll, "headers": getHeader(manga.baseUrl)};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// manga.names = MBridge.jsonPathToList(res, r'$.title');
|
||||
// List<String> ids = MBridge.jsonPathToList(res, r'$.hid');
|
||||
// List<String> mangaUrls = [];
|
||||
// for (var id in ids) {
|
||||
// mangaUrls.add("/comic/$id/#");
|
||||
// }
|
||||
// manga.urls = mangaUrls;
|
||||
// manga.images = MBridge.jsonPathToList(res, r'$.cover_url');
|
||||
// return manga;
|
||||
// }
|
||||
searchManga(MangaModel manga) async {
|
||||
final urll = "${manga.apiUrl}/v1.0/search?q=${manga.query}&tachiyomi=true";
|
||||
final data = {"url": urll, "headers": getHeader(manga.baseUrl)};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.names = MBridge.jsonPathToList(res, r'$.title');
|
||||
List<String> ids = MBridge.jsonPathToList(res, r'$.hid');
|
||||
List<String> mangaUrls = [];
|
||||
for (var id in ids) {
|
||||
mangaUrls.add("/comic/$id/#");
|
||||
}
|
||||
manga.urls = mangaUrls;
|
||||
manga.images = MBridge.jsonPathToList(res, r'$.cover_url');
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getChapterUrl(MangaModel manga) async {
|
||||
// final url = "${manga.apiUrl}/chapter/${manga.link}?tachiyomi=true";
|
||||
// final data = {"url": url, "headers": getHeader(url)};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return [];
|
||||
// }
|
||||
// return MBridge.jsonPathToString(res, r'$.chapter.images[*].url', '_.')
|
||||
// .split('_.');
|
||||
// }
|
||||
getChapterUrl(MangaModel manga) async {
|
||||
final url = "${manga.apiUrl}/chapter/${manga.link}?tachiyomi=true";
|
||||
final data = {"url": url, "headers": getHeader(url)};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
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;
|
||||
// }
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1,385 +1,385 @@
|
||||
// import 'package:bridge_lib/bridge_lib.dart';
|
||||
// import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
// String getMDXContentRating() {
|
||||
// String ctnRating = MBridge.stringParse(
|
||||
// "&contentRating[]=suggestive&contentRating[]=safe&contentRating[]=erotica&contentRating[]=pornographic");
|
||||
// return ctnRating;
|
||||
// }
|
||||
String getMDXContentRating() {
|
||||
String ctnRating = MBridge.stringParse(
|
||||
"&contentRating[]=suggestive&contentRating[]=safe&contentRating[]=erotica&contentRating[]=pornographic");
|
||||
return ctnRating;
|
||||
}
|
||||
|
||||
// getPopularManga(MangaModel 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, "headers": null};
|
||||
// final res = await MBridge.http(json.encode(datas), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// List<String> data = MBridge.listParse(
|
||||
// MBridge.jsonPathToString(res, r'$.data[*]', '_.').split("_."), 0);
|
||||
// List<String> urlList = [];
|
||||
// List<String> titleList = [];
|
||||
// List<String> imageList = [];
|
||||
// for (var i = 0; i < data.length; i++) {
|
||||
// final expressionId =
|
||||
// MBridge.regExp(r'$.data[a].id', r'\[a\]', "[$i]", 0, 1);
|
||||
// final id = MBridge.jsonPathToString(res, expressionId, '_.');
|
||||
// titleList.add(findTitle(res, i, manga.lang));
|
||||
// urlList.add("/manga/$id");
|
||||
// imageList.add(getCover(res, i, id));
|
||||
// }
|
||||
// manga.names = titleList;
|
||||
// manga.urls = urlList;
|
||||
// manga.images = imageList;
|
||||
// return manga;
|
||||
// }
|
||||
getPopularManga(MangaModel 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, "headers": null};
|
||||
final res = await MBridge.http(json.encode(datas), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
List<String> data = MBridge.listParse(
|
||||
MBridge.jsonPathToString(res, r'$.data[*]', '_.').split("_."), 0);
|
||||
List<String> urlList = [];
|
||||
List<String> titleList = [];
|
||||
List<String> imageList = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
final expressionId =
|
||||
MBridge.regExp(r'$.data[a].id', r'\[a\]', "[$i]", 0, 1);
|
||||
final id = MBridge.jsonPathToString(res, expressionId, '_.');
|
||||
titleList.add(findTitle(res, i, manga.lang));
|
||||
urlList.add("/manga/$id");
|
||||
imageList.add(getCover(res, i, id));
|
||||
}
|
||||
manga.names = titleList;
|
||||
manga.urls = urlList;
|
||||
manga.images = imageList;
|
||||
return manga;
|
||||
}
|
||||
|
||||
// MangaModel getChapters(
|
||||
// MangaModel manga, int length, String paginatedChapterListA) {
|
||||
// String scanlators = MBridge.stringParse("");
|
||||
// String chapNames = MBridge.stringParse("");
|
||||
// String chapDate = MBridge.stringParse("");
|
||||
// String chapterUrl = MBridge.stringParse("");
|
||||
// String paginatedChapterList = MBridge.stringParse(paginatedChapterListA);
|
||||
// final dataList = MBridge.jsonPathToList(paginatedChapterList, r'$.data[*]');
|
||||
// for (var res in dataList) {
|
||||
// String scan = MBridge.stringParse("");
|
||||
// final groups = MBridge.jsonPathToList(
|
||||
// res, r'$.relationships[?@.id!="00e03853-1b96-4f41-9542-c71b8692033b"]');
|
||||
// String chapName = MBridge.stringParse("");
|
||||
// for (var element in groups) {
|
||||
// final data = MBridge.getMapValue(element, "attributes", 1);
|
||||
// if (data.isEmpty) {
|
||||
// } else {
|
||||
// final name = MBridge.getMapValue(data, "name", 0);
|
||||
// scan += MBridge.stringParse("$name");
|
||||
// final username = MBridge.getMapValue(data, "username", 0);
|
||||
// if (username.isEmpty) {
|
||||
// } else {
|
||||
// if (scan.isEmpty) {
|
||||
// scan += MBridge.stringParse("Uploaded by $username");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (scan.isEmpty) {
|
||||
// scan = MBridge.stringParse("No Group");
|
||||
// }
|
||||
// final dataRes = MBridge.getMapValue(res, "attributes", 1);
|
||||
// if (dataRes.isEmpty) {
|
||||
// } else {
|
||||
// final data = MBridge.getMapValue(res, "attributes", 1);
|
||||
// final volume = MBridge.getMapValue(data, "volume", 0);
|
||||
// if (volume.isEmpty) {
|
||||
// } else {
|
||||
// if (volume == "null") {
|
||||
// } else {
|
||||
// chapName = MBridge.stringParse("Vol.$volume ");
|
||||
// }
|
||||
// }
|
||||
// final chapter = MBridge.getMapValue(data, "chapter", 0);
|
||||
// if (chapter.isEmpty) {
|
||||
// } else {
|
||||
// if (chapter == "null") {
|
||||
// } else {
|
||||
// chapName += MBridge.stringParse("Ch.$chapter ");
|
||||
// }
|
||||
// }
|
||||
// final title = MBridge.getMapValue(data, "title", 0);
|
||||
// if (title.isEmpty) {
|
||||
// } else {
|
||||
// if (title == "null") {
|
||||
// } else {
|
||||
// if (chapName.isEmpty) {
|
||||
// } else {
|
||||
// chapName += MBridge.stringParse("- ");
|
||||
// }
|
||||
// chapName += MBridge.stringParse("$title");
|
||||
// }
|
||||
// }
|
||||
// if (chapName.isEmpty) {
|
||||
// chapName += MBridge.stringParse("Oneshot");
|
||||
// }
|
||||
// final date = MBridge.getMapValue(data, "publishAt", 0);
|
||||
// final id = MBridge.getMapValue(res, "id", 0);
|
||||
// chapterUrl += "._$id";
|
||||
// chapDate += "._._$date";
|
||||
// scanlators += "._$scan";
|
||||
// chapNames += "._$chapName";
|
||||
// }
|
||||
// }
|
||||
// manga.chaptersDateUploads = MBridge.listParseDateTime(
|
||||
// chapDate.split("._._"), "yyyy-MM-dd'T'HH:mm:ss+SSS", "en_US");
|
||||
MangaModel getChapters(
|
||||
MangaModel manga, int length, String paginatedChapterListA) {
|
||||
String scanlators = MBridge.stringParse("");
|
||||
String chapNames = MBridge.stringParse("");
|
||||
String chapDate = MBridge.stringParse("");
|
||||
String chapterUrl = MBridge.stringParse("");
|
||||
String paginatedChapterList = MBridge.stringParse(paginatedChapterListA);
|
||||
final dataList = MBridge.jsonPathToList(paginatedChapterList, r'$.data[*]');
|
||||
for (var res in dataList) {
|
||||
String scan = MBridge.stringParse("");
|
||||
final groups = MBridge.jsonPathToList(
|
||||
res, r'$.relationships[?@.id!="00e03853-1b96-4f41-9542-c71b8692033b"]');
|
||||
String chapName = MBridge.stringParse("");
|
||||
for (var element in groups) {
|
||||
final data = MBridge.getMapValue(element, "attributes", 1);
|
||||
if (data.isEmpty) {
|
||||
} else {
|
||||
final name = MBridge.getMapValue(data, "name", 0);
|
||||
scan += MBridge.stringParse("$name");
|
||||
final username = MBridge.getMapValue(data, "username", 0);
|
||||
if (username.isEmpty) {
|
||||
} else {
|
||||
if (scan.isEmpty) {
|
||||
scan += MBridge.stringParse("Uploaded by $username");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (scan.isEmpty) {
|
||||
scan = MBridge.stringParse("No Group");
|
||||
}
|
||||
final dataRes = MBridge.getMapValue(res, "attributes", 1);
|
||||
if (dataRes.isEmpty) {
|
||||
} else {
|
||||
final data = MBridge.getMapValue(res, "attributes", 1);
|
||||
final volume = MBridge.getMapValue(data, "volume", 0);
|
||||
if (volume.isEmpty) {
|
||||
} else {
|
||||
if (volume == "null") {
|
||||
} else {
|
||||
chapName = MBridge.stringParse("Vol.$volume ");
|
||||
}
|
||||
}
|
||||
final chapter = MBridge.getMapValue(data, "chapter", 0);
|
||||
if (chapter.isEmpty) {
|
||||
} else {
|
||||
if (chapter == "null") {
|
||||
} else {
|
||||
chapName += MBridge.stringParse("Ch.$chapter ");
|
||||
}
|
||||
}
|
||||
final title = MBridge.getMapValue(data, "title", 0);
|
||||
if (title.isEmpty) {
|
||||
} else {
|
||||
if (title == "null") {
|
||||
} else {
|
||||
if (chapName.isEmpty) {
|
||||
} else {
|
||||
chapName += MBridge.stringParse("- ");
|
||||
}
|
||||
chapName += MBridge.stringParse("$title");
|
||||
}
|
||||
}
|
||||
if (chapName.isEmpty) {
|
||||
chapName += MBridge.stringParse("Oneshot");
|
||||
}
|
||||
final date = MBridge.getMapValue(data, "publishAt", 0);
|
||||
final id = MBridge.getMapValue(res, "id", 0);
|
||||
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;
|
||||
// }
|
||||
manga.urls = chapterUrl.split("._");
|
||||
manga.chaptersScanlators = scanlators.split("._");
|
||||
manga.names = chapNames.split("._");
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getMangaDetail(MangaModel 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, "headers": null};
|
||||
// final res = await MBridge.http(json.encode(datas), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
getMangaDetail(MangaModel 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, "headers": null};
|
||||
final res = await MBridge.http(json.encode(datas), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
|
||||
// manga.author = MBridge.jsonPathToString(
|
||||
// res, r'$..data.relationships[*].attributes.name', ', ');
|
||||
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 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 = [];
|
||||
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<MangaModel> 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) {
|
||||
// int index = 0;
|
||||
// for (var name in element.names) {
|
||||
// if (name.isEmpty) {
|
||||
// } else {
|
||||
// chapNames.add(name);
|
||||
// chapterUrl.add(element.urls[index]);
|
||||
// chapterDate.add(element.chaptersDateUploads[index]);
|
||||
// scanlators.add(element.chaptersScanlators[index]);
|
||||
// }
|
||||
// index++;
|
||||
// }
|
||||
// }
|
||||
// manga.urls = chapterUrl;
|
||||
// manga.chaptersDateUploads = chapterDate;
|
||||
// manga.chaptersScanlators = scanlators;
|
||||
// manga.names = chapNames;
|
||||
// return manga;
|
||||
// }
|
||||
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<MangaModel> 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) {
|
||||
int index = 0;
|
||||
for (var name in element.names) {
|
||||
if (name.isEmpty) {
|
||||
} else {
|
||||
chapNames.add(name);
|
||||
chapterUrl.add(element.urls[index]);
|
||||
chapterDate.add(element.chaptersDateUploads[index]);
|
||||
scanlators.add(element.chaptersScanlators[index]);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
manga.urls = chapterUrl;
|
||||
manga.chaptersDateUploads = chapterDate;
|
||||
manga.chaptersScanlators = scanlators;
|
||||
manga.names = chapNames;
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getLatestUpdatesManga(MangaModel 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, "headers": null};
|
||||
// final ress = await MBridge.http(json.encode(datas), 0);
|
||||
// if (ress.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// final mangaIds = MBridge.listParse(
|
||||
// MBridge.jsonPathToString(ress, r'$.data[*].relationships[*].id', '.--')
|
||||
// .split('.--'),
|
||||
// 3);
|
||||
// String mangaa = MBridge.stringParse("");
|
||||
// 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, "headers": null};
|
||||
// final res = await MBridge.http(json.encode(datass), 0);
|
||||
// List<String> data = MBridge.listParse(
|
||||
// MBridge.jsonPathToString(res, r'$.data[*]', '_.').split("_."), 0);
|
||||
// List<String> urlList = [];
|
||||
// List<String> titleList = [];
|
||||
// List<String> imageList = [];
|
||||
// for (var i = 0; i < data.length; i++) {
|
||||
// final expressionId =
|
||||
// MBridge.regExp(r'$.data[a].id', r'\[a\]', "[$i]", 0, 1);
|
||||
// final id = MBridge.jsonPathToString(res, expressionId, '_.');
|
||||
// titleList.add(findTitle(res, i, manga.lang));
|
||||
// urlList.add("/manga/$id");
|
||||
// imageList.add(getCover(res, i, id));
|
||||
// }
|
||||
// manga.names = titleList;
|
||||
// manga.urls = urlList;
|
||||
// manga.images = imageList;
|
||||
// return manga;
|
||||
// }
|
||||
getLatestUpdatesManga(MangaModel 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, "headers": null};
|
||||
final ress = await MBridge.http(json.encode(datas), 0);
|
||||
if (ress.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
final mangaIds = MBridge.listParse(
|
||||
MBridge.jsonPathToString(ress, r'$.data[*].relationships[*].id', '.--')
|
||||
.split('.--'),
|
||||
3);
|
||||
String mangaa = MBridge.stringParse("");
|
||||
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, "headers": null};
|
||||
final res = await MBridge.http(json.encode(datass), 0);
|
||||
List<String> data = MBridge.listParse(
|
||||
MBridge.jsonPathToString(res, r'$.data[*]', '_.').split("_."), 0);
|
||||
List<String> urlList = [];
|
||||
List<String> titleList = [];
|
||||
List<String> imageList = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
final expressionId =
|
||||
MBridge.regExp(r'$.data[a].id', r'\[a\]', "[$i]", 0, 1);
|
||||
final id = MBridge.jsonPathToString(res, expressionId, '_.');
|
||||
titleList.add(findTitle(res, i, manga.lang));
|
||||
urlList.add("/manga/$id");
|
||||
imageList.add(getCover(res, i, id));
|
||||
}
|
||||
manga.names = titleList;
|
||||
manga.urls = urlList;
|
||||
manga.images = imageList;
|
||||
return manga;
|
||||
}
|
||||
|
||||
// searchManga(MangaModel 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, "headers": null};
|
||||
// final res = await MBridge.http(json.encode(datas), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// List<String> data = MBridge.listParse(
|
||||
// MBridge.jsonPathToString(res, r'$.data[*]', '_.').split("_."), 0);
|
||||
// List<String> urlList = [];
|
||||
// List<String> titleList = [];
|
||||
// List<String> imageList = [];
|
||||
// for (var i = 0; i < data.length; i++) {
|
||||
// final expressionId =
|
||||
// MBridge.regExp(r'$.data[a].id', r'\[a\]', "[$i]", 0, 1);
|
||||
// final id = MBridge.jsonPathToString(res, expressionId, '_.');
|
||||
// titleList.add(findTitle(res, i, manga.lang));
|
||||
// urlList.add("/manga/$id");
|
||||
// imageList.add(getCover(res, i, id));
|
||||
// }
|
||||
// manga.names = titleList;
|
||||
// manga.urls = urlList;
|
||||
// manga.images = imageList;
|
||||
// return manga;
|
||||
// }
|
||||
searchManga(MangaModel 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, "headers": null};
|
||||
final res = await MBridge.http(json.encode(datas), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
List<String> data = MBridge.listParse(
|
||||
MBridge.jsonPathToString(res, r'$.data[*]', '_.').split("_."), 0);
|
||||
List<String> urlList = [];
|
||||
List<String> titleList = [];
|
||||
List<String> imageList = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
final expressionId =
|
||||
MBridge.regExp(r'$.data[a].id', r'\[a\]', "[$i]", 0, 1);
|
||||
final id = MBridge.jsonPathToString(res, expressionId, '_.');
|
||||
titleList.add(findTitle(res, i, manga.lang));
|
||||
urlList.add("/manga/$id");
|
||||
imageList.add(getCover(res, i, id));
|
||||
}
|
||||
manga.names = titleList;
|
||||
manga.urls = urlList;
|
||||
manga.images = imageList;
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getChapterUrl(MangaModel manga) async {
|
||||
// final url = "https://api.mangadex.org/at-home/server/${manga.link}";
|
||||
// final data = {"url": url, "headers": null};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return [];
|
||||
// }
|
||||
// final host = MBridge.jsonPathToString(res, r'$.baseUrl', '');
|
||||
// final hash = MBridge.jsonPathToString(res, r'$.chapter.hash', '');
|
||||
// List<String> pageSuffix = [];
|
||||
// List<String> pageUrls = [];
|
||||
// List<String> chapterDatas = MBridge.listParse(
|
||||
// MBridge.jsonPathToString(res, r'$.chapter.data[*]', '.--').split('.--'),
|
||||
// 0);
|
||||
// for (var d in chapterDatas) {
|
||||
// pageSuffix.add("/data/$hash/$d");
|
||||
// }
|
||||
// for (var url in pageSuffix) {
|
||||
// pageUrls.add("$host$url");
|
||||
// }
|
||||
getChapterUrl(MangaModel manga) async {
|
||||
final url = "https://api.mangadex.org/at-home/server/${manga.link}";
|
||||
final data = {"url": url, "headers": null};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
final host = MBridge.jsonPathToString(res, r'$.baseUrl', '');
|
||||
final hash = MBridge.jsonPathToString(res, r'$.chapter.hash', '');
|
||||
List<String> pageSuffix = [];
|
||||
List<String> pageUrls = [];
|
||||
List<String> chapterDatas = MBridge.listParse(
|
||||
MBridge.jsonPathToString(res, r'$.chapter.data[*]', '.--').split('.--'),
|
||||
0);
|
||||
for (var d in chapterDatas) {
|
||||
pageSuffix.add("/data/$hash/$d");
|
||||
}
|
||||
for (var url in pageSuffix) {
|
||||
pageUrls.add("$host$url");
|
||||
}
|
||||
|
||||
// return pageUrls;
|
||||
// }
|
||||
return pageUrls;
|
||||
}
|
||||
|
||||
// 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, "headers": null};
|
||||
// return await MBridge.http(json.encode(datas), 0);
|
||||
// }
|
||||
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, "headers": null};
|
||||
return await MBridge.http(json.encode(datas), 0);
|
||||
}
|
||||
|
||||
// String findTitle(String dataRes, int mangaIndex, String lang) {
|
||||
// String expressionAltTitlesA = MBridge.regExp(
|
||||
// r'$.data[a].attributes.altTitles[b]', r'\[a\]', "[$mangaIndex]", 0, 1);
|
||||
// String expressionAltTitles =
|
||||
// MBridge.regExp(expressionAltTitlesA, r'\[b\]', "[*].$lang", 0, 1);
|
||||
String findTitle(String dataRes, int mangaIndex, String lang) {
|
||||
String expressionAltTitlesA = MBridge.regExp(
|
||||
r'$.data[a].attributes.altTitles[b]', r'\[a\]', "[$mangaIndex]", 0, 1);
|
||||
String expressionAltTitles =
|
||||
MBridge.regExp(expressionAltTitlesA, r'\[b\]', "[*].$lang", 0, 1);
|
||||
|
||||
// String altTitles =
|
||||
// MBridge.jsonPathToString(dataRes, expressionAltTitles, '_.');
|
||||
String altTitles =
|
||||
MBridge.jsonPathToString(dataRes, expressionAltTitles, '_.');
|
||||
|
||||
// if (altTitles.isEmpty) {
|
||||
// expressionAltTitles = MBridge.regExp(
|
||||
// r'$.data[a].attributes.altTitles[?@.en].en',
|
||||
// r'\[a\]',
|
||||
// "[$mangaIndex]",
|
||||
// 0,
|
||||
// 1);
|
||||
// altTitles = MBridge.jsonPathToString(dataRes, expressionAltTitles, '_.');
|
||||
// }
|
||||
// List<String> dataAltTitles = MBridge.listParse(altTitles.split('_.'), 0);
|
||||
// final expressionTitle = MBridge.regExp(
|
||||
// r'$.data[a].attributes.title.en', r'\[a\]', "[$mangaIndex]", 0, 1);
|
||||
// final title = MBridge.jsonPathToString(dataRes, expressionTitle, '_.');
|
||||
// if (title.isEmpty) {
|
||||
// return dataAltTitles[0];
|
||||
// } else {
|
||||
// return title;
|
||||
// }
|
||||
// }
|
||||
if (altTitles.isEmpty) {
|
||||
expressionAltTitles = MBridge.regExp(
|
||||
r'$.data[a].attributes.altTitles[?@.en].en',
|
||||
r'\[a\]',
|
||||
"[$mangaIndex]",
|
||||
0,
|
||||
1);
|
||||
altTitles = MBridge.jsonPathToString(dataRes, expressionAltTitles, '_.');
|
||||
}
|
||||
List<String> dataAltTitles = MBridge.listParse(altTitles.split('_.'), 0);
|
||||
final expressionTitle = MBridge.regExp(
|
||||
r'$.data[a].attributes.title.en', r'\[a\]', "[$mangaIndex]", 0, 1);
|
||||
final title = MBridge.jsonPathToString(dataRes, expressionTitle, '_.');
|
||||
if (title.isEmpty) {
|
||||
return dataAltTitles[0];
|
||||
} else {
|
||||
return title;
|
||||
}
|
||||
}
|
||||
|
||||
// String getCover(String dataRes, int mangaIndex, String mangaId) {
|
||||
// final expressionRelationAll = MBridge.regExp(
|
||||
// r'$.data[a].relationships[*]', r'\[a\]', "[$mangaIndex]", 0, 1);
|
||||
// List<String> relationDatas = MBridge.listParse(
|
||||
// MBridge.jsonPathToString(dataRes, expressionRelationAll, '_.')
|
||||
// .split("_."),
|
||||
// 0);
|
||||
// String coverFileName = MBridge.stringParse("");
|
||||
// for (var j = 0; j < relationDatas.length; j++) {
|
||||
// final expressionData = MBridge.regExp(
|
||||
// r'$.data[a].relationships[b]', r'\[a\]', "[$mangaIndex]", 0, 1);
|
||||
// final expressionRelationType =
|
||||
// MBridge.regExp(expressionData, r'\[b\]', "[$j].type", 0, 1);
|
||||
// final relationType =
|
||||
// MBridge.jsonPathToString(dataRes, expressionRelationType, '');
|
||||
// if (relationType == "cover_art") {
|
||||
// if (coverFileName.isEmpty) {
|
||||
// final expressionRelationCoverFile = MBridge.regExp(
|
||||
// expressionData, r'\[b\]', "[$j].attributes.fileName", 0, 1);
|
||||
// coverFileName =
|
||||
// MBridge.jsonPathToString(dataRes, expressionRelationCoverFile, '');
|
||||
String getCover(String dataRes, int mangaIndex, String mangaId) {
|
||||
final expressionRelationAll = MBridge.regExp(
|
||||
r'$.data[a].relationships[*]', r'\[a\]', "[$mangaIndex]", 0, 1);
|
||||
List<String> relationDatas = MBridge.listParse(
|
||||
MBridge.jsonPathToString(dataRes, expressionRelationAll, '_.')
|
||||
.split("_."),
|
||||
0);
|
||||
String coverFileName = MBridge.stringParse("");
|
||||
for (var j = 0; j < relationDatas.length; j++) {
|
||||
final expressionData = MBridge.regExp(
|
||||
r'$.data[a].relationships[b]', r'\[a\]', "[$mangaIndex]", 0, 1);
|
||||
final expressionRelationType =
|
||||
MBridge.regExp(expressionData, r'\[b\]', "[$j].type", 0, 1);
|
||||
final relationType =
|
||||
MBridge.jsonPathToString(dataRes, expressionRelationType, '');
|
||||
if (relationType == "cover_art") {
|
||||
if (coverFileName.isEmpty) {
|
||||
final expressionRelationCoverFile = MBridge.regExp(
|
||||
expressionData, r'\[b\]', "[$j].attributes.fileName", 0, 1);
|
||||
coverFileName =
|
||||
MBridge.jsonPathToString(dataRes, expressionRelationCoverFile, '');
|
||||
|
||||
// coverFileName =
|
||||
// "https://uploads.mangadex.org/covers/$mangaId/$coverFileName";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return coverFileName;
|
||||
// }
|
||||
coverFileName =
|
||||
"https://uploads.mangadex.org/covers/$mangaId/$coverFileName";
|
||||
}
|
||||
}
|
||||
}
|
||||
return coverFileName;
|
||||
}
|
||||
|
||||
@@ -1,210 +1,210 @@
|
||||
// import 'dart:convert';
|
||||
// import 'package:bridge_lib/bridge_lib.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
// searchManga(MangaModel manga) async {
|
||||
// final headers = getHeader(manga.baseUrl);
|
||||
// final url = "${manga.baseUrl}/search?title=${manga.query}&page=${manga.page}";
|
||||
searchManga(MangaModel manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
final url = "${manga.baseUrl}/search?title=${manga.query}&page=${manga.page}";
|
||||
|
||||
// final data = {"url": url, "headers": headers};
|
||||
// final res = await MBridge.http(json.encode(data), 1);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await MBridge.http(json.encode(data), 1);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
|
||||
// manga.names = MBridge.xpath(
|
||||
// res, '//*[contains(@class, "manga-list-4-list")]/li/a/@title', '-.')
|
||||
// .split('-.');
|
||||
// manga.images = MBridge.xpath(
|
||||
// res,
|
||||
// '//*[contains(@class, "manga-list-4-list")]/li/a/img[@class="manga-list-4-cover"]/@src',
|
||||
// '-.')
|
||||
// .split('-.');
|
||||
// manga.urls = MBridge.xpath(
|
||||
// res, '//*[contains(@class, "manga-list-4-list")]/li/a/@href', '-.')
|
||||
// .split('-.');
|
||||
// return manga;
|
||||
// }
|
||||
manga.names = MBridge.xpath(
|
||||
res, '//*[contains(@class, "manga-list-4-list")]/li/a/@title', '-.')
|
||||
.split('-.');
|
||||
manga.images = MBridge.xpath(
|
||||
res,
|
||||
'//*[contains(@class, "manga-list-4-list")]/li/a/img[@class="manga-list-4-cover"]/@src',
|
||||
'-.')
|
||||
.split('-.');
|
||||
manga.urls = MBridge.xpath(
|
||||
res, '//*[contains(@class, "manga-list-4-list")]/li/a/@href', '-.')
|
||||
.split('-.');
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getLatestUpdatesManga(MangaModel manga) async {
|
||||
// final headers = getHeader(manga.baseUrl);
|
||||
// final url = "${manga.baseUrl}/directory/${manga.page}.htm?latest";
|
||||
getLatestUpdatesManga(MangaModel manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
final url = "${manga.baseUrl}/directory/${manga.page}.htm?latest";
|
||||
|
||||
// final data = {"url": url, "headers": headers};
|
||||
// final res = await MBridge.http(json.encode(data), 1);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await MBridge.http(json.encode(data), 1);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
|
||||
// manga.names = MBridge.xpath(
|
||||
// res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@title', '-.')
|
||||
// .split('-.');
|
||||
// manga.images = MBridge.xpath(
|
||||
// res,
|
||||
// '//*[ contains(@class, "manga-list-1-list")]/li/a/img[@class="manga-list-1-cover"]/@src',
|
||||
// '-.')
|
||||
// .split('-.');
|
||||
// manga.urls = MBridge.xpath(
|
||||
// res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@href', '-.')
|
||||
// .split('-.');
|
||||
// return manga;
|
||||
// }
|
||||
manga.names = MBridge.xpath(
|
||||
res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@title', '-.')
|
||||
.split('-.');
|
||||
manga.images = MBridge.xpath(
|
||||
res,
|
||||
'//*[ contains(@class, "manga-list-1-list")]/li/a/img[@class="manga-list-1-cover"]/@src',
|
||||
'-.')
|
||||
.split('-.');
|
||||
manga.urls = MBridge.xpath(
|
||||
res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@href', '-.')
|
||||
.split('-.');
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getMangaDetail(MangaModel manga) async {
|
||||
// final statusList = [
|
||||
// {
|
||||
// "Ongoing": 0,
|
||||
// "Completed": 1,
|
||||
// }
|
||||
// ];
|
||||
// final headers = getHeader(manga.baseUrl);
|
||||
// final url = "${manga.baseUrl}/${manga.link}";
|
||||
// final data = {"url": url, "headers": headers};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
// manga.author =
|
||||
// MBridge.xpath(res, '//*[@class="detail-info-right-say"]/a/text()', '');
|
||||
// manga.description =
|
||||
// MBridge.xpath(res, '//*[@class="fullcontent"]/text()', '');
|
||||
// final status = MBridge.xpath(
|
||||
// res, '//*[@class="detail-info-right-title-tip"]/text()', '');
|
||||
// manga.status = MBridge.parseStatus(status, statusList);
|
||||
// manga.genre = MBridge.xpath(
|
||||
// res, '//*[@class="detail-info-right-tag-list"]/a/text()', '._')
|
||||
// .split("._");
|
||||
// manga.urls =
|
||||
// MBridge.xpath(res, '//*[@class="detail-main-list"]/li/a/@href', '._')
|
||||
// .split("._");
|
||||
// manga.names = MBridge.xpath(
|
||||
// res,
|
||||
// '//*[@class="detail-main-list"]/li/a/div/p[@class="title3"]/text()',
|
||||
// '._')
|
||||
// .split("._");
|
||||
// final chapterDates = MBridge.xpath(
|
||||
// res,
|
||||
// '//*[@class="detail-main-list"]/li/a/div/p[@class="title2"]/text()',
|
||||
// '._')
|
||||
// .split("._");
|
||||
getMangaDetail(MangaModel manga) async {
|
||||
final statusList = [
|
||||
{
|
||||
"Ongoing": 0,
|
||||
"Completed": 1,
|
||||
}
|
||||
];
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
final url = "${manga.baseUrl}/${manga.link}";
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
manga.author =
|
||||
MBridge.xpath(res, '//*[@class="detail-info-right-say"]/a/text()', '');
|
||||
manga.description =
|
||||
MBridge.xpath(res, '//*[@class="fullcontent"]/text()', '');
|
||||
final status = MBridge.xpath(
|
||||
res, '//*[@class="detail-info-right-title-tip"]/text()', '');
|
||||
manga.status = MBridge.parseStatus(status, statusList);
|
||||
manga.genre = MBridge.xpath(
|
||||
res, '//*[@class="detail-info-right-tag-list"]/a/text()', '._')
|
||||
.split("._");
|
||||
manga.urls =
|
||||
MBridge.xpath(res, '//*[@class="detail-main-list"]/li/a/@href', '._')
|
||||
.split("._");
|
||||
manga.names = MBridge.xpath(
|
||||
res,
|
||||
'//*[@class="detail-main-list"]/li/a/div/p[@class="title3"]/text()',
|
||||
'._')
|
||||
.split("._");
|
||||
final chapterDates = MBridge.xpath(
|
||||
res,
|
||||
'//*[@class="detail-main-list"]/li/a/div/p[@class="title2"]/text()',
|
||||
'._')
|
||||
.split("._");
|
||||
|
||||
// manga.chaptersDateUploads = MBridge.listParse(
|
||||
// MBridge.listParseDateTime(
|
||||
// chapterDates, manga.dateFormat, manga.dateFormatLocale),
|
||||
// 0);
|
||||
// return manga;
|
||||
// }
|
||||
manga.chaptersDateUploads = MBridge.listParse(
|
||||
MBridge.listParseDateTime(
|
||||
chapterDates, manga.dateFormat, manga.dateFormatLocale),
|
||||
0);
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getPopularManga(MangaModel manga) async {
|
||||
// final headers = getHeader(manga.baseUrl);
|
||||
// final url = "${manga.baseUrl}/directory/${manga.page}.htm";
|
||||
getPopularManga(MangaModel manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
final url = "${manga.baseUrl}/directory/${manga.page}.htm";
|
||||
|
||||
// final data = {"url": url, "headers": headers};
|
||||
// final res = await MBridge.http(json.encode(data), 1);
|
||||
// if (res.isEmpty) {
|
||||
// return manga;
|
||||
// }
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await MBridge.http(json.encode(data), 1);
|
||||
if (res.isEmpty) {
|
||||
return manga;
|
||||
}
|
||||
|
||||
// manga.names = MBridge.xpath(
|
||||
// res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@title', '-.')
|
||||
// .split('-.');
|
||||
// manga.images = MBridge.xpath(
|
||||
// res,
|
||||
// '//*[ contains(@class, "manga-list-1-list")]/li/a/img[@class="manga-list-1-cover"]/@src',
|
||||
// '-.')
|
||||
// .split('-.');
|
||||
// manga.urls = MBridge.xpath(
|
||||
// res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@href', '-.')
|
||||
// .split('-.');
|
||||
// return manga;
|
||||
// }
|
||||
manga.names = MBridge.xpath(
|
||||
res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@title', '-.')
|
||||
.split('-.');
|
||||
manga.images = MBridge.xpath(
|
||||
res,
|
||||
'//*[ contains(@class, "manga-list-1-list")]/li/a/img[@class="manga-list-1-cover"]/@src',
|
||||
'-.')
|
||||
.split('-.');
|
||||
manga.urls = MBridge.xpath(
|
||||
res, '//*[ contains(@class, "manga-list-1-list")]/li/a/@href', '-.')
|
||||
.split('-.');
|
||||
return manga;
|
||||
}
|
||||
|
||||
// getChapterUrl(MangaModel manga) async {
|
||||
// final headers = getHeader(manga.baseUrl);
|
||||
// final url = "${manga.baseUrl}${manga.link}";
|
||||
// final data = {"url": url, "headers": headers};
|
||||
// final res = await MBridge.http(json.encode(data), 0);
|
||||
// if (res.isEmpty) {
|
||||
// return [];
|
||||
// }
|
||||
// final pages = MBridge.xpath(res, "//body/div/div/span/a/text()", "._");
|
||||
// List<String> pageUrls = [];
|
||||
// if (pages.isEmpty) {
|
||||
// final script = MBridge.xpath(res,
|
||||
// "//script[contains(text(),'function(p,a,c,k,e,d)')]/text()", "")
|
||||
// .replaceAll("eval", "");
|
||||
// String deobfuscatedScript = MBridge.evalJs(script);
|
||||
// int a = deobfuscatedScript.indexOf("newImgs=['") + 10;
|
||||
// int b = deobfuscatedScript.indexOf("'];");
|
||||
// List<String> urls =
|
||||
// MBridge.listParse(deobfuscatedScript.substring(a, b).split("','"), 0);
|
||||
// for (var url in urls) {
|
||||
// pageUrls.add("https:$url");
|
||||
// }
|
||||
// } else {
|
||||
// final pagesNumberList = MBridge.listParse(pages.split("._"), 0);
|
||||
// //manga.status objext is used to parse pagesNumber value to int
|
||||
// manga.status =
|
||||
// MBridge.intParse(pagesNumberList[pagesNumberList.length - 2]);
|
||||
// int secretKeyScriptLocation = res.indexOf("eval(function(p,a,c,k,e,d)");
|
||||
// int secretKeyScriptEndLocation =
|
||||
// res.indexOf("</script>", secretKeyScriptLocation);
|
||||
// String secretKeyScript = res
|
||||
// .substring(secretKeyScriptLocation, secretKeyScriptEndLocation)
|
||||
// .replaceAll("eval", "");
|
||||
// String secretKeyDeobfuscatedScript = MBridge.evalJs(secretKeyScript);
|
||||
// int secretKeyStartLoc = secretKeyDeobfuscatedScript.indexOf("'");
|
||||
// int secretKeyEndLoc = secretKeyDeobfuscatedScript.indexOf(";");
|
||||
getChapterUrl(MangaModel manga) async {
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
final url = "${manga.baseUrl}${manga.link}";
|
||||
final data = {"url": url, "headers": headers};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
final pages = MBridge.xpath(res, "//body/div/div/span/a/text()", "._");
|
||||
List<String> pageUrls = [];
|
||||
if (pages.isEmpty) {
|
||||
final script = MBridge.xpath(res,
|
||||
"//script[contains(text(),'function(p,a,c,k,e,d)')]/text()", "")
|
||||
.replaceAll("eval", "");
|
||||
String deobfuscatedScript = MBridge.evalJs(script);
|
||||
int a = deobfuscatedScript.indexOf("newImgs=['") + 10;
|
||||
int b = deobfuscatedScript.indexOf("'];");
|
||||
List<String> urls =
|
||||
MBridge.listParse(deobfuscatedScript.substring(a, b).split("','"), 0);
|
||||
for (var url in urls) {
|
||||
pageUrls.add("https:$url");
|
||||
}
|
||||
} else {
|
||||
final pagesNumberList = MBridge.listParse(pages.split("._"), 0);
|
||||
//manga.status objext is used to parse pagesNumber value to int
|
||||
manga.status =
|
||||
MBridge.intParse(pagesNumberList[pagesNumberList.length - 2]);
|
||||
int secretKeyScriptLocation = res.indexOf("eval(function(p,a,c,k,e,d)");
|
||||
int secretKeyScriptEndLocation =
|
||||
res.indexOf("</script>", secretKeyScriptLocation);
|
||||
String secretKeyScript = res
|
||||
.substring(secretKeyScriptLocation, secretKeyScriptEndLocation)
|
||||
.replaceAll("eval", "");
|
||||
String secretKeyDeobfuscatedScript = MBridge.evalJs(secretKeyScript);
|
||||
int secretKeyStartLoc = secretKeyDeobfuscatedScript.indexOf("'");
|
||||
int secretKeyEndLoc = secretKeyDeobfuscatedScript.indexOf(";");
|
||||
|
||||
// String secretKey = secretKeyDeobfuscatedScript.substring(
|
||||
// secretKeyStartLoc, secretKeyEndLoc);
|
||||
// int chapterIdStartLoc = res.indexOf("chapterid");
|
||||
// String chapterId = res.substring(
|
||||
// chapterIdStartLoc + 11, res.indexOf(";", chapterIdStartLoc));
|
||||
// String pageBase = url.substring(0, url.lastIndexOf("/"));
|
||||
// for (int i = 1; i <= manga.status; i++) {
|
||||
// String pageLink =
|
||||
// "$pageBase/chapterfun.ashx?cid=$chapterId&page=$i&key=$secretKey";
|
||||
// String responseText = MBridge.stringParse("");
|
||||
// for (int tr = 1; tr <= 3; tr++) {
|
||||
// if (responseText.isEmpty) {
|
||||
// final headers = {
|
||||
// "Referer": url,
|
||||
// "Accept": "*/*",
|
||||
// "Accept-Language": "en-US,en;q=0.9",
|
||||
// "Connection": "keep-alive",
|
||||
// "Host": "www.mangahere.cc",
|
||||
// "X-Requested-With": "XMLHttpRequest"
|
||||
// };
|
||||
// final data = {"url": pageLink, "headers": headers};
|
||||
// final response = await MBridge.http(json.encode(data), 0);
|
||||
// responseText = MBridge.stringParse(response);
|
||||
String secretKey = secretKeyDeobfuscatedScript.substring(
|
||||
secretKeyStartLoc, secretKeyEndLoc);
|
||||
int chapterIdStartLoc = res.indexOf("chapterid");
|
||||
String chapterId = res.substring(
|
||||
chapterIdStartLoc + 11, res.indexOf(";", chapterIdStartLoc));
|
||||
String pageBase = url.substring(0, url.lastIndexOf("/"));
|
||||
for (int i = 1; i <= manga.status; i++) {
|
||||
String pageLink =
|
||||
"$pageBase/chapterfun.ashx?cid=$chapterId&page=$i&key=$secretKey";
|
||||
String responseText = MBridge.stringParse("");
|
||||
for (int tr = 1; tr <= 3; tr++) {
|
||||
if (responseText.isEmpty) {
|
||||
final headers = {
|
||||
"Referer": url,
|
||||
"Accept": "*/*",
|
||||
"Accept-Language": "en-US,en;q=0.9",
|
||||
"Connection": "keep-alive",
|
||||
"Host": "www.mangahere.cc",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
};
|
||||
final data = {"url": pageLink, "headers": headers};
|
||||
final response = await MBridge.http(json.encode(data), 0);
|
||||
responseText = MBridge.stringParse(response);
|
||||
|
||||
// if (responseText.isEmpty) {
|
||||
// secretKey = "";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// String deobfuscatedScript =
|
||||
// MBridge.evalJs(responseText.replaceAll("eval", ""));
|
||||
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 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");
|
||||
// }
|
||||
// }
|
||||
int imageLinkStartPos = deobfuscatedScript.indexOf("pvalue=") + 9;
|
||||
int imageLinkEndPos = deobfuscatedScript.indexOf("\"", imageLinkStartPos);
|
||||
String imageLink =
|
||||
deobfuscatedScript.substring(imageLinkStartPos, imageLinkEndPos);
|
||||
pageUrls.add("https:$baseLink$imageLink");
|
||||
}
|
||||
}
|
||||
|
||||
// return pageUrls;
|
||||
// }
|
||||
return pageUrls;
|
||||
}
|
||||
|
||||
// Map<String, String> getHeader(String url) {
|
||||
// final headers = {'Referer': '$url/', "Cookie": "isAdult=1"};
|
||||
// return headers;
|
||||
// }
|
||||
Map<String, String> getHeader(String url) {
|
||||
final headers = {'Referer': '$url/', "Cookie": "isAdult=1"};
|
||||
return headers;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user