mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
New source (Multi: NepNep)
This commit is contained in:
BIN
icons/mangayomi-en-mangalife.png
Normal file
BIN
icons/mangayomi-en-mangalife.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
icons/mangayomi-en-mangasee.png
Normal file
BIN
icons/mangayomi-en-mangasee.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
File diff suppressed because one or more lines are too long
215
manga/multisrc/nepnep/nepnep-v0.0.1.dart
Normal file
215
manga/multisrc/nepnep/nepnep-v0.0.1.dart
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'package:bridge_lib/bridge_lib.dart';
|
||||||
|
|
||||||
|
getPopularManga(MangaModel manga) async {
|
||||||
|
final data = {"url": "${manga.baseUrl}/search/"};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
final directory = directoryFromDocument(res);
|
||||||
|
final resSort = MBridge.sortMapList(json.decode(directory), "vm", 1);
|
||||||
|
|
||||||
|
return parseDirectory(resSort, manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
getLatestUpdatesManga(MangaModel manga) async {
|
||||||
|
final data = {"url": "${manga.baseUrl}/search/"};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
final directory = directoryFromDocument(res);
|
||||||
|
final resSort = MBridge.sortMapList(json.decode(directory), "lt", 1);
|
||||||
|
|
||||||
|
return parseDirectory(resSort, manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
searchManga(MangaModel manga) async {
|
||||||
|
final data = {"url": "${manga.baseUrl}/search/"};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
final directory = directoryFromDocument(res);
|
||||||
|
final resSort = MBridge.sortMapList(json.decode(directory), "lt", 1);
|
||||||
|
final datas = json.decode(resSort) as List;
|
||||||
|
final queryRes = datas.where((e) {
|
||||||
|
String name = e['s'];
|
||||||
|
return name.toLowerCase().contains(manga.query.toLowerCase());
|
||||||
|
}).toList();
|
||||||
|
manga.hasNextPage = false;
|
||||||
|
if (queryRes.length > 50) {
|
||||||
|
manga.hasNextPage = true;
|
||||||
|
}
|
||||||
|
return parseDirectory(json.encode(queryRes), manga);
|
||||||
|
}
|
||||||
|
|
||||||
|
getMangaDetail(MangaModel manga) async {
|
||||||
|
final statusList = [
|
||||||
|
{"Ongoing": 0, "Completed": 1, "Cancelled": 3, "Hiatus": 2}
|
||||||
|
];
|
||||||
|
final headers = getHeader(manga.baseUrl);
|
||||||
|
final url = '${manga.baseUrl}/manga/${manga.link}';
|
||||||
|
final data = {"url": url, "headers": headers};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
if (res.isEmpty) {
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
manga.author = MBridge.xpath(res,
|
||||||
|
'//li[contains(@class,"list-group-item") and contains(text(),"Author")]/a/text()')
|
||||||
|
.first;
|
||||||
|
manga.description = MBridge.xpath(res,
|
||||||
|
'//li[contains(@class,"list-group-item") and contains(text(),"Description:")]/div/text()')
|
||||||
|
.first;
|
||||||
|
final status = MBridge.xpath(res,
|
||||||
|
'//li[contains(@class,"list-group-item") and contains(text(),"Status")]/a/text()')
|
||||||
|
.first;
|
||||||
|
manga.status = MBridge.parseStatus(toStatus(status), statusList);
|
||||||
|
manga.genre = MBridge.xpath(res,
|
||||||
|
'//li[contains(@class,"list-group-item") and contains(text(),"Genre(s)")]/a/text()');
|
||||||
|
|
||||||
|
final script =
|
||||||
|
MBridge.xpath(res, '//script[contains(text(), "MainFunction")]/text()')
|
||||||
|
.first;
|
||||||
|
final vmChapters = MBridge.substringBefore(
|
||||||
|
MBridge.substringAfter(script, "vm.Chapters = "), ";");
|
||||||
|
final chapters = json.decode(vmChapters) as List;
|
||||||
|
manga.names = chapters.map((ch) {
|
||||||
|
String name = ch['ChapterName'] ?? "";
|
||||||
|
String indexChapter = ch['Chapter'];
|
||||||
|
if (name.isEmpty) {
|
||||||
|
name = '${ch['Type']} ${chapterImage(indexChapter, true)}';
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
manga.urls = chapters
|
||||||
|
.map((ch) =>
|
||||||
|
'/read-online/${MBridge.substringAfter(manga.link, "/manga/")}${chapterURLEncode(ch['Chapter'])}')
|
||||||
|
.toList();
|
||||||
|
final chapterDates = chapters.map((ch) => ch['Date']).toList();
|
||||||
|
manga.chaptersDateUploads = MBridge.listParseDateTime(
|
||||||
|
chapterDates, manga.dateFormat, manga.dateFormatLocale);
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
getChapterUrl(MangaModel manga) async {
|
||||||
|
final headers = getHeader(manga.baseUrl);
|
||||||
|
final url = '${manga.baseUrl}${manga.link}';
|
||||||
|
List<String> pages = [];
|
||||||
|
final data = {"url": url, "headers": headers};
|
||||||
|
final res = await MBridge.http('GET', json.encode(data));
|
||||||
|
final script =
|
||||||
|
MBridge.xpath(res, '//script[contains(text(), "MainFunction")]/text()')
|
||||||
|
.first;
|
||||||
|
final chapScript = json.decode(MBridge.substringBefore(
|
||||||
|
MBridge.substringAfter(script, "vm.CurChapter = "), ";"));
|
||||||
|
final pathName = MBridge.substringBefore(
|
||||||
|
MBridge.substringAfter(script, "vm.CurPathName = \"", ""), "\"");
|
||||||
|
var directory = chapScript['Directory'] ?? '';
|
||||||
|
if (directory.length > 0) {
|
||||||
|
directory += '/';
|
||||||
|
}
|
||||||
|
final mangaName = MBridge.substringBefore(
|
||||||
|
MBridge.substringAfter(manga.link, "/read-online/"), "-chapter");
|
||||||
|
var chNum = chapterImage(chapScript['Chapter'], false);
|
||||||
|
var totalPages = MBridge.intParse(chapScript['Page']);
|
||||||
|
for (int page = 1; page <= totalPages; page++) {
|
||||||
|
String paddedPageNumber = "$page".padLeft(3, '0');
|
||||||
|
String pageUrl =
|
||||||
|
'https://$pathName/manga/$mangaName/$directory$chNum-$paddedPageNumber.png';
|
||||||
|
|
||||||
|
pages.add(pageUrl);
|
||||||
|
}
|
||||||
|
return pages;
|
||||||
|
}
|
||||||
|
|
||||||
|
String chapterImage(String e, bool cleanString) {
|
||||||
|
var a = e.substring(1, e.length - 1);
|
||||||
|
if (cleanString) {
|
||||||
|
a = MBridge.regExp(a, r'^0+', "", 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var b = MBridge.intParse(e.substring(e.length - 1));
|
||||||
|
|
||||||
|
if (b == 0 && a.isNotEmpty) {
|
||||||
|
return a;
|
||||||
|
} else if (b == 0 && a.isEmpty) {
|
||||||
|
return '0';
|
||||||
|
} else {
|
||||||
|
return '$a.$b';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String toStatus(String status) {
|
||||||
|
if (status.contains("Ongoing")) {
|
||||||
|
return "Ongoing";
|
||||||
|
} else if (status.contains("Complete")) {
|
||||||
|
return "Complete";
|
||||||
|
} else if (status.contains("Cancelled")) {
|
||||||
|
return "Cancelled";
|
||||||
|
} else if (status.contains("Hiatus")) {
|
||||||
|
return "Hiatus";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
String directoryFromDocument(String res) {
|
||||||
|
final script =
|
||||||
|
MBridge.xpath(res, '//script[contains(text(), "MainFunction")]/text()')
|
||||||
|
.first;
|
||||||
|
return MBridge.substringBefore(
|
||||||
|
MBridge.substringAfter(script, "vm.Directory = "), "vm.GetIntValue")
|
||||||
|
.replaceAll(";", " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
MangaModel parseDirectory(String resSort, MangaModel manga) {
|
||||||
|
final datas = json.decode(resSort) as List;
|
||||||
|
manga.names = datas.map((e) => e["s"]).toList();
|
||||||
|
manga.images = datas
|
||||||
|
.map((e) => 'https://temp.compsci88.com/cover/${e['i']}.jpg')
|
||||||
|
.toList();
|
||||||
|
manga.urls = datas.map((e) => e["i"]).toList();
|
||||||
|
return manga;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> getHeader(String url) {
|
||||||
|
final headers = {
|
||||||
|
'Referer': '$url/',
|
||||||
|
"User-Agent":
|
||||||
|
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/77.0"
|
||||||
|
};
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
String chapterURLEncode(String e) {
|
||||||
|
var index = ''.toString();
|
||||||
|
var t = MBridge.intParse(e.substring(0, 1));
|
||||||
|
|
||||||
|
if (t != 1) {
|
||||||
|
index = '-index-$t';
|
||||||
|
}
|
||||||
|
|
||||||
|
var dgt = 0;
|
||||||
|
var inta = MBridge.intParse(e);
|
||||||
|
if (inta < 100100) {
|
||||||
|
dgt = 4;
|
||||||
|
} else if (inta < 101000) {
|
||||||
|
dgt = 3;
|
||||||
|
} else if (inta < 110000) {
|
||||||
|
dgt = 2;
|
||||||
|
} else {
|
||||||
|
dgt = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
final n = e.substring(dgt, e.length - 1);
|
||||||
|
var suffix = ''.toString();
|
||||||
|
final path = MBridge.intParse(e.substring(e.length - 1));
|
||||||
|
|
||||||
|
if (path != 0) {
|
||||||
|
suffix = '.$path';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '-chapter-$n$suffix$index.html';
|
||||||
|
}
|
||||||
34
manga/multisrc/nepnep/sources.dart
Normal file
34
manga/multisrc/nepnep/sources.dart
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import '../../../model/source.dart';
|
||||||
|
import '../../../utils/utils.dart';
|
||||||
|
|
||||||
|
const nepnepVersion = "0.0.1";
|
||||||
|
const nepnepSourceCodeUrl =
|
||||||
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/nepnep/nepnep-v$nepnepVersion.dart";
|
||||||
|
const defaultDateFormat = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
const defaultDateFormatLocale = "en";
|
||||||
|
|
||||||
|
List<Source> get nepnepSourcesList => _nepnepSourcesList;
|
||||||
|
List<Source> _nepnepSourcesList = [
|
||||||
|
Source(
|
||||||
|
name: "MangaSee",
|
||||||
|
baseUrl: "https://mangasee123.com",
|
||||||
|
lang: "en",
|
||||||
|
typeSource: "nepnep",
|
||||||
|
iconUrl: getIconUrl("mangasee", "fr"),
|
||||||
|
dateFormat: defaultDateFormat,
|
||||||
|
dateFormatLocale: defaultDateFormatLocale,
|
||||||
|
version: nepnepVersion,
|
||||||
|
sourceCodeUrl: nepnepSourceCodeUrl,
|
||||||
|
),
|
||||||
|
Source(
|
||||||
|
name: "MangaLife",
|
||||||
|
baseUrl: "https://manga4life.com",
|
||||||
|
lang: "en",
|
||||||
|
typeSource: "nepnep",
|
||||||
|
iconUrl: getIconUrl("mangalife", "id"),
|
||||||
|
dateFormat: defaultDateFormat,
|
||||||
|
dateFormatLocale: defaultDateFormatLocale,
|
||||||
|
version: nepnepVersion,
|
||||||
|
sourceCodeUrl: nepnepSourceCodeUrl,
|
||||||
|
),
|
||||||
|
];
|
||||||
@@ -7,6 +7,7 @@ import 'multisrc/heancms/sources.dart';
|
|||||||
import 'multisrc/madara/sources.dart';
|
import 'multisrc/madara/sources.dart';
|
||||||
import 'multisrc/mangareader/sources.dart';
|
import 'multisrc/mangareader/sources.dart';
|
||||||
import 'multisrc/mmrcms/sources.dart';
|
import 'multisrc/mmrcms/sources.dart';
|
||||||
|
import 'multisrc/nepnep/sources.dart';
|
||||||
import 'src/all/batoto/sources.dart';
|
import 'src/all/batoto/sources.dart';
|
||||||
import 'src/all/comick/sources.dart';
|
import 'src/all/comick/sources.dart';
|
||||||
import 'src/all/mangadex/sources.dart';
|
import 'src/all/mangadex/sources.dart';
|
||||||
@@ -21,7 +22,8 @@ void main() {
|
|||||||
...mmrcmsSourcesList,
|
...mmrcmsSourcesList,
|
||||||
...heanCmsSourcesList,
|
...heanCmsSourcesList,
|
||||||
mangahereSource,
|
mangahereSource,
|
||||||
...batotoSourcesList
|
...batotoSourcesList,
|
||||||
|
...nepnepSourcesList
|
||||||
];
|
];
|
||||||
final List<Map<String, dynamic>> jsonList =
|
final List<Map<String, dynamic>> jsonList =
|
||||||
_sourcesList.map((source) => source.toJson()).toList();
|
_sourcesList.map((source) => source.toJson()).toList();
|
||||||
|
|||||||
Reference in New Issue
Block a user