mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 02:41:39 +00:00
Fix: MangaBox chapter list
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -126,74 +126,58 @@ class MangaBox extends MProvider {
|
|||||||
];
|
];
|
||||||
MManga manga = MManga();
|
MManga manga = MManga();
|
||||||
final res = (await client.get(Uri.parse(url))).body;
|
final res = (await client.get(Uri.parse(url))).body;
|
||||||
|
final document = parseHtml(res);
|
||||||
|
manga.author = document.xpathFirst(
|
||||||
|
'//*[@class="table-label" and contains(text(), "Author")]/parent::tr/td[2]/text()|//li[contains(text(), "Author")]/a/text()') ??
|
||||||
|
"";
|
||||||
|
|
||||||
List<String> author = xpath(res,
|
final alternative = document.xpathFirst(
|
||||||
'//*[@class="table-label" and contains(text(), "Author")]/parent::tr/td[2]/text()');
|
'//*[@class="table-label" and contains(text(), "Alternative")]/parent::tr/td[2]/text()') ??
|
||||||
if (author.isEmpty) {
|
"";
|
||||||
author = xpath(res, '//li[contains(text(), "Author")]/a/text()');
|
|
||||||
}
|
final description = document.xpathFirst(
|
||||||
if (author.isNotEmpty) {
|
'//*[@id="panel-story-info-description" ]/text() | //*[@id="story_discription" ]/text()') ??
|
||||||
manga.author = author.first;
|
"";
|
||||||
}
|
|
||||||
final alternative = xpath(res,
|
|
||||||
'//*[@class="table-label" and contains(text(), "Alternative")]/parent::tr/td[2]/text()');
|
|
||||||
|
|
||||||
List<String> description =
|
|
||||||
xpath(res, '//*[@id="panel-story-info-description" ]/text()');
|
|
||||||
if (description.isEmpty) {
|
|
||||||
description = xpath(res, '//*[@id="story_discription" ]/text()');
|
|
||||||
}
|
|
||||||
if (description.isNotEmpty) {
|
if (description.isNotEmpty) {
|
||||||
manga.description = description.first
|
manga.description = description
|
||||||
|
.split("summary:", ' ')
|
||||||
|
.last
|
||||||
|
.split("Summary:", ' ')
|
||||||
|
.last
|
||||||
.replaceAll("\n", ' ')
|
.replaceAll("\n", ' ')
|
||||||
.replaceAll("Description :", "");
|
.replaceAll("Description :", "");
|
||||||
if (alternative.isNotEmpty) {
|
if (alternative.isNotEmpty) {
|
||||||
manga.description =
|
manga.description =
|
||||||
"${manga.description}\n\nAlternative Name: ${alternative.first}";
|
"${manga.description}\n\nAlternative Name: $alternative";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<String> status = xpath(
|
final status = document.xpathFirst(
|
||||||
res,
|
'//*[@class="table-label" and contains(text(), "Status")]/parent::tr/td[2]/text() | //li[contains(text(), "Status")]/text() | //li[contains(text(), "Status")]/a/text()') ??
|
||||||
'//*[@class="table-label" and contains(text(), "Status")]/parent::tr/td[2]/text()',
|
"";
|
||||||
'');
|
|
||||||
if (status.isEmpty) {
|
|
||||||
status = xpath(res, '//li[contains(text(), "Status")]/a/text()', '');
|
|
||||||
}
|
|
||||||
if (status.isNotEmpty) {
|
if (status.isNotEmpty) {
|
||||||
manga.status = parseStatus(status.first, statusList);
|
manga.status = parseStatus(status.split(":").last.trim(), statusList);
|
||||||
}
|
}
|
||||||
|
manga.genre = document.xpath(
|
||||||
manga.genre = xpath(res,
|
'//*[@class="table-label" and contains(text(), "Genres")]/parent::tr/td[2]/a/text() | //li[contains(text(), "Genres")]/a/text()');
|
||||||
'//*[@class="table-label" and contains(text(), "Genres")]/parent::tr/td[2]/a/text()');
|
final chaptersElements = document.select(
|
||||||
|
"div.chapter-list div.row, ul.row-content-chapter li, div#chapter_list li");
|
||||||
if (manga.genre.isEmpty) {
|
|
||||||
manga.genre = xpath(res, '//li[contains(text(), "Genres")]/a/text()');
|
|
||||||
}
|
|
||||||
List<String> chapUrls =
|
|
||||||
xpath(res, '//*[@class="row-content-chapter"]/li/a/@href');
|
|
||||||
if (chapUrls.isEmpty) {
|
|
||||||
chapUrls = xpath(res, '//div[@id="chapter_list"]/ul/li/a/@href');
|
|
||||||
}
|
|
||||||
List<String> chaptersNames =
|
|
||||||
xpath(res, '//*[@class="row-content-chapter"]/li/a/text()');
|
|
||||||
if (chaptersNames.isEmpty) {
|
|
||||||
chaptersNames = xpath(res, '//div[@id="chapter_list"]/ul/li/a/text()');
|
|
||||||
}
|
|
||||||
List<String> chapterDates =
|
|
||||||
xpath(res, '//*[@class="row-content-chapter"]/li/span[last()]/text()');
|
|
||||||
|
|
||||||
if (chapterDates.isEmpty) {
|
|
||||||
chapterDates = xpath(res, '//div[@id="chapter_list"]/ul/li/p/text()');
|
|
||||||
}
|
|
||||||
List<String> dateUploads =
|
|
||||||
parseDates(chapterDates, source.dateFormat, source.dateFormatLocale);
|
|
||||||
|
|
||||||
List<MChapter>? chaptersList = [];
|
List<MChapter>? chaptersList = [];
|
||||||
for (var i = 0; i < chaptersNames.length; i++) {
|
for (var element in chaptersElements) {
|
||||||
|
final a = element.selectFirst("a");
|
||||||
MChapter chapter = MChapter();
|
MChapter chapter = MChapter();
|
||||||
chapter.name = chaptersNames[i];
|
chapter.name = a.text;
|
||||||
chapter.url = chapUrls[i];
|
final dates = element.select("span");
|
||||||
chapter.dateUpload = dateUploads[i];
|
String dateStr = "";
|
||||||
|
if (dates != null && dates.isNotEmpty) {
|
||||||
|
dateStr = dates.last.text;
|
||||||
|
} else {
|
||||||
|
dateStr = element.selectFirst("ul > li > p")?.text ??
|
||||||
|
DateTime.now().toString();
|
||||||
|
}
|
||||||
|
chapter.url = a.getHref;
|
||||||
|
chapter.dateUpload =
|
||||||
|
parseDates([dateStr], source.dateFormat, source.dateFormatLocale)[0];
|
||||||
chaptersList.add(chapter);
|
chaptersList.add(chapter);
|
||||||
}
|
}
|
||||||
manga.chapters = chaptersList;
|
manga.chapters = chaptersList;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import 'src/mangairo/mangaeiro.dart';
|
|||||||
import 'src/mangakakalot/mangakakalot.dart';
|
import 'src/mangakakalot/mangakakalot.dart';
|
||||||
import 'src/manganato/manganato.dart';
|
import 'src/manganato/manganato.dart';
|
||||||
|
|
||||||
const mangaboxVersion = "0.0.3";
|
const mangaboxVersion = "0.0.35";
|
||||||
const mangaboxSourceCodeUrl =
|
const mangaboxSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/manga/multisrc/mangabox/mangabox.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/manga/multisrc/mangabox/mangabox.dart";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user