mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 19:01:15 +00:00
anime source : gogoanime
This commit is contained in:
138
manga/src/all/comick/comick-v0.0.1.dart
Normal file
138
manga/src/all/comick/comick-v0.0.1.dart
Normal file
@@ -0,0 +1,138 @@
|
||||
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;
|
||||
}
|
||||
|
||||
getMangaDetail(MangaModel manga) async {
|
||||
final statusList = [
|
||||
{
|
||||
"1": 0,
|
||||
"2": 1,
|
||||
"3": 3,
|
||||
"4": 2,
|
||||
}
|
||||
];
|
||||
|
||||
final headers = getHeader(manga.baseUrl);
|
||||
|
||||
final urll =
|
||||
"${manga.apiUrl}${manga.link.replaceAll("#", '')}?tachiyomi=true";
|
||||
final data = {"url": urll, "headers": headers};
|
||||
final 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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
222
manga/src/all/comick/sources.dart
Normal file
222
manga/src/all/comick/sources.dart
Normal file
@@ -0,0 +1,222 @@
|
||||
|
||||
import '../../../../model/source.dart';
|
||||
|
||||
const comickVersion = "0.0.1";
|
||||
const comickSourceCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/src/all/comick/comick-v$comickVersion.dart";
|
||||
|
||||
const defaultDateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
||||
const defaultDateFormatLocale = "en";
|
||||
|
||||
const iconUrl =
|
||||
'https://comick.app/_next/image?url=%2Fstatic%2Ficons%2Funicorn-64.png&w=144&q=75';
|
||||
const apiUrl = 'https://api.comick.fun';
|
||||
const baseUrl = 'https://comick.app';
|
||||
const isNsfw = true;
|
||||
List<Source> get comickSourcesList => _comickSourcesList;
|
||||
List<Source> _comickSourcesList = [
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'en',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'ar',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'pt',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'pt-br',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'it',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'ru',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'es',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'es-419',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'id',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'hi',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'de',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'ja',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'tr',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'pl',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'zh',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'zh-hk',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
Source(
|
||||
name: 'Comick',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'fr',
|
||||
typeSource: "comick",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: defaultDateFormat,
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: defaultDateFormatLocale,
|
||||
version: comickVersion,
|
||||
sourceCodeUrl: comickSourceCodeUrl),
|
||||
];
|
||||
407
manga/src/all/mangadex/mangadex-v0.0.11.dart
Normal file
407
manga/src/all/mangadex/mangadex-v0.0.11.dart
Normal file
@@ -0,0 +1,407 @@
|
||||
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;
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
manga.author = MBridge.jsonPathToString(
|
||||
res, r'$..data.relationships[*].attributes.name', ', ');
|
||||
|
||||
String expressionDescriptionA = r'$..data.attributes.description.en';
|
||||
String expressionDescription = MBridge.regExp(
|
||||
r'$..data.attributes.description[a]', r'\[a\]', ".${manga.lang}", 0, 1);
|
||||
|
||||
String description = MBridge.jsonPathToString(res, expressionDescription, '');
|
||||
if (description.isEmpty) {
|
||||
description = MBridge.jsonPathToString(res, expressionDescriptionA, '');
|
||||
}
|
||||
manga.description = description;
|
||||
List<String> genres = [];
|
||||
|
||||
final genre = MBridge.listParse(
|
||||
MBridge.jsonPathToString(
|
||||
res, r'$..data.attributes.tags[*].attributes.name.en', '.-')
|
||||
.split('.-'),
|
||||
0);
|
||||
genres = genre;
|
||||
String contentRating =
|
||||
MBridge.jsonPathToString(res, r'$..data.attributes.contentRating', '');
|
||||
if (contentRating == "safe") {
|
||||
} else {
|
||||
genres.add(contentRating);
|
||||
}
|
||||
String publicationDemographic = MBridge.jsonPathToString(
|
||||
res, r'$..data.attributes.publicationDemographic', '');
|
||||
if (publicationDemographic == "null") {
|
||||
} else {
|
||||
genres.add(publicationDemographic);
|
||||
}
|
||||
manga.genre = genres;
|
||||
String statusRes =
|
||||
MBridge.jsonPathToString(res, r'$..data.attributes.status', '');
|
||||
manga.status = MBridge.parseStatus(statusRes, statusList);
|
||||
final mangaId = MBridge.listParse(manga.link.split('/'), 2)[0];
|
||||
final paginatedChapterList =
|
||||
await paginatedChapterListRequest(mangaId, 0, manga.lang);
|
||||
final chapterList =
|
||||
MBridge.jsonPathToString(paginatedChapterList, r'$.data[*]', '_.')
|
||||
.split('_.');
|
||||
int limit = MBridge.intParse(
|
||||
MBridge.jsonPathToString(paginatedChapterList, r'$.limit', ''));
|
||||
int offset = MBridge.intParse(
|
||||
MBridge.jsonPathToString(paginatedChapterList, r'$.offset', ''));
|
||||
int total = MBridge.intParse(
|
||||
MBridge.jsonPathToString(paginatedChapterList, r'$.total', ''));
|
||||
List<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) {
|
||||
for (var name in element.names) {
|
||||
if (name.isEmpty) {
|
||||
} else {
|
||||
chapNames.add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var element in chapterListA) {
|
||||
for (var url in element.urls) {
|
||||
if (url.isEmpty) {
|
||||
} else {
|
||||
chapterUrl.add(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var element in chapterListA) {
|
||||
for (var chapDate in element.chaptersDateUploads) {
|
||||
if (chapDate.isEmpty) {
|
||||
} else {
|
||||
chapterDate.add(chapDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var element in chapterListA) {
|
||||
for (var scanlator in element.chaptersScanlators) {
|
||||
if (scanlator.isEmpty) {
|
||||
} else {
|
||||
scanlators.add(scanlator);
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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, '_.');
|
||||
|
||||
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, '');
|
||||
|
||||
coverFileName =
|
||||
"https://uploads.mangadex.org/covers/$mangaId/$coverFileName";
|
||||
}
|
||||
}
|
||||
}
|
||||
return coverFileName;
|
||||
}
|
||||
218
manga/src/all/mangadex/sources.dart
Normal file
218
manga/src/all/mangadex/sources.dart
Normal file
@@ -0,0 +1,218 @@
|
||||
|
||||
|
||||
import '../../../../model/source.dart';
|
||||
|
||||
const apiUrl = 'https://api.mangadex.org';
|
||||
const baseUrl = 'https://mangadex.org';
|
||||
const isNsfw = true;
|
||||
const mangadexVersion = "0.0.11";
|
||||
const mangadexSourceCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/src/all/mangadex/mangadex-v$mangadexVersion.dart";
|
||||
const iconUrl = '';
|
||||
List<Source> get mangaDexSourcesList => _mangaDexSourcesList;
|
||||
List<Source> _mangaDexSourcesList = [
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'en',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'ar',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'pt',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'pt-br',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'it',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'ru',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'es',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'es-419',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'id',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'hi',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'de',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'ja',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'tr',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'pl',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'zh',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'zh-hk',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
Source(
|
||||
name: 'MangaDex',
|
||||
apiUrl: apiUrl,
|
||||
baseUrl: baseUrl,
|
||||
lang: 'fr',
|
||||
typeSource: "mangadex",
|
||||
iconUrl: iconUrl,
|
||||
dateFormat: "yyyy-MM-dd'T'HH:mm:ss+SSS",
|
||||
isNsfw: isNsfw,
|
||||
dateFormatLocale: 'en_Us',
|
||||
version: mangadexVersion,
|
||||
sourceCodeUrl: mangadexSourceCodeUrl),
|
||||
];
|
||||
Reference in New Issue
Block a user