Update Aniwave keys & fix vidsrcExtractor

This commit is contained in:
kodjomoustapha
2024-08-08 11:54:08 +01:00
parent 9c1199b43c
commit a5993c6b09
2 changed files with 88 additions and 123 deletions

View File

@@ -9,7 +9,7 @@ class Aniwave extends MProvider {
final Client client = Client(source); final Client client = Client(source);
@override @override
String get baseUrl => getPreferenceValue(source.id, "preferred_domain1"); String get baseUrl => getPreferenceValue(source.id, "preferred_domain2");
@override @override
Future<MPages> getPopular(int page) async { Future<MPages> getPopular(int page) async {
@@ -174,8 +174,11 @@ class Aniwave extends MProvider {
final ids = substringBefore(url, "&"); final ids = substringBefore(url, "&");
final encrypt = vrfEncrypt(ids); final encrypt = vrfEncrypt(ids);
final vrf = "vrf=${Uri.encodeComponent(encrypt)}"; final vrf = "vrf=${Uri.encodeComponent(encrypt)}";
final res = final res = (await client
(await client.get(Uri.parse("$baseUrl/ajax/server/list/$ids?$vrf"))) .get(Uri.parse("$baseUrl/ajax/server/list/$ids?$vrf"), headers: {
"Referer": baseUrl + url,
"X-Requested-With": "XMLHttpRequest"
}))
.body; .body;
final html = json.decode(res)["result"]; final html = json.decode(res)["result"];
@@ -202,21 +205,21 @@ class Aniwave extends MProvider {
final hosterSelection = preferenceHosterSelection(source.id); final hosterSelection = preferenceHosterSelection(source.id);
final typeSelection = preferenceTypeSelection(source.id); final typeSelection = preferenceTypeSelection(source.id);
if (typeSelection.contains(type.toLowerCase())) { if (typeSelection.contains(type.toLowerCase())) {
if (serverName.contains("vidplay") || url.contains("mcloud")) { if (serverName.contains("vidstream") || url.contains("megaf")) {
final hosterName = final hosterName =
serverName.contains("vidplay") ? "VidPlay" : "MyCloud"; serverName.contains("vidstream") ? "Vidstream" : "MegaF";
if (hosterSelection.contains(hosterName.toLowerCase())) { if (hosterSelection.contains(hosterName.toLowerCase())) {
a = await vidsrcExtractor(url, hosterName, type); a = await vidsrcExtractor(url, hosterName, type);
} }
} else if (serverName.contains("mp4upload") && } else if (serverName.contains("mp4u") &&
hosterSelection.contains("mp4upload")) { hosterSelection.contains("mp4u")) {
a = await mp4UploadExtractor(url, null, "", type); a = await mp4UploadExtractor(url, null, "", type);
} else if (serverName.contains("streamtape") && } else if (serverName.contains("streamtape") &&
hosterSelection.contains("streamtape")) { hosterSelection.contains("streamtape")) {
a = await streamTapeExtractor(url, "StreamTape - $type"); a = await streamTapeExtractor(url, "StreamTape - $type");
} else if (serverName.contains("filemoon") && } else if (serverName.contains("moonf") &&
hosterSelection.contains("filemoon")) { hosterSelection.contains("moonf")) {
a = await filemoonExtractor(url, "", type); a = await filemoonExtractor(url, "MoonF", type);
} }
videos.addAll(a); videos.addAll(a);
} }
@@ -274,17 +277,14 @@ class Aniwave extends MProvider {
} }
String vrfEncrypt(String input) { String vrfEncrypt(String input) {
final rc4 = rc4Encrypt("tGn6kIpVXBEUmqjD", input.codeUnits); final rc4 = rc4Encrypt("T78s2WjTc7hSIZZR", input.codeUnits);
final vrf = base64Url.encode(rc4); final vrf = base64Url.encode(rc4);
final vrf1 = base64.encode(vrf.codeUnits); return utf8.decode(vrf.codeUnits);
List<int> vrf2 = vrfShift(vrf1.codeUnits);
final vrf3 = base64Url.encode(vrf2.reversed.toList());
return utf8.decode(vrf3.codeUnits);
} }
String vrfDecrypt(String input) { String vrfDecrypt(String input, {String key = "ctpAbOz5u7S6OMkx"}) {
final decode = base64Url.decode(input); final decode = base64Url.decode(input);
final rc4 = rc4Encrypt("LUyDrL4qIxtIxOGs", decode); final rc4 = rc4Encrypt(key, decode);
return Uri.decodeComponent(utf8.decode(rc4)); return Uri.decodeComponent(utf8.decode(rc4));
} }
@@ -299,20 +299,14 @@ class Aniwave extends MProvider {
Future<List<MVideo>> vidsrcExtractor( Future<List<MVideo>> vidsrcExtractor(
String url, String name, String type) async { String url, String name, String type) async {
List<String> keys = json.decode((await client.get(Uri.parse(
"https://raw.githubusercontent.com/KillerDogeEmpire/vidplay-keys/keys/keys.json")))
.body);
List<MVideo> videoList = []; List<MVideo> videoList = [];
final host = Uri.parse(url).host; final host = Uri.parse(url).host;
final apiUrl = await getApiUrl(url, keys); final apiUrl = getApiUrl(url);
final res = await client.get(Uri.parse(apiUrl));
final res = await client.get(Uri.parse(apiUrl), headers: {
"Host": host,
"Referer": Uri.decodeComponent(url),
"X-Requested-With": "XMLHttpRequest"
});
final result = json.decode(res.body)['result'];
if (res.body.startsWith("{")) {
final result = json.decode(
vrfDecrypt(json.decode(res.body)['result'], key: "9jXDYBZUcTcTZveM"));
if (result != 404) { if (result != 404) {
String masterUrl = String masterUrl =
((result['sources'] as List<Map<String, dynamic>>).first)['file']; ((result['sources'] as List<Map<String, dynamic>>).first)['file'];
@@ -355,11 +349,12 @@ class Aniwave extends MProvider {
videoList.add(video); videoList.add(video);
} }
} }
}
return videoList; return videoList;
} }
Future<String> getApiUrl(String url, List<String> keyList) async { String getApiUrl(String url) {
final host = Uri.parse(url).host; final host = Uri.parse(url).host;
final paramsToString = Uri.parse(url) final paramsToString = Uri.parse(url)
.queryParameters .queryParameters
@@ -367,23 +362,21 @@ class Aniwave extends MProvider {
.map((e) => "${e.key}=${e.value}") .map((e) => "${e.key}=${e.value}")
.join("&"); .join("&");
var vidId = substringBefore(substringAfterLast(url, "/"), "?"); var vidId = substringBefore(substringAfterLast(url, "/"), "?");
var encodedID = encodeID(vidId, keyList);
final apiSlug = await callFromFuToken(host, encodedID, url); final apiSlug = encodeID(vidId, "8Qy3mlM2kod80XIK");
final h = encodeID(vidId, "BgKVSrzpH2Enosgm");
String apiUrlString = ""; String apiUrlString = "";
apiUrlString += "https://$host/$apiSlug"; apiUrlString += "https://$host/mediainfo/$apiSlug";
if (paramsToString.isNotEmpty) { if (paramsToString.isNotEmpty) {
apiUrlString += "?$paramsToString"; apiUrlString += "?$paramsToString&h=$h";
} }
return apiUrlString; return apiUrlString;
} }
String encodeID(String vidId, List<String> keyList) { String encodeID(String vidId, String key) {
var rc4Key1 = keyList[0]; final rc4 = rc4Encrypt(key, vidId.codeUnits);
var rc4Key2 = keyList[1]; return base64.encode(rc4).replaceAll("+", "-").replaceAll("/", "_").trim();
final rc4 = rc4Encrypt(rc4Key1, vidId.codeUnits);
final rc41 = rc4Encrypt(rc4Key2, rc4);
return base64.encode(rc41).replaceAll("/", "_").trim();
} }
Future<String> callFromFuToken(String host, String data, String url) async { Future<String> callFromFuToken(String host, String data, String url) async {
@@ -541,22 +534,12 @@ class Aniwave extends MProvider {
List<dynamic> getSourcePreferences() { List<dynamic> getSourcePreferences() {
return [ return [
ListPreference( ListPreference(
key: "preferred_domain1", key: "preferred_domain2",
title: "Preferred domain", title: "Preferred domain",
summary: "", summary: "",
valueIndex: 0, valueIndex: 0,
entries: [ entries: ["aniwave.to", "aniwavetv.to (unofficial)"],
"aniwave.to", entryValues: ["https://aniwave.to", "https://aniwavetv.to"]),
"aniwave.ws",
"aniwave.li",
"aniwave.vc"
],
entryValues: [
"https://aniwave.to",
"https://aniwave.ws",
"https://aniwave.li",
"https://aniwave.vc"
]),
ListPreference( ListPreference(
key: "preferred_quality", key: "preferred_quality",
title: "Preferred Quality", title: "Preferred Quality",
@@ -572,49 +555,31 @@ class Aniwave extends MProvider {
entries: ["Sub", "Softsub", "Dub"], entries: ["Sub", "Softsub", "Dub"],
entryValues: ["Sub", "Softsub", "Dub"]), entryValues: ["Sub", "Softsub", "Dub"]),
ListPreference( ListPreference(
key: "preferred_server", key: "preferred_server1",
title: "Preferred server", title: "Preferred server",
summary: "", summary: "",
valueIndex: 0, valueIndex: 0,
entries: [ entries: [
"VidPlay", "Vidstream",
"MyCloud", "Megaf",
"Filemoon", "MoonF",
"StreamTape", "StreamTape",
"Mp4Upload" "MP4u"
], ],
entryValues: [ entryValues: [
"vidplay", "vidstream",
"mycloud", "megaf",
"filemoon", "moonf",
"streamtape", "streamtape",
"mp4upload" "mp4upload"
]), ]),
MultiSelectListPreference( MultiSelectListPreference(
key: "hoster_selection", key: "hoster_selection1",
title: "Enable/Disable Hosts", title: "Enable/Disable Hosts",
summary: "", summary: "",
entries: [ entries: ["Vidstream", "Megaf", "MoonF", "StreamTape", "MP4u"],
"VidPlay", entryValues: ["vidstream", "megaf", "moonf", "streamtape", "mp4u"],
"MyCloud", values: ["vidstream", "megaf", "moonf", "streamtape", "mp4u"]),
"Filemoon",
"StreamTape",
"Mp4Upload"
],
entryValues: [
"vidplay",
"mycloud",
"filemoon",
"streamtape",
"mp4upload"
],
values: [
"vidplay",
"mycloud",
"filemoon",
"streamtape",
"mp4upload"
]),
MultiSelectListPreference( MultiSelectListPreference(
key: "type_selection", key: "type_selection",
title: "Enable/Disable Type", title: "Enable/Disable Type",
@@ -626,7 +591,7 @@ class Aniwave extends MProvider {
} }
List<String> preferenceHosterSelection(int sourceId) { List<String> preferenceHosterSelection(int sourceId) {
return getPreferenceValue(sourceId, "hoster_selection"); return getPreferenceValue(sourceId, "hoster_selection1");
} }
List<String> preferenceTypeSelection(int sourceId) { List<String> preferenceTypeSelection(int sourceId) {
@@ -635,7 +600,7 @@ class Aniwave extends MProvider {
List<MVideo> sortVideos(List<MVideo> videos, int sourceId) { List<MVideo> sortVideos(List<MVideo> videos, int sourceId) {
String quality = getPreferenceValue(sourceId, "preferred_quality"); String quality = getPreferenceValue(sourceId, "preferred_quality");
String server = getPreferenceValue(sourceId, "preferred_server"); String server = getPreferenceValue(sourceId, "preferred_server1");
String lang = getPreferenceValue(sourceId, "preferred_language"); String lang = getPreferenceValue(sourceId, "preferred_language");
videos.sort((MVideo a, MVideo b) { videos.sort((MVideo a, MVideo b) {
int qualityMatchA = 0; int qualityMatchA = 0;

View File

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