mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
Refactor
This commit is contained in:
@@ -148,14 +148,13 @@ class HeanCms extends MProvider {
|
||||
res = await http('GET', json.encode(data));
|
||||
|
||||
List<String> pageUrls = [];
|
||||
var imagesRes = querySelectorAll(res,
|
||||
selector: "div.min-h-screen > div.container > p.items-center",
|
||||
typeElement: 1,
|
||||
attributes: "",
|
||||
typeRegExp: 0);
|
||||
pageUrls = xpath(imagesRes.first, '//img/@src');
|
||||
var imagesRes = parseHtml(res)
|
||||
.selectFirst("div.min-h-screen > div.container > p.items-center")
|
||||
.innerHtml;
|
||||
|
||||
pageUrls.addAll(xpath(imagesRes.first, '//img/@data-src'));
|
||||
pageUrls = xpath(imagesRes, '//img/@src');
|
||||
|
||||
pageUrls.addAll(xpath(imagesRes, '//img/@data-src'));
|
||||
|
||||
return pageUrls.where((e) => e.isNotEmpty).toList();
|
||||
}
|
||||
|
||||
@@ -145,12 +145,11 @@ class MangaReader extends MProvider {
|
||||
.replaceAll("[Add, ]", "");
|
||||
}
|
||||
|
||||
final description = querySelectorAll(res,
|
||||
selector: ".desc, .entry-content[itemprop=description]",
|
||||
typeElement: 0,
|
||||
attributes: "",
|
||||
typeRegExp: 0);
|
||||
if (description.isNotEmpty) {
|
||||
final description = parseHtml(res)
|
||||
.selectFirst(".desc, .entry-content[itemprop=description]")
|
||||
?.text;
|
||||
|
||||
if (description != null) {
|
||||
manga.description = description.first;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,25 +128,18 @@ class Batoto extends MProvider {
|
||||
.split(",");
|
||||
manga.description = xpath(res, '//*[@class="limit-html"]/text()').first;
|
||||
|
||||
List<String> chapsElement = querySelectorAll(res,
|
||||
selector: "div.main div.p-2",
|
||||
typeElement: 2,
|
||||
attributes: "",
|
||||
typeRegExp: 0);
|
||||
final chapElements = parseHtml(res).select("div.main div.p-2");
|
||||
|
||||
List<String> times = [];
|
||||
List<String> chapsUrls = [];
|
||||
List<String> chapsNames = [];
|
||||
List<String> scanlators = [];
|
||||
for (var element in chapsElement) {
|
||||
final urlElement = querySelectorAll(element,
|
||||
selector: "a.chapt",
|
||||
typeElement: 2,
|
||||
attributes: "",
|
||||
typeRegExp: 0)
|
||||
.first;
|
||||
for (MElement el in chapElements) {
|
||||
final chapHtml = el.selectFirst("a.chapt").outerHtml;
|
||||
final element = el.outerHtml;
|
||||
final group = xpath(element, '//*[@class="extra"]/a/text()').first;
|
||||
final name = xpath(urlElement, '//a/text()').first;
|
||||
final url = xpath(urlElement, '//a/@href').first;
|
||||
final name = xpath(chapHtml, '//a/text()').first;
|
||||
final url = xpath(chapHtml, '//a/@href').first;
|
||||
final time =
|
||||
xpath(element, '//*[@class="extra"]/i[@class="ps-3"]/text()').first;
|
||||
times.add(time);
|
||||
@@ -201,46 +194,25 @@ class Batoto extends MProvider {
|
||||
MPages mangaElementM(String res, MSource source) async {
|
||||
final lang = source.lang.replaceAll("-", "_");
|
||||
|
||||
var resB = querySelectorAll(res,
|
||||
selector: "div#series-list div.col",
|
||||
typeElement: 2,
|
||||
attributes: "",
|
||||
typeRegExp: 0);
|
||||
final mangaElements = parseHtml(res).select("div#series-list div.col");
|
||||
|
||||
List<String> images = [];
|
||||
List<String> urls = [];
|
||||
List<String> names = [];
|
||||
|
||||
for (var element in resB) {
|
||||
for (MElement element in mangaElements) {
|
||||
if (source.lang == "all" ||
|
||||
source.lang == "en" && element.contains('no-flag') ||
|
||||
element.contains('data-lang="$lang"')) {
|
||||
final item = querySelectorAll(element,
|
||||
selector: "a.item-cover",
|
||||
typeElement: 2,
|
||||
attributes: "",
|
||||
typeRegExp: 0)
|
||||
.first;
|
||||
final img = querySelectorAll(item,
|
||||
selector: "img",
|
||||
typeElement: 3,
|
||||
attributes: "src",
|
||||
typeRegExp: 0)
|
||||
.first;
|
||||
final url = querySelectorAll(item,
|
||||
selector: "a",
|
||||
typeElement: 3,
|
||||
attributes: "href",
|
||||
typeRegExp: 0)
|
||||
.first;
|
||||
source.lang == "en" && element.outerHtml.contains('no-flag') ||
|
||||
element.outerHtml.contains('data-lang="$lang"')) {
|
||||
final itemHtml = element.selectFirst("a.item-cover").outerHtml;
|
||||
|
||||
final img = parseHtml(itemHtml).selectFirst("img").getSrc;
|
||||
|
||||
final url = parseHtml(itemHtml).selectFirst("a").getHref;
|
||||
images.add(img);
|
||||
urls.add(url);
|
||||
final title = querySelectorAll(element,
|
||||
selector: "a.item-title",
|
||||
typeElement: 0,
|
||||
attributes: "",
|
||||
typeRegExp: 0)
|
||||
.first;
|
||||
urls.add(url.replaceAll(";", "&"));
|
||||
final title = element.selectFirst("a.item-title").text;
|
||||
|
||||
names.add(title);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user