From e542cd444b0f6b2bc7bad6136181d5e74b1ee104 Mon Sep 17 00:00:00 2001 From: kodjomoustapha <107993382+kodjodevf@users.noreply.github.com> Date: Wed, 2 Aug 2023 23:58:25 +0100 Subject: [PATCH] update anime_index --- anime/src/en/wcostream/source.dart | 2 +- ...tream-v0.0.1.dart => wcostream-v0.0.11.dart} | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) rename anime/src/en/wcostream/{wcostream-v0.0.1.dart => wcostream-v0.0.11.dart} (93%) diff --git a/anime/src/en/wcostream/source.dart b/anime/src/en/wcostream/source.dart index 9b8dcee9..bd17f7b6 100644 --- a/anime/src/en/wcostream/source.dart +++ b/anime/src/en/wcostream/source.dart @@ -1,7 +1,7 @@ import '../../../../model/source.dart'; Source get wcostreamSource => _wcostreamSource; -const wcostreamVersion = "0.0.1"; +const wcostreamVersion = "0.0.11"; const wcostreamSourceCodeUrl = "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/en/wcostream/wcostream-v$wcostreamVersion.dart"; Source _wcostreamSource = Source( diff --git a/anime/src/en/wcostream/wcostream-v0.0.1.dart b/anime/src/en/wcostream/wcostream-v0.0.11.dart similarity index 93% rename from anime/src/en/wcostream/wcostream-v0.0.1.dart rename to anime/src/en/wcostream/wcostream-v0.0.11.dart index 66edae6e..7013a0d2 100644 --- a/anime/src/en/wcostream/wcostream-v0.0.1.dart +++ b/anime/src/en/wcostream/wcostream-v0.0.11.dart @@ -2,25 +2,30 @@ import 'dart:convert'; import 'package:bridge_lib/bridge_lib.dart'; getPopularAnime(MangaModel anime) async { - return await getLatestUpdatesManga(anime); + return await getLatestUpdatesAnime(anime); } -Future getLatestUpdatesManga(MangaModel anime) async { +Future getLatestUpdatesAnime(MangaModel anime) async { final data = { "url": anime.baseUrl, - "headers": {"Referer": "https://wcostream.org/"}, + "headers": {"referer": "https://wcostream.org/"}, "sourceId": anime.sourceId }; final res = await MBridge.http(json.encode(data), 0); if (res.isEmpty) { return anime; } - anime.urls = MBridge.xpath( + final urlss = MBridge.xpath( res, - '//*[@id="content"]/div/div[contains(text(),"Recent Releases")]/div/ul/li/div[@class="img"]/a/@href', + '//*[@id="content"]/div/div[contains(text(),"Recent Releases")]/div/ul/li/div[@class="img"]/a/img/@alt', '._') .split('._'); - + List urls = []; + for (var url in MBridge.listParse(urlss, 0)) { + urls.add( + "/anime/${MBridge.regExp(url, "[^A-Za-z0-9 ]", "", 0, 0).replaceAll(" ", "-").toLowerCase()}/"); + } + anime.urls = urls; final imagess = MBridge.xpath( res, '//*[@id="content"]/div/div[contains(text(),"Recent Releases")]/div/ul/li/div[@class="img"]/a/img/@src',