mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
dart format
This commit is contained in:
@@ -22,9 +22,11 @@ class AnimePahe extends MProvider {
|
||||
|
||||
@override
|
||||
Future<MPages> getLatestUpdates(int page) async {
|
||||
final res = (await client.get(Uri.parse("$baseUrl/api?m=airing&page=$page"),
|
||||
headers: headers))
|
||||
.body;
|
||||
final res =
|
||||
(await client.get(
|
||||
Uri.parse("$baseUrl/api?m=airing&page=$page"),
|
||||
headers: headers,
|
||||
)).body;
|
||||
final jsonResult = json.decode(res);
|
||||
final hasNextPage = jsonResult["current_page"] < jsonResult["last_page"];
|
||||
List<MManga> animeList = [];
|
||||
@@ -41,10 +43,11 @@ class AnimePahe extends MProvider {
|
||||
|
||||
@override
|
||||
Future<MPages> search(String query, int page, FilterList filterList) async {
|
||||
final res = (await client.get(
|
||||
Uri.parse("$baseUrl/api?m=search&l=8&q=$query"),
|
||||
headers: headers))
|
||||
.body;
|
||||
final res =
|
||||
(await client.get(
|
||||
Uri.parse("$baseUrl/api?m=search&l=8&q=$query"),
|
||||
headers: headers,
|
||||
)).body;
|
||||
final jsonResult = json.decode(res);
|
||||
List<MManga> animeList = [];
|
||||
for (var item in jsonResult["data"]) {
|
||||
@@ -60,16 +63,17 @@ class AnimePahe extends MProvider {
|
||||
@override
|
||||
Future<MManga> getDetail(String url) async {
|
||||
final statusList = [
|
||||
{"Currently Airing": 0, "Finished Airing": 1}
|
||||
{"Currently Airing": 0, "Finished Airing": 1},
|
||||
];
|
||||
MManga anime = MManga();
|
||||
final id = substringBefore(substringAfterLast(url, "?anime_id="), "&name=");
|
||||
final name = substringAfterLast(url, "&name=");
|
||||
final session = await getSession(name, id);
|
||||
final res = (await client.get(
|
||||
Uri.parse("$baseUrl/anime/$session?anime_id=$id"),
|
||||
headers: headers))
|
||||
.body;
|
||||
final res =
|
||||
(await client.get(
|
||||
Uri.parse("$baseUrl/anime/$session?anime_id=$id"),
|
||||
headers: headers,
|
||||
)).body;
|
||||
final document = parseHtml(res);
|
||||
final status =
|
||||
(document.xpathFirst('//div/p[contains(text(),"Status:")]/text()') ??
|
||||
@@ -85,8 +89,10 @@ class AnimePahe extends MProvider {
|
||||
.replaceAll("Studio:\n", "")
|
||||
.trim();
|
||||
anime.imageUrl = document.selectFirst("div.anime-poster a").attr("href");
|
||||
anime.genre =
|
||||
xpath(res, '//*[contains(@class,"anime-genre")]/ul/li/text()');
|
||||
anime.genre = xpath(
|
||||
res,
|
||||
'//*[contains(@class,"anime-genre")]/ul/li/text()',
|
||||
);
|
||||
final synonyms =
|
||||
(document.xpathFirst('//div/p[contains(text(),"Synonyms:")]/text()') ??
|
||||
"")
|
||||
@@ -105,7 +111,10 @@ class AnimePahe extends MProvider {
|
||||
}
|
||||
|
||||
Future<List<MChapter>> recursivePages(
|
||||
String url, String res, String session) async {
|
||||
String url,
|
||||
String res,
|
||||
String session,
|
||||
) async {
|
||||
final jsonResult = json.decode(res);
|
||||
final page = jsonResult["current_page"];
|
||||
final hasNextPage = page < jsonResult["last_page"];
|
||||
@@ -128,13 +137,15 @@ class AnimePahe extends MProvider {
|
||||
}
|
||||
|
||||
Future<String> getSession(String title, String animeId) async {
|
||||
final res = (await client.get(Uri.parse("$baseUrl/api?m=search&q=$title"),
|
||||
headers: headers))
|
||||
.body;
|
||||
final res =
|
||||
(await client.get(
|
||||
Uri.parse("$baseUrl/api?m=search&q=$title"),
|
||||
headers: headers,
|
||||
)).body;
|
||||
return substringBefore(
|
||||
substringAfter(
|
||||
substringAfter(res, "\"id\":$animeId"), "\"session\":\""),
|
||||
"\"");
|
||||
substringAfter(substringAfter(res, "\"id\":$animeId"), "\"session\":\""),
|
||||
"\"",
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -150,24 +161,35 @@ class AnimePahe extends MProvider {
|
||||
|
||||
for (var i = 0; i < buttons.length; i++) {
|
||||
final btn = buttons[i];
|
||||
final audio = btn.attr("data-audio"); // Get audio type (jpn/eng). Japanese or Dubbed.
|
||||
final audio = btn.attr(
|
||||
"data-audio",
|
||||
); // Get audio type (jpn/eng). Japanese or Dubbed.
|
||||
final kwikLink = btn.attr("data-src");
|
||||
final quality = btn.text;
|
||||
final paheWinLink = downloadLinks[i].attr("href");
|
||||
|
||||
|
||||
if (getPreferenceValue(source.id, "preffered_link_type")) {
|
||||
final noRedirectClient = Client(source,
|
||||
json.encode({"followRedirects": false, "useDartHttpClient": true}));
|
||||
final noRedirectClient = Client(
|
||||
source,
|
||||
json.encode({"followRedirects": false, "useDartHttpClient": true}),
|
||||
);
|
||||
final kwikHeaders =
|
||||
(await noRedirectClient.get(Uri.parse("${paheWinLink}/i"))).headers;
|
||||
final kwikUrl =
|
||||
"https://${substringAfterLast(getMapValue(json.encode(kwikHeaders), "location"), "https://")}";
|
||||
final reskwik = (await client
|
||||
.get(Uri.parse(kwikUrl), headers: {"Referer": "https://kwik.cx/"}));
|
||||
final matches = RegExp(r'\("(\S+)",\d+,"(\S+)",(\d+),(\d+)')
|
||||
.firstMatch(reskwik.body);
|
||||
final token = decrypt(matches!.group(1)!, matches.group(2)!,
|
||||
matches.group(3)!, int.parse(matches.group(4)!));
|
||||
final reskwik = (await client.get(
|
||||
Uri.parse(kwikUrl),
|
||||
headers: {"Referer": "https://kwik.cx/"},
|
||||
));
|
||||
final matches = RegExp(
|
||||
r'\("(\S+)",\d+,"(\S+)",(\d+),(\d+)',
|
||||
).firstMatch(reskwik.body);
|
||||
final token = decrypt(
|
||||
matches!.group(1)!,
|
||||
matches.group(2)!,
|
||||
matches.group(3)!,
|
||||
int.parse(matches.group(4)!),
|
||||
);
|
||||
final url = RegExp(r'action="([^"]+)"').firstMatch(token)!.group(1)!;
|
||||
final tok = RegExp(r'value="([^"]+)"').firstMatch(token)!.group(1)!;
|
||||
var code = 419;
|
||||
@@ -175,22 +197,27 @@ class AnimePahe extends MProvider {
|
||||
String location = "";
|
||||
|
||||
while (code != 302 && tries < 20) {
|
||||
String cookie =
|
||||
getMapValue(json.encode(res.request.headers), "cookie");
|
||||
String cookie = getMapValue(
|
||||
json.encode(res.request.headers),
|
||||
"cookie",
|
||||
);
|
||||
cookie +=
|
||||
"; ${getMapValue(json.encode(reskwik.headers), "set-cookie").replaceAll("path=/;", "")}";
|
||||
final resNo = await Client(
|
||||
source,
|
||||
json.encode(
|
||||
{"followRedirects": false, "useDartHttpClient": true}))
|
||||
.post(Uri.parse(url), headers: {
|
||||
"referer": reskwik.request.url.toString(),
|
||||
"cookie": cookie,
|
||||
"user-agent":
|
||||
getMapValue(json.encode(res.request.headers), "user-agent")
|
||||
}, body: {
|
||||
"_token": tok
|
||||
});
|
||||
source,
|
||||
json.encode({"followRedirects": false, "useDartHttpClient": true}),
|
||||
).post(
|
||||
Uri.parse(url),
|
||||
headers: {
|
||||
"referer": reskwik.request.url.toString(),
|
||||
"cookie": cookie,
|
||||
"user-agent": getMapValue(
|
||||
json.encode(res.request.headers),
|
||||
"user-agent",
|
||||
),
|
||||
},
|
||||
body: {"_token": tok},
|
||||
);
|
||||
code = resNo.statusCode;
|
||||
tries++;
|
||||
location = getMapValue(json.encode(resNo.headers), "location");
|
||||
@@ -205,17 +232,24 @@ class AnimePahe extends MProvider {
|
||||
..quality = quality;
|
||||
videos.add(video);
|
||||
} else {
|
||||
final ress = (await client.get(Uri.parse(kwikLink),
|
||||
headers: {"Referer": "https://animepahe.com"}));
|
||||
final ress = (await client.get(
|
||||
Uri.parse(kwikLink),
|
||||
headers: {"Referer": "https://animepahe.com"},
|
||||
));
|
||||
final script = substringAfterLast(
|
||||
xpath(ress.body,
|
||||
'//script[contains(text(),"eval(function")]/text()')
|
||||
.first,
|
||||
"eval(function(");
|
||||
xpath(
|
||||
ress.body,
|
||||
'//script[contains(text(),"eval(function")]/text()',
|
||||
).first,
|
||||
"eval(function(",
|
||||
);
|
||||
final videoUrl = substringBefore(
|
||||
substringAfter(unpackJsAndCombine("eval(function($script"),
|
||||
"const source=\\'"),
|
||||
"\\';");
|
||||
substringAfter(
|
||||
unpackJsAndCombine("eval(function($script"),
|
||||
"const source=\\'",
|
||||
),
|
||||
"\\';",
|
||||
);
|
||||
MVideo video = MVideo();
|
||||
video
|
||||
..url = videoUrl
|
||||
@@ -235,7 +269,8 @@ class AnimePahe extends MProvider {
|
||||
final n = cm.substring(0, b);
|
||||
double mx = 0;
|
||||
for (var index = 0; index < ctn.length; index++) {
|
||||
mx += (int.tryParse(ctn[ctn.length - index - 1], radix: 10) ?? 0.0)
|
||||
mx +=
|
||||
(int.tryParse(ctn[ctn.length - index - 1], radix: 10) ?? 0.0)
|
||||
.toInt() *
|
||||
(pow(sep, index));
|
||||
}
|
||||
@@ -269,12 +304,14 @@ class AnimePahe extends MProvider {
|
||||
|
||||
List<MVideo> sortVideos(List<MVideo> videos) {
|
||||
String quality = getPreferenceValue(source.id, "preferred_quality");
|
||||
String preferredAudio = getPreferenceValue(source.id, "preferred_audio"); // get user's audio preference
|
||||
|
||||
String preferredAudio = getPreferenceValue(
|
||||
source.id,
|
||||
"preferred_audio",
|
||||
); // get user's audio preference
|
||||
|
||||
videos.sort((MVideo a, MVideo b) {
|
||||
// Prioritize audio first.
|
||||
// Preferred Audio: Videos with matching preferred audio are ranked highest.
|
||||
// Prioritize audio first.
|
||||
// Preferred Audio: Videos with matching preferred audio are ranked highest.
|
||||
int audioMatchA = a.quality.contains(preferredAudio) ? 1 : 0;
|
||||
int audioMatchB = b.quality.contains(preferredAudio) ? 1 : 0;
|
||||
if (audioMatchA != audioMatchB) {
|
||||
@@ -310,40 +347,40 @@ class AnimePahe extends MProvider {
|
||||
List<dynamic> getSourcePreferences() {
|
||||
return [
|
||||
ListPreference(
|
||||
key: "preferred_domain",
|
||||
title: "Preferred domain",
|
||||
summary: "",
|
||||
valueIndex: 1,
|
||||
entries: [
|
||||
"animepahe.com",
|
||||
"animepahe.ru",
|
||||
"animepahe.org"
|
||||
],
|
||||
entryValues: [
|
||||
"https://animepahe.com",
|
||||
"https://animepahe.ru",
|
||||
"https://animepahe.org"
|
||||
]),
|
||||
key: "preferred_domain",
|
||||
title: "Preferred domain",
|
||||
summary: "",
|
||||
valueIndex: 1,
|
||||
entries: ["animepahe.com", "animepahe.ru", "animepahe.org"],
|
||||
entryValues: [
|
||||
"https://animepahe.com",
|
||||
"https://animepahe.ru",
|
||||
"https://animepahe.org",
|
||||
],
|
||||
),
|
||||
SwitchPreferenceCompat(
|
||||
key: "preffered_link_type",
|
||||
title: "Use HLS links",
|
||||
summary: "Enable this if you are having Cloudflare issues.",
|
||||
value: false),
|
||||
key: "preffered_link_type",
|
||||
title: "Use HLS links",
|
||||
summary: "Enable this if you are having Cloudflare issues.",
|
||||
value: false,
|
||||
),
|
||||
ListPreference(
|
||||
key: "preferred_quality",
|
||||
title: "Preferred Quality",
|
||||
summary: "",
|
||||
valueIndex: 0,
|
||||
entries: ["1080p", "720p", "360p"],
|
||||
entryValues: ["1080", "720", "360"]),
|
||||
|
||||
key: "preferred_quality",
|
||||
title: "Preferred Quality",
|
||||
summary: "",
|
||||
valueIndex: 0,
|
||||
entries: ["1080p", "720p", "360p"],
|
||||
entryValues: ["1080", "720", "360"],
|
||||
),
|
||||
|
||||
ListPreference(
|
||||
key: "preferred_audio", // Add new preference for audio
|
||||
title: "Preferred Audio",
|
||||
summary: "Select your preferred audio language (Japanese or English).",
|
||||
valueIndex: 0, // Default to Japanese (or whichever you prefer)
|
||||
entries: ["Japanese", "English"],
|
||||
entryValues: ["jpn", "eng"]),
|
||||
key: "preferred_audio", // Add new preference for audio
|
||||
title: "Preferred Audio",
|
||||
summary: "Select your preferred audio language (Japanese or English).",
|
||||
valueIndex: 0, // Default to Japanese (or whichever you prefer)
|
||||
entries: ["Japanese", "English"],
|
||||
entryValues: ["jpn", "eng"],
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,13 @@ const _animepaheVersion = "0.0.5";
|
||||
const _animepaheSourceCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/dart/anime/src/en/animepahe/animepahe.dart";
|
||||
Source _animepaheSource = Source(
|
||||
name: "AnimePahe",
|
||||
baseUrl: "https://www.animepahe.ru",
|
||||
lang: "en",
|
||||
typeSource: "single",
|
||||
iconUrl:
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/dart/anime/src/en/animepahe/icon.png",
|
||||
sourceCodeUrl: _animepaheSourceCodeUrl,
|
||||
version: _animepaheVersion,
|
||||
itemType: ItemType.anime);
|
||||
name: "AnimePahe",
|
||||
baseUrl: "https://www.animepahe.ru",
|
||||
lang: "en",
|
||||
typeSource: "single",
|
||||
iconUrl:
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/dart/anime/src/en/animepahe/icon.png",
|
||||
sourceCodeUrl: _animepaheSourceCodeUrl,
|
||||
version: _animepaheVersion,
|
||||
itemType: ItemType.anime,
|
||||
);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,12 +5,13 @@ const _gogoanimeVersion = "0.1.15";
|
||||
const _gogoanimeSourceCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/dart/anime/src/en/gogoanime/gogoanime.dart";
|
||||
Source _gogoanimeSource = Source(
|
||||
name: "Gogoanime",
|
||||
baseUrl: "https://anitaku.to",
|
||||
lang: "en",
|
||||
typeSource: "single",
|
||||
iconUrl:
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/dart/anime/src/en/gogoanime/icon.png",
|
||||
sourceCodeUrl: _gogoanimeSourceCodeUrl,
|
||||
version: _gogoanimeVersion,
|
||||
itemType: ItemType.anime);
|
||||
name: "Gogoanime",
|
||||
baseUrl: "https://anitaku.to",
|
||||
lang: "en",
|
||||
typeSource: "single",
|
||||
iconUrl:
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/dart/anime/src/en/gogoanime/icon.png",
|
||||
sourceCodeUrl: _gogoanimeSourceCodeUrl,
|
||||
version: _gogoanimeVersion,
|
||||
itemType: ItemType.anime,
|
||||
);
|
||||
|
||||
@@ -10,17 +10,21 @@ class NineAnimeTv extends MProvider {
|
||||
|
||||
@override
|
||||
Future<MPages> getPopular(int page) async {
|
||||
final res = (await client
|
||||
.get(Uri.parse("${source.baseUrl}/filter?sort=all&page=$page")))
|
||||
.body;
|
||||
final res =
|
||||
(await client.get(
|
||||
Uri.parse("${source.baseUrl}/filter?sort=all&page=$page"),
|
||||
)).body;
|
||||
return parseAnimeList(res);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<MPages> getLatestUpdates(int page) async {
|
||||
final res = (await client.get(Uri.parse(
|
||||
"${source.baseUrl}/filter?sort=recently_updated&page=$page")))
|
||||
.body;
|
||||
final res =
|
||||
(await client.get(
|
||||
Uri.parse(
|
||||
"${source.baseUrl}/filter?sort=recently_updated&page=$page",
|
||||
),
|
||||
)).body;
|
||||
return parseAnimeList(res);
|
||||
}
|
||||
|
||||
@@ -116,30 +120,36 @@ class NineAnimeTv extends MProvider {
|
||||
@override
|
||||
Future<MManga> getDetail(String url) async {
|
||||
final statusList = [
|
||||
{"Currently Airing": 0, "Finished Airing": 1}
|
||||
{"Currently Airing": 0, "Finished Airing": 1},
|
||||
];
|
||||
|
||||
final res = (await client.get(Uri.parse("${source.baseUrl}$url"))).body;
|
||||
MManga anime = MManga();
|
||||
final document = parseHtml(res);
|
||||
final infoElement = document.selectFirst("div.film-infor");
|
||||
final status = infoElement.xpathFirst(
|
||||
'//div[contains(text(),"Status:")]/following-sibling::div/span/text()') ??
|
||||
final status =
|
||||
infoElement.xpathFirst(
|
||||
'//div[contains(text(),"Status:")]/following-sibling::div/span/text()',
|
||||
) ??
|
||||
"";
|
||||
anime.status = parseStatus(status, statusList);
|
||||
anime.description =
|
||||
infoElement.selectFirst("div.film-description > p")?.text ?? "";
|
||||
anime.author = infoElement.xpathFirst(
|
||||
'//div[contains(text(),"Studios:")]/following-sibling::div/a/text()') ??
|
||||
anime.author =
|
||||
infoElement.xpathFirst(
|
||||
'//div[contains(text(),"Studios:")]/following-sibling::div/a/text()',
|
||||
) ??
|
||||
"";
|
||||
|
||||
anime.genre = infoElement.xpath(
|
||||
'//div[contains(text(),"Genre:")]/following-sibling::div/a/text()');
|
||||
'//div[contains(text(),"Genre:")]/following-sibling::div/a/text()',
|
||||
);
|
||||
final id = parseHtml(res).selectFirst("div[data-id]").attr("data-id");
|
||||
|
||||
final resEp =
|
||||
(await client.get(Uri.parse("${source.baseUrl}/ajax/episode/list/$id")))
|
||||
.body;
|
||||
(await client.get(
|
||||
Uri.parse("${source.baseUrl}/ajax/episode/list/$id"),
|
||||
)).body;
|
||||
final html = json.decode(resEp)["html"];
|
||||
|
||||
List<MChapter>? episodesList = [];
|
||||
@@ -163,9 +173,10 @@ class NineAnimeTv extends MProvider {
|
||||
|
||||
@override
|
||||
Future<List<MVideo>> getVideoList(String url) async {
|
||||
final res = (await client.get(
|
||||
Uri.parse("${source.baseUrl}/ajax/episode/servers?episodeId=$url")))
|
||||
.body;
|
||||
final res =
|
||||
(await client.get(
|
||||
Uri.parse("${source.baseUrl}/ajax/episode/servers?episodeId=$url"),
|
||||
)).body;
|
||||
|
||||
final html = json.decode(res)["html"];
|
||||
|
||||
@@ -178,9 +189,10 @@ class NineAnimeTv extends MProvider {
|
||||
final name = serverElement.text;
|
||||
final id = serverElement.attr("data-id");
|
||||
final subDub = serverElement.attr("data-type");
|
||||
final res = (await client
|
||||
.get(Uri.parse("${source.baseUrl}/ajax/episode/sources?id=$id")))
|
||||
.body;
|
||||
final res =
|
||||
(await client.get(
|
||||
Uri.parse("${source.baseUrl}/ajax/episode/sources?id=$id"),
|
||||
)).body;
|
||||
final epUrl = json.decode(res)["link"];
|
||||
List<MVideo> a = [];
|
||||
|
||||
@@ -214,17 +226,22 @@ class NineAnimeTv extends MProvider {
|
||||
Future<List<MVideo>> rapidCloudExtractor(String url, String name) async {
|
||||
final serverUrl = ['https://megacloud.tv', 'https://rapid-cloud.co'];
|
||||
|
||||
final serverType = url.startsWith('https://megacloud.tv') || url.startsWith('https://megacloud.club') ? 0 : 1;
|
||||
final serverType =
|
||||
url.startsWith('https://megacloud.tv') ||
|
||||
url.startsWith('https://megacloud.club')
|
||||
? 0
|
||||
: 1;
|
||||
final sourceUrl = [
|
||||
'/embed-2/ajax/e-1/getSources?id=',
|
||||
'/ajax/embed-6-v2/getSources?id='
|
||||
'/ajax/embed-6-v2/getSources?id=',
|
||||
];
|
||||
final sourceSpliter = ['/e-1/', '/embed-6-v2/'];
|
||||
final id = url.split(sourceSpliter[serverType]).last.split('?').first;
|
||||
final resServer = (await client.get(
|
||||
Uri.parse('${serverUrl[serverType]}${sourceUrl[serverType]}$id'),
|
||||
headers: {"X-Requested-With": "XMLHttpRequest"}))
|
||||
.body;
|
||||
final resServer =
|
||||
(await client.get(
|
||||
Uri.parse('${serverUrl[serverType]}${sourceUrl[serverType]}$id'),
|
||||
headers: {"X-Requested-With": "XMLHttpRequest"},
|
||||
)).body;
|
||||
final encrypted = getMapValue(resServer, "encrypted");
|
||||
String videoResJson = "";
|
||||
List<MVideo> videos = [];
|
||||
@@ -245,18 +262,21 @@ class NineAnimeTv extends MProvider {
|
||||
videoResJson = decryptAESCryptoJS(ciphertext, password);
|
||||
} else {
|
||||
videoResJson = json.encode(
|
||||
(json.decode(resServer)["sources"] as List<Map<String, dynamic>>));
|
||||
(json.decode(resServer)["sources"] as List<Map<String, dynamic>>),
|
||||
);
|
||||
}
|
||||
|
||||
String masterUrl =
|
||||
((json.decode(videoResJson) as List<Map<String, dynamic>>)
|
||||
.first)['file'];
|
||||
String type = ((json.decode(videoResJson) as List<Map<String, dynamic>>)
|
||||
.first)['type'];
|
||||
String type =
|
||||
((json.decode(videoResJson) as List<Map<String, dynamic>>)
|
||||
.first)['type'];
|
||||
|
||||
final tracks = (json.decode(resServer)['tracks'] as List)
|
||||
.where((e) => e['kind'] == 'captions' ? true : false)
|
||||
.toList();
|
||||
final tracks =
|
||||
(json.decode(resServer)['tracks'] as List)
|
||||
.where((e) => e['kind'] == 'captions' ? true : false)
|
||||
.toList();
|
||||
List<MTrack> subtitles = [];
|
||||
|
||||
for (var sub in tracks) {
|
||||
@@ -272,8 +292,10 @@ class NineAnimeTv extends MProvider {
|
||||
if (type == "hls") {
|
||||
final masterPlaylistRes = (await client.get(Uri.parse(masterUrl))).body;
|
||||
|
||||
for (var it in substringAfter(masterPlaylistRes, "#EXT-X-STREAM-INF:")
|
||||
.split("#EXT-X-STREAM-INF:")) {
|
||||
for (var it in substringAfter(
|
||||
masterPlaylistRes,
|
||||
"#EXT-X-STREAM-INF:",
|
||||
).split("#EXT-X-STREAM-INF:")) {
|
||||
final quality =
|
||||
"${substringBefore(substringBefore(substringAfter(substringAfter(it, "RESOLUTION="), "x"), ","), "\n")}p";
|
||||
|
||||
@@ -307,19 +329,22 @@ class NineAnimeTv extends MProvider {
|
||||
Future<List<List<int>>> generateIndexPairs(int serverType) async {
|
||||
final jsPlayerUrl = [
|
||||
"https://megacloud.tv/js/player/a/prod/e1-player.min.js",
|
||||
"https://rapid-cloud.co/js/player/prod/e6-player-v2.min.js"
|
||||
"https://rapid-cloud.co/js/player/prod/e6-player-v2.min.js",
|
||||
];
|
||||
final scriptText =
|
||||
(await client.get(Uri.parse(jsPlayerUrl[serverType]))).body;
|
||||
|
||||
final switchCode = scriptText.substring(
|
||||
scriptText.lastIndexOf('switch'), scriptText.indexOf('=partKey'));
|
||||
scriptText.lastIndexOf('switch'),
|
||||
scriptText.indexOf('=partKey'),
|
||||
);
|
||||
|
||||
List<int> indexes = [];
|
||||
for (var variableMatch
|
||||
in RegExp(r'=(\w+)').allMatches(switchCode).toList()) {
|
||||
final regex = RegExp(
|
||||
',${(variableMatch as RegExpMatch).group(1)}=((?:0x)?([0-9a-fA-F]+))');
|
||||
',${(variableMatch as RegExpMatch).group(1)}=((?:0x)?([0-9a-fA-F]+))',
|
||||
);
|
||||
Match? match = regex.firstMatch(scriptText);
|
||||
|
||||
if (match != null) {
|
||||
@@ -391,13 +416,13 @@ class NineAnimeTv extends MProvider {
|
||||
CheckBoxFilter("Super Power", "31"),
|
||||
CheckBoxFilter("Supernatural", "37"),
|
||||
CheckBoxFilter("Thriller", "41"),
|
||||
CheckBoxFilter("Vampire", "32")
|
||||
CheckBoxFilter("Vampire", "32"),
|
||||
]),
|
||||
GroupFilter("SeasonFilter", "Season", [
|
||||
CheckBoxFilter("Fall", "3"),
|
||||
CheckBoxFilter("Summer", "2"),
|
||||
CheckBoxFilter("Spring", "1"),
|
||||
CheckBoxFilter("Winter", "4")
|
||||
CheckBoxFilter("Winter", "4"),
|
||||
]),
|
||||
GroupFilter("YearFilter", "Year", [
|
||||
CheckBoxFilter("2024", "2024"),
|
||||
@@ -423,7 +448,7 @@ class NineAnimeTv extends MProvider {
|
||||
CheckBoxFilter("2004", "2004"),
|
||||
CheckBoxFilter("2003", "2003"),
|
||||
CheckBoxFilter("2002", "2002"),
|
||||
CheckBoxFilter("2001", "2001")
|
||||
CheckBoxFilter("2001", "2001"),
|
||||
]),
|
||||
SelectFilter("SortFilter", "Sort by", 0, [
|
||||
SelectFilterOption("All", "all"),
|
||||
@@ -433,7 +458,7 @@ class NineAnimeTv extends MProvider {
|
||||
SelectFilterOption("Score", "score"),
|
||||
SelectFilterOption("Name A-Z", "name_az"),
|
||||
SelectFilterOption("Released Date", "released_date"),
|
||||
SelectFilterOption("Most Watched", "most_watched")
|
||||
SelectFilterOption("Most Watched", "most_watched"),
|
||||
]),
|
||||
GroupFilter("TypeFilter", "Type", [
|
||||
CheckBoxFilter("Movie", "1"),
|
||||
@@ -441,16 +466,18 @@ class NineAnimeTv extends MProvider {
|
||||
CheckBoxFilter("OVA", "3"),
|
||||
CheckBoxFilter("ONA", "4"),
|
||||
CheckBoxFilter("Special", "5"),
|
||||
CheckBoxFilter("Music", "6")
|
||||
CheckBoxFilter("Music", "6"),
|
||||
]),
|
||||
SelectFilter("StatusFilter", "Status", 0, [
|
||||
SelectFilterOption("All", "all"),
|
||||
SelectFilterOption("Finished Airing", "1"),
|
||||
SelectFilterOption("Currently Airing", "2"),
|
||||
SelectFilterOption("Not yet aired", "3")
|
||||
SelectFilterOption("Not yet aired", "3"),
|
||||
]),
|
||||
GroupFilter("LanguageFilter", "Language", [
|
||||
CheckBoxFilter("Sub", "sub"),
|
||||
CheckBoxFilter("Dub", "dub"),
|
||||
]),
|
||||
GroupFilter("LanguageFilter", "Language",
|
||||
[CheckBoxFilter("Sub", "sub"), CheckBoxFilter("Dub", "dub")]),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -458,40 +485,45 @@ class NineAnimeTv extends MProvider {
|
||||
List<dynamic> getSourcePreferences() {
|
||||
return [
|
||||
ListPreference(
|
||||
key: "preferred_quality",
|
||||
title: "Preferred Quality",
|
||||
summary: "",
|
||||
valueIndex: 1,
|
||||
entries: ["1080p", "720p", "480p", "360p"],
|
||||
entryValues: ["1080", "720", "480", "360"]),
|
||||
key: "preferred_quality",
|
||||
title: "Preferred Quality",
|
||||
summary: "",
|
||||
valueIndex: 1,
|
||||
entries: ["1080p", "720p", "480p", "360p"],
|
||||
entryValues: ["1080", "720", "480", "360"],
|
||||
),
|
||||
ListPreference(
|
||||
key: "preferred_server",
|
||||
title: "Preferred server",
|
||||
summary: "",
|
||||
valueIndex: 0,
|
||||
entries: ["Vidstreaming", "VidCloud"],
|
||||
entryValues: ["Vidstreaming", "VidCloud"]),
|
||||
key: "preferred_server",
|
||||
title: "Preferred server",
|
||||
summary: "",
|
||||
valueIndex: 0,
|
||||
entries: ["Vidstreaming", "VidCloud"],
|
||||
entryValues: ["Vidstreaming", "VidCloud"],
|
||||
),
|
||||
ListPreference(
|
||||
key: "preferred_type",
|
||||
title: "Preferred Type",
|
||||
summary: "",
|
||||
valueIndex: 0,
|
||||
entries: ["Sub", "Dub"],
|
||||
entryValues: ["sub", "dub"]),
|
||||
key: "preferred_type",
|
||||
title: "Preferred Type",
|
||||
summary: "",
|
||||
valueIndex: 0,
|
||||
entries: ["Sub", "Dub"],
|
||||
entryValues: ["sub", "dub"],
|
||||
),
|
||||
MultiSelectListPreference(
|
||||
key: "hoster_selection",
|
||||
title: "Enable/Disable Hosts",
|
||||
summary: "",
|
||||
entries: ["Vidstreaming", "VidCloud"],
|
||||
entryValues: ["Vidstreaming", "Vidcloud"],
|
||||
values: ["Vidstreaming", "Vidcloud"]),
|
||||
key: "hoster_selection",
|
||||
title: "Enable/Disable Hosts",
|
||||
summary: "",
|
||||
entries: ["Vidstreaming", "VidCloud"],
|
||||
entryValues: ["Vidstreaming", "Vidcloud"],
|
||||
values: ["Vidstreaming", "Vidcloud"],
|
||||
),
|
||||
MultiSelectListPreference(
|
||||
key: "type_selection",
|
||||
title: "Enable/Disable Types",
|
||||
summary: "",
|
||||
entries: ["Sub", "Dub"],
|
||||
entryValues: ["sub", "dub"],
|
||||
values: ["sub", "dub"]),
|
||||
key: "type_selection",
|
||||
title: "Enable/Disable Types",
|
||||
summary: "",
|
||||
entries: ["Sub", "Dub"],
|
||||
entryValues: ["sub", "dub"],
|
||||
values: ["sub", "dub"],
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -5,12 +5,13 @@ const _nineanimetvVersion = "0.0.5";
|
||||
const _nineanimetvCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/dart/anime/src/en/nineanimetv/nineanimetv.dart";
|
||||
Source _nineanimetv = Source(
|
||||
name: "9AnimeTv",
|
||||
baseUrl: "https://9animetv.to",
|
||||
lang: "en",
|
||||
typeSource: "single",
|
||||
iconUrl:
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/dart/anime/src/en/nineanimetv/icon.png",
|
||||
sourceCodeUrl: _nineanimetvCodeUrl,
|
||||
version: _nineanimetvVersion,
|
||||
itemType: ItemType.anime);
|
||||
name: "9AnimeTv",
|
||||
baseUrl: "https://9animetv.to",
|
||||
lang: "en",
|
||||
typeSource: "single",
|
||||
iconUrl:
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/dart/anime/src/en/nineanimetv/icon.png",
|
||||
sourceCodeUrl: _nineanimetvCodeUrl,
|
||||
version: _nineanimetvVersion,
|
||||
itemType: ItemType.anime,
|
||||
);
|
||||
|
||||
@@ -5,12 +5,13 @@ const _uhdmoviesVersion = "0.0.45";
|
||||
const _uhdmoviesSourceCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/dart/anime/src/en/uhdmovies/uhdmovies.dart";
|
||||
Source _uhdmoviesSource = Source(
|
||||
name: "UHD Movies",
|
||||
baseUrl: "https://uhdmovies.fans",
|
||||
lang: "en",
|
||||
typeSource: "single",
|
||||
iconUrl:
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/dart/anime/src/en/uhdmovies/icon.png",
|
||||
sourceCodeUrl: _uhdmoviesSourceCodeUrl,
|
||||
version: _uhdmoviesVersion,
|
||||
itemType: ItemType.anime);
|
||||
name: "UHD Movies",
|
||||
baseUrl: "https://uhdmovies.fans",
|
||||
lang: "en",
|
||||
typeSource: "single",
|
||||
iconUrl:
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/$branchName/dart/anime/src/en/uhdmovies/icon.png",
|
||||
sourceCodeUrl: _uhdmoviesSourceCodeUrl,
|
||||
version: _uhdmoviesVersion,
|
||||
itemType: ItemType.anime,
|
||||
);
|
||||
|
||||
@@ -27,9 +27,10 @@ class UHDMovies extends MProvider {
|
||||
|
||||
@override
|
||||
Future<MPages> search(String query, int page, FilterList filterList) async {
|
||||
final res = (await client.get(
|
||||
Uri.parse("$baseUrl/page/$page/?s=${query.replaceAll(" ", "+")}")))
|
||||
.body;
|
||||
final res =
|
||||
(await client.get(
|
||||
Uri.parse("$baseUrl/page/$page/?s=${query.replaceAll(" ", "+")}"),
|
||||
)).body;
|
||||
return animeFromElement(res);
|
||||
}
|
||||
|
||||
@@ -43,10 +44,14 @@ class UHDMovies extends MProvider {
|
||||
anime.description = description.first;
|
||||
}
|
||||
anime.status = MStatus.ongoing;
|
||||
final episodesTitles = xpath(res,
|
||||
'//*[contains(@style, "center") or contains(@class, "maxbutton")]/a[contains(@class, "maxbutton") or contains(@href, "?sid=")]/text()');
|
||||
final episodesUrls = xpath(res,
|
||||
'//*[contains(@style, "center") or contains(@class, "maxbutton")]/a[contains(@class, "maxbutton") or contains(@href, "?sid=")]/@href');
|
||||
final episodesTitles = xpath(
|
||||
res,
|
||||
'//*[contains(@style, "center") or contains(@class, "maxbutton")]/a[contains(@class, "maxbutton") or contains(@href, "?sid=")]/text()',
|
||||
);
|
||||
final episodesUrls = xpath(
|
||||
res,
|
||||
'//*[contains(@style, "center") or contains(@class, "maxbutton")]/a[contains(@class, "maxbutton") or contains(@href, "?sid=")]/@href',
|
||||
);
|
||||
bool isSeries = false;
|
||||
if (episodesTitles.first.contains("Episode") ||
|
||||
episodesTitles.first.contains("Zip") ||
|
||||
@@ -56,8 +61,10 @@ class UHDMovies extends MProvider {
|
||||
List<MChapter>? episodesList = [];
|
||||
if (!isSeries) {
|
||||
List<String> moviesTitles = [];
|
||||
moviesTitles = xpath(res,
|
||||
'//*[contains(@style, "center") or contains(@class, "maxbutton")]/parent::p//preceding-sibling::p[contains(@style, "center")]/text()');
|
||||
moviesTitles = xpath(
|
||||
res,
|
||||
'//*[contains(@style, "center") or contains(@class, "maxbutton")]/parent::p//preceding-sibling::p[contains(@style, "center")]/text()',
|
||||
);
|
||||
List<String> titles = [];
|
||||
if (moviesTitles.isEmpty) {
|
||||
moviesTitles = xpath(res, '//p[contains(@style, "center")]/text()');
|
||||
@@ -82,8 +89,10 @@ class UHDMovies extends MProvider {
|
||||
}
|
||||
} else {
|
||||
List<String> seasonTitles = [];
|
||||
final episodeTitles = xpath(res,
|
||||
'//*[contains(@style, "center") or contains(@class, "maxbutton")]/parent::p//preceding-sibling::p[contains(@style, "center") and not(text()^="Episode")]/text()');
|
||||
final episodeTitles = xpath(
|
||||
res,
|
||||
'//*[contains(@style, "center") or contains(@class, "maxbutton")]/parent::p//preceding-sibling::p[contains(@style, "center") and not(text()^="Episode")]/text()',
|
||||
);
|
||||
List<String> titles = [];
|
||||
for (var title in episodeTitles) {
|
||||
if (title.isNotEmpty) {
|
||||
@@ -126,13 +135,14 @@ class UHDMovies extends MProvider {
|
||||
List<dynamic> getSourcePreferences() {
|
||||
return [
|
||||
EditTextPreference(
|
||||
key: "pref_domain_new",
|
||||
title: "Currently used domain",
|
||||
summary: "",
|
||||
value: "https://uhdmovies.fans",
|
||||
dialogTitle: "Currently used domain",
|
||||
dialogMessage: "",
|
||||
text: "https://uhdmovies.fans"),
|
||||
key: "pref_domain_new",
|
||||
title: "Currently used domain",
|
||||
summary: "",
|
||||
value: "https://uhdmovies.fans",
|
||||
dialogTitle: "Currently used domain",
|
||||
dialogMessage: "",
|
||||
text: "https://uhdmovies.fans",
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -146,8 +156,9 @@ class UHDMovies extends MProvider {
|
||||
final link = links[i];
|
||||
String decodedLink = link;
|
||||
if (!link.contains("workers.dev")) {
|
||||
decodedLink = utf8
|
||||
.decode(base64Url.decode(substringAfter(link, "download?url=")));
|
||||
decodedLink = utf8.decode(
|
||||
base64Url.decode(substringAfter(link, "download?url=")),
|
||||
);
|
||||
}
|
||||
MVideo video = MVideo();
|
||||
video
|
||||
@@ -184,18 +195,25 @@ class UHDMovies extends MProvider {
|
||||
final js = xpath(lastDoc, '//script[contains(text(), "/?go=")]/text()');
|
||||
if (js.isEmpty) return "";
|
||||
String script = js.first;
|
||||
String nextUrl =
|
||||
substringBefore(substringAfter(script, "\"href\",\""), '"');
|
||||
String nextUrl = substringBefore(
|
||||
substringAfter(script, "\"href\",\""),
|
||||
'"',
|
||||
);
|
||||
if (!nextUrl.contains("http")) return "";
|
||||
String cookieName = substringAfter(nextUrl, "go=");
|
||||
String cookieValue =
|
||||
substringBefore(substringAfter(script, "'$cookieName', '"), "'");
|
||||
final response = (await client.get(Uri.parse(nextUrl),
|
||||
headers: {"referer": url, "Cookie": "$cookieName=$cookieValue"}))
|
||||
.body;
|
||||
String cookieValue = substringBefore(
|
||||
substringAfter(script, "'$cookieName', '"),
|
||||
"'",
|
||||
);
|
||||
final response =
|
||||
(await client.get(
|
||||
Uri.parse(nextUrl),
|
||||
headers: {"referer": url, "Cookie": "$cookieName=$cookieValue"},
|
||||
)).body;
|
||||
|
||||
final lastRes =
|
||||
parseHtml(response).selectFirst("meta[http-equiv]").attr("content");
|
||||
final lastRes = parseHtml(
|
||||
response,
|
||||
).selectFirst("meta[http-equiv]").attr("content");
|
||||
return substringAfter(lastRes, "url=");
|
||||
}
|
||||
|
||||
@@ -222,9 +240,12 @@ class UHDMovies extends MProvider {
|
||||
final name = xpath(html, '//input/@name').first;
|
||||
final value = xpath(html, '//input/@value').first;
|
||||
final body = {"$name": value};
|
||||
final response = (await client.post(Uri.parse(urlR.first),
|
||||
headers: {"referer": url}, body: body))
|
||||
.body;
|
||||
final response =
|
||||
(await client.post(
|
||||
Uri.parse(urlR.first),
|
||||
headers: {"referer": url},
|
||||
body: body,
|
||||
)).body;
|
||||
return recursiveDoc(url, response);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user