SushiScans fix baseUrl

This commit is contained in:
kodjomoustapha
2023-12-18 18:23:32 +01:00
parent 0c9d056612
commit c1d38feaa5
4 changed files with 39 additions and 16 deletions

File diff suppressed because one or more lines are too long

View File

@@ -127,9 +127,9 @@ class MangaReader extends MProvider {
"hiatus": 2,
}
];
url = Uri.parse(url).path;
MManga manga = MManga();
final datas = {"url": url, "sourceId": source.id};
final datas = {"url": "${source.baseUrl}$url", "sourceId": source.id};
final res = await http('GET', json.encode(datas));
final author = xpath(
@@ -200,10 +200,21 @@ class MangaReader extends MProvider {
List<String> pages = [];
List<String> pagesUrl = [];
bool invalidImgs = false;
pages = xpath(res, '//*[@id="readerarea"]/p/img/@src');
if (pages.isEmpty || pages.length == 1) {
pages = xpath(res, '//*[@id="readerarea"]/img/@src');
}
if (pages.length > 1) {
for (var page in pages) {
if (page.contains("data:image")) {
invalidImgs = true;
}
}
if (invalidImgs) {
pages = xpath(res, '//*[@id="readerarea"]/img/@data-src');
}
}
if (pages.isEmpty || pages.length == 1) {
final images = regExp(res, "\"images\"\\s*:\\s*(\\[.*?])", "", 1, 1);
final pages = json.decode(images) as List;
@@ -221,8 +232,19 @@ class MangaReader extends MProvider {
List<MManga> mangaList = [];
final urls = xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@href');
final names = xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/@title');
final images =
List<String> images = [];
images =
xpath(res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@src');
bool invalidImgs = false;
for (var img in images) {
if (img.contains("data:image")) {
invalidImgs = true;
}
}
if (invalidImgs) {
images = xpath(
res, '//*[ @class="imgu" or @class="bsx"]/a/div[1]/img/@data-src');
}
for (var i = 0; i < names.length; i++) {
MManga manga = MManga();

View File

@@ -39,7 +39,7 @@ import 'src/turktoon/turktoon.dart';
import 'src/uzaymanga/uzaymanga.dart';
import 'src/xcalibrscans/xcalibrscans.dart';
const mangareaderVersion = "0.0.55";
const mangareaderVersion = "0.0.6";
const mangareaderSourceCodeUrl =
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/mangareader/mangareader-v$mangareaderVersion.dart";

View File

@@ -1,13 +1,14 @@
import '../../../../../model/source.dart';
Source get sushiscansSource => _sushiscansSource;
Source _sushiscansSource = Source(
name: "Sushi-Scans",
baseUrl: "https://sushiscan.fr",
lang: "fr",
typeSource: "mangareader",
iconUrl:"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/mangareader/src/sushiscans/icon.png",
dateFormat:"MMMM d, yyyy",
dateFormatLocale:"fr",
);
Source get sushiscansSource => _sushiscansSource;
Source _sushiscansSource = Source(
name: "Sushi-Scans",
baseUrl: "https://anime-sama.me",
lang: "fr",
typeSource: "mangareader",
iconUrl:
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/manga/multisrc/mangareader/src/sushiscans/icon.png",
dateFormat: "MMMM d, yyyy",
dateFormatLocale: "fr",
);