This commit is contained in:
kodjomoustapha
2024-08-13 10:12:07 +01:00
parent 9560967ad4
commit 6863c8a8ec
2 changed files with 23 additions and 3 deletions

View File

@@ -104,8 +104,28 @@ class Aniwave extends MProvider {
final statusList = [
{"Releasing": 0, "Completed": 1}
];
final res = (await client.get(Uri.parse("$baseUrl$url"))).body;
MManga anime = MManga();
final response =
await Client(source, json.encode({"followRedirects": false}))
.get(Uri.parse("$baseUrl$url"));
String res = response.body;
if (getMapValue(json.encode(response.headers), "location")
.contains("/filter?keyword=")) {
res = (await Client().get(Uri.parse("$baseUrl$url"))).body;
final animeUrls = parseHtml(res)
.selectFirst("div.ani.items > div.item")
.select("a[href]")
.where((MElement element) => (element.getHref as String)
.startsWith("${substringBefore(url, ".")}."))
.toList();
if (animeUrls.isNotEmpty) {
res = (await client.get(Uri.parse("$baseUrl${animeUrls[0].getHref}")))
.body;
} else {
throw "Anime url not found";
}
}
var anime = MManga();
final status = xpath(res, '//div[contains(text(),"Status")]/span/text()');
if (status.isNotEmpty) {
anime.status = parseStatus(status.first, statusList);

View File

@@ -1,7 +1,7 @@
import '../../../../../model/source.dart';
Source get aniwave => _aniwave;
const _aniwaveVersion = "0.0.85";
const _aniwaveVersion = "0.0.9";
const _aniwaveCodeUrl =
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/dart/anime/src/en/aniwave/aniwave.dart";
Source _aniwave = Source(