mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 02:41:39 +00:00
Fix fecth chapter list
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -158,61 +158,52 @@ class Madara extends MProvider {
|
|||||||
[];
|
[];
|
||||||
|
|
||||||
final baseUrl = "${source.baseUrl}/";
|
final baseUrl = "${source.baseUrl}/";
|
||||||
final headers = {
|
final headers = {"Referer": baseUrl, "X-Requested-With": "XMLHttpRequest"};
|
||||||
"Referer": baseUrl,
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
|
||||||
"X-Requested-With": "XMLHttpRequest"
|
|
||||||
};
|
|
||||||
|
|
||||||
final resP = await client.post(
|
final oldXhrChaptersRequest = await client.post(
|
||||||
Uri.parse(
|
Uri.parse("${baseUrl}wp-admin/admin-ajax.php"),
|
||||||
"${baseUrl}wp-admin/admin-ajax.php?action=manga_get_chapters&manga=$mangaId"),
|
headers: headers,
|
||||||
headers: headers);
|
body: {"action": "manga_get_chapters", "manga": mangaId});
|
||||||
if (resP != 200 || mangaId.isEmpty) {
|
if (oldXhrChaptersRequest.statusCode == 400) {
|
||||||
res = (await client.post(Uri.parse("${url}ajax/chapters"),
|
res = (await client.post(Uri.parse("${url}ajax/chapters"),
|
||||||
headers: headers))
|
headers: headers))
|
||||||
.body;
|
.body;
|
||||||
} else {
|
} else {
|
||||||
res = resP.body;
|
res = oldXhrChaptersRequest.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
var chapUrls = xpath(res, '//li[@class^="wp-manga-chapter"]/a/@href');
|
final chapDoc = parseHtml(res);
|
||||||
var chaptersNames = xpath(res, '//li[@class^="wp-manga-chapter"]/a/text()');
|
var chapUrls =
|
||||||
var dateF = xpath(res, '//li[@class^="wp-manga-chapter"]/span/i/text()');
|
chapDoc.xpath('//li[contains(@class,"wp-manga-chapter")]/a/@href');
|
||||||
if (dateF.isEmpty) {
|
var chaptersNames =
|
||||||
final resWebview = await getHtmlViaWebview(
|
chapDoc.xpath('//li[contains(@class,"wp-manga-chapter")]/a/text()');
|
||||||
url, "//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/@href");
|
var chapDates = chapDoc
|
||||||
chapUrls = xpath(resWebview,
|
.xpath('//li[contains(@class,"wp-manga-chapter")]/span/i/text()');
|
||||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/@href");
|
|
||||||
chaptersNames = xpath(resWebview,
|
|
||||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/a/text()");
|
|
||||||
dateF = xpath(resWebview,
|
|
||||||
"//*[@id='manga-chapters-holder']/div[2]/div/ul/li/span/i/text()");
|
|
||||||
}
|
|
||||||
List<String> dateUploads = [];
|
List<String> dateUploads = [];
|
||||||
if (source.dateFormat.isNotEmpty) {
|
if (source.dateFormat.isNotEmpty) {
|
||||||
|
List<String> chaptersDate = [];
|
||||||
dateUploads =
|
dateUploads =
|
||||||
parseDates(dateF, source.dateFormat, source.dateFormatLocale);
|
parseDates(chapDates, source.dateFormat, source.dateFormatLocale);
|
||||||
if (dateF.length < chaptersNames.length) {
|
if (chapDates.length < chaptersNames.length) {
|
||||||
final length = chaptersNames.length - dateF.length;
|
final length = chaptersNames.length - chapDates.length;
|
||||||
String date = "${DateTime.now().millisecondsSinceEpoch}";
|
for (var i = 0; i < length; i++) {
|
||||||
for (var i = 0; i < length - 1; i++) {
|
chaptersDate.add("${DateTime.now().millisecondsSinceEpoch}");
|
||||||
date += "--..${DateTime.now().millisecondsSinceEpoch}";
|
|
||||||
}
|
}
|
||||||
|
final parsedDates =
|
||||||
final dateFF =
|
parseDates(chapDates, source.dateFormat, source.dateFormatLocale);
|
||||||
parseDates(dateF, source.dateFormat, source.dateFormatLocale);
|
for (var date in parsedDates) {
|
||||||
List<String> chapterDate = date.split('--..');
|
chaptersDate.add(date);
|
||||||
|
|
||||||
for (var date in dateFF) {
|
|
||||||
chapterDate.add(date);
|
|
||||||
}
|
}
|
||||||
dateUploads = chapterDate;
|
dateUploads = chaptersDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<MChapter>? chaptersList = [];
|
List<MChapter>? chaptersList = [];
|
||||||
for (var i = 0; i < chaptersNames.length; i++) {
|
for (var i = 0; i < chaptersNames.length; i++) {
|
||||||
|
String url = substringBefore(chapUrls[i], "?style=paged");
|
||||||
|
if (!chapUrls[i].endsWith("?style=paged")) {
|
||||||
|
url = url + "?style=paged";
|
||||||
|
}
|
||||||
MChapter chapter = MChapter();
|
MChapter chapter = MChapter();
|
||||||
chapter.name = chaptersNames[i];
|
chapter.name = chaptersNames[i];
|
||||||
chapter.url = chapUrls[i];
|
chapter.url = chapUrls[i];
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ import 'src/comicarab/comicarab.dart';
|
|||||||
import 'src/manga3asq/manga3asq.dart';
|
import 'src/manga3asq/manga3asq.dart';
|
||||||
import 'src/bakamh/bakamh.dart';
|
import 'src/bakamh/bakamh.dart';
|
||||||
|
|
||||||
const madaraVersion = "0.0.7";
|
const madaraVersion = "0.0.75";
|
||||||
const madaraSourceCodeUrl =
|
const madaraSourceCodeUrl =
|
||||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/manga/multisrc/madara/madara.dart";
|
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/manga/multisrc/madara/madara.dart";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user