mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 19:01:15 +00:00
Refactor
This commit is contained in:
@@ -1,26 +1,21 @@
|
||||
import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
getPopularAnime(MangaModel anime) async {
|
||||
getPopularAnime(MManga anime) async {
|
||||
final data = {"url": "${anime.baseUrl}/most-popular?page=${anime.page}"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
}
|
||||
|
||||
return animeElementM(res, anime);
|
||||
}
|
||||
|
||||
getLatestUpdatesAnime(MangaModel anime) async {
|
||||
getLatestUpdatesAnime(MManga anime) async {
|
||||
final data = {"url": "${anime.baseUrl}/top-airing?page=${anime.page}"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
}
|
||||
|
||||
return animeElementM(res, anime);
|
||||
}
|
||||
|
||||
getAnimeDetail(MangaModel anime) async {
|
||||
getAnimeDetail(MManga anime) async {
|
||||
final statusList = [
|
||||
{
|
||||
"Currently Airing": 0,
|
||||
@@ -107,18 +102,16 @@ getAnimeDetail(MangaModel anime) async {
|
||||
return anime;
|
||||
}
|
||||
|
||||
searchAnime(MangaModel anime) async {
|
||||
searchAnime(MManga anime) async {
|
||||
final data = {
|
||||
"url": "${anime.baseUrl}/search?keyword=${anime.query}&page=${anime.page}"
|
||||
};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
}
|
||||
|
||||
return animeElementM(res, anime);
|
||||
}
|
||||
|
||||
getVideoList(MangaModel anime) async {
|
||||
getVideoList(MManga anime) async {
|
||||
final id = MBridge.substringAfterLast(anime.link, '?ep=');
|
||||
final datas = {
|
||||
"url":
|
||||
@@ -152,7 +145,7 @@ getVideoList(MangaModel anime) async {
|
||||
attributes: "data-type",
|
||||
typeRegExp: 0);
|
||||
|
||||
List<VideoModel> videos = [];
|
||||
List<MVideo> videos = [];
|
||||
|
||||
for (var i = 0; i < names.length; i++) {
|
||||
final name = names[i];
|
||||
@@ -168,7 +161,7 @@ getVideoList(MangaModel anime) async {
|
||||
String url = MBridge.substringBefore(
|
||||
MBridge.substringAfter(resE, "\"link\":\""), "\"");
|
||||
print(url);
|
||||
List<VideoModel> a = [];
|
||||
List<MVideo> a = [];
|
||||
if (name.contains("Vidstreaming")) {
|
||||
a = await MBridge.rapidCloudExtractor(url, "Vidstreaming - $subDub");
|
||||
videos.addAll(a);
|
||||
@@ -184,7 +177,7 @@ getVideoList(MangaModel anime) async {
|
||||
return videos;
|
||||
}
|
||||
|
||||
MangaModel animeElementM(String res, MangaModel anime) async {
|
||||
MManga animeElementM(String res, MManga anime) async {
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import '../../../../model/source.dart';
|
||||
import '../../../../utils/utils.dart';
|
||||
|
||||
const aniwatchVersion = "0.0.21";
|
||||
const aniwatchVersion = "0.0.3";
|
||||
const aniwatchSourceCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/en/aniwatch/aniwatch-v$aniwatchVersion.dart";
|
||||
|
||||
@@ -15,7 +15,6 @@ List<Source> _aniwatchSourcesList = [
|
||||
iconUrl: getIconUrl("aniwatch", "en"),
|
||||
version: aniwatchVersion,
|
||||
isManga: false,
|
||||
appMinVerReq: "0.0.45",
|
||||
sourceCodeUrl: aniwatchSourceCodeUrl),
|
||||
Source(
|
||||
name: "Kaido.to",
|
||||
@@ -25,6 +24,5 @@ List<Source> _aniwatchSourcesList = [
|
||||
iconUrl: getIconUrl("kaido", "en"),
|
||||
version: aniwatchVersion,
|
||||
isManga: false,
|
||||
appMinVerReq: "0.0.45",
|
||||
sourceCodeUrl: aniwatchSourceCodeUrl),
|
||||
];
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
getPopularAnime(MangaModel anime) async {
|
||||
getPopularAnime(MManga anime) async {
|
||||
final data = {"url": "${anime.baseUrl}/popular.html?page=${anime.page}"};
|
||||
final res = await MBridge.http('GET', json.encode(data));
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
}
|
||||
anime.urls = MBridge.xpath(res, '//*[@class="img"]/a/@href');
|
||||
|
||||
anime.names = MBridge.xpath(res, '//*[@class="img"]/a/@title');
|
||||
|
||||
anime.images = MBridge.xpath(res, '//*[@class="img"]/a/img/@src');
|
||||
|
||||
return anime;
|
||||
}
|
||||
|
||||
getLatestUpdatesAnime(MangaModel anime) async {
|
||||
getLatestUpdatesAnime(MManga anime) async {
|
||||
final url =
|
||||
"https://ajax.gogo-load.com/ajax/page-recent-release-ongoing.html?page=${anime.page}&type=1";
|
||||
final data = {"url": url};
|
||||
@@ -26,7 +23,6 @@ getLatestUpdatesAnime(MangaModel anime) async {
|
||||
}
|
||||
anime.urls = MBridge.xpath(
|
||||
res, '//*[@class="added_series_body popular"]/ul/li/a[1]/@href');
|
||||
|
||||
anime.names = MBridge.xpath(
|
||||
res, '//*[//*[@class="added_series_body popular"]/ul/li/a[1]/@title');
|
||||
List<String> images = [];
|
||||
@@ -41,7 +37,7 @@ getLatestUpdatesAnime(MangaModel anime) async {
|
||||
return anime;
|
||||
}
|
||||
|
||||
getAnimeDetail(MangaModel anime) async {
|
||||
getAnimeDetail(MManga anime) async {
|
||||
final statusList = [
|
||||
{
|
||||
"Ongoing": 0,
|
||||
@@ -59,12 +55,10 @@ getAnimeDetail(MangaModel anime) async {
|
||||
res, '//*[@class="anime_info_body_bg"]/p[@class="type"][5]/text()')
|
||||
.first
|
||||
.replaceAll("Status: ", "");
|
||||
|
||||
anime.description = MBridge.xpath(
|
||||
res, '//*[@class="anime_info_body_bg"]/p[@class="type"][2]/text()')
|
||||
.first
|
||||
.replaceAll("Plot Summary: ", "");
|
||||
|
||||
anime.status = MBridge.parseStatus(status, statusList);
|
||||
anime.genre = MBridge.xpath(
|
||||
res, '//*[@class="anime_info_body_bg"]/p[@class="type"][3]/text()')
|
||||
@@ -91,7 +85,7 @@ getAnimeDetail(MangaModel anime) async {
|
||||
return anime;
|
||||
}
|
||||
|
||||
getVideoList(MangaModel anime) async {
|
||||
getVideoList(MManga anime) async {
|
||||
final datas = {"url": "${anime.baseUrl}${anime.link}"};
|
||||
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
@@ -104,13 +98,12 @@ getVideoList(MangaModel anime) async {
|
||||
MBridge.xpath(res, '//*[@class="anime_muti_link"]/ul/li/a/@data-video');
|
||||
final classNames =
|
||||
MBridge.xpath(res, '//*[@class="anime_muti_link"]/ul/li/@class');
|
||||
print(serverUrls);
|
||||
List<VideoModel> videos = [];
|
||||
List<MVideo> videos = [];
|
||||
for (var i = 0; i < classNames.length; i++) {
|
||||
final name = classNames[i];
|
||||
final url = serverUrls[i];
|
||||
print(url);
|
||||
List<VideoModel> a = [];
|
||||
List<MVideo> a = [];
|
||||
if (name.contains("anime")) {
|
||||
a = await MBridge.gogoCdnExtractor(url);
|
||||
} else if (name.contains("vidcdn")) {
|
||||
@@ -131,7 +124,7 @@ getVideoList(MangaModel anime) async {
|
||||
return videos;
|
||||
}
|
||||
|
||||
searchAnime(MangaModel anime) async {
|
||||
searchAnime(MManga anime) async {
|
||||
final url =
|
||||
"${anime.baseUrl}/search.html?keyword=${anime.query}&page=${anime.page}";
|
||||
final data = {"url": url};
|
||||
@@ -140,9 +133,7 @@ searchAnime(MangaModel anime) async {
|
||||
return anime;
|
||||
}
|
||||
anime.urls = MBridge.xpath(res, '//*[@class="img"]/a/@href');
|
||||
|
||||
anime.names = MBridge.xpath(res, '//*[@class="img"]/a/@title');
|
||||
|
||||
anime.images = MBridge.xpath(res, '//*[@class="img"]/a/img/@src');
|
||||
return anime;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import '../../../../model/source.dart';
|
||||
import '../../../../utils/utils.dart';
|
||||
|
||||
Source get gogoanimeSource => _gogoanimeSource;
|
||||
const gogoanimeVersion = "0.0.2";
|
||||
const gogoanimeVersion = "0.0.3";
|
||||
const gogoanimeSourceCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/en/gogoanime/gogoanime-v$gogoanimeVersion.dart";
|
||||
Source _gogoanimeSource = Source(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
getPopularAnime(MangaModel anime) async {
|
||||
getPopularAnime(MManga anime) async {
|
||||
final data = {
|
||||
"url":
|
||||
"${anime.baseUrl}/api/DramaList/List?page=${anime.page}&type=0&sub=0&country=0&status=0&order=1&pageSize=40"
|
||||
@@ -24,7 +24,7 @@ getPopularAnime(MangaModel anime) async {
|
||||
return anime;
|
||||
}
|
||||
|
||||
getLatestUpdatesAnime(MangaModel anime) async {
|
||||
getLatestUpdatesAnime(MManga anime) async {
|
||||
final data = {
|
||||
"url":
|
||||
"${anime.baseUrl}/api/DramaList/List?page=${anime.page}&type=0&sub=0&country=0&status=0&order=12&pageSize=40"
|
||||
@@ -48,7 +48,7 @@ getLatestUpdatesAnime(MangaModel anime) async {
|
||||
return anime;
|
||||
}
|
||||
|
||||
getAnimeDetail(MangaModel anime) async {
|
||||
getAnimeDetail(MManga anime) async {
|
||||
final statusList = [
|
||||
{
|
||||
"Ongoing": 0,
|
||||
@@ -72,10 +72,10 @@ getAnimeDetail(MangaModel anime) async {
|
||||
final episodesCount = jsonRes["episodesCount"] as int;
|
||||
List<String> episodesNames = [];
|
||||
List<String> episodesUrls = [];
|
||||
bool containsAnime = type.contains("Anime") as bool;
|
||||
bool containsTVSeries = type.contains("TVSeries") as bool;
|
||||
bool containsHollywood = type.contains("Hollywood") as bool;
|
||||
bool containsMovie = type.contains("Movie") as bool;
|
||||
final containsAnime = type.contains("Anime") as bool;
|
||||
final containsTVSeries = type.contains("TVSeries") as bool;
|
||||
final containsHollywood = type.contains("Hollywood") as bool;
|
||||
final containsMovie = type.contains("Movie") as bool;
|
||||
for (var a in episodes) {
|
||||
String number = (a["number"] as double).toString().replaceAll(".0", "");
|
||||
final id = a["id"];
|
||||
@@ -96,7 +96,7 @@ getAnimeDetail(MangaModel anime) async {
|
||||
return anime;
|
||||
}
|
||||
|
||||
getVideoList(MangaModel anime) async {
|
||||
getVideoList(MManga anime) async {
|
||||
final datas = {"url": anime.link};
|
||||
|
||||
final res = await MBridge.http('GET', json.encode(datas));
|
||||
@@ -111,13 +111,13 @@ getVideoList(MangaModel anime) async {
|
||||
'GET', json.encode({"url": "${anime.baseUrl}/api/Sub/$id"}));
|
||||
var jsonSubRes = json.decode(subRes);
|
||||
|
||||
List<TrackModel> subtitles = [];
|
||||
List<MTrack> subtitles = [];
|
||||
|
||||
for (var sub in jsonSubRes) {
|
||||
try {
|
||||
final subUrl = sub["src"];
|
||||
final label = sub["label"];
|
||||
TrackModel subtitle = TrackModel();
|
||||
MTrack subtitle = MTrack();
|
||||
subtitle
|
||||
..label = label
|
||||
..file = subUrl;
|
||||
@@ -126,7 +126,7 @@ getVideoList(MangaModel anime) async {
|
||||
}
|
||||
|
||||
final videoUrl = jsonRes["Video"];
|
||||
VideoModel video = VideoModel();
|
||||
MVideo video = MVideo();
|
||||
video
|
||||
..url = videoUrl
|
||||
..originalUrl = videoUrl
|
||||
@@ -139,7 +139,7 @@ getVideoList(MangaModel anime) async {
|
||||
return [video];
|
||||
}
|
||||
|
||||
searchAnime(MangaModel anime) async {
|
||||
searchAnime(MManga anime) async {
|
||||
final data = {
|
||||
"url": "${anime.baseUrl}/api/DramaList/Search?q=${anime.query}&type=0"
|
||||
};
|
||||
@@ -148,11 +148,8 @@ searchAnime(MangaModel anime) async {
|
||||
return anime;
|
||||
}
|
||||
var jsonRes = json.decode(res) as List;
|
||||
|
||||
anime.names = jsonRes.map((e) => e["title"]).toList();
|
||||
|
||||
anime.images = jsonRes.map((e) => e["thumbnail"] ?? "").toList();
|
||||
|
||||
anime.urls = jsonRes
|
||||
.map((e) => "${anime.baseUrl}/api/DramaList/Drama/${e["id"]}?isq=false")
|
||||
.toList();
|
||||
@@ -2,7 +2,7 @@ import '../../../../model/source.dart';
|
||||
import '../../../../utils/utils.dart';
|
||||
|
||||
Source get kisskhSource => _kisskhSource;
|
||||
const kisskhVersion = "0.0.1";
|
||||
const kisskhVersion = "0.0.2";
|
||||
const kisskhSourceCodeUrl =
|
||||
"https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/anime/src/en/kisskh/kisskh-v$kisskhVersion.dart";
|
||||
Source _kisskhSource = Source(
|
||||
@@ -13,5 +13,4 @@ Source _kisskhSource = Source(
|
||||
iconUrl: getIconUrl("kisskh", "en"),
|
||||
sourceCodeUrl: kisskhSourceCodeUrl,
|
||||
version: kisskhVersion,
|
||||
appMinVerReq: "0.0.48",
|
||||
isManga: false);
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import '../../../../model/source.dart';
|
||||
import '../../../../utils/utils.dart';
|
||||
|
||||
Source get wcostreamSource => _wcostreamSource;
|
||||
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(
|
||||
name: "WCOStream",
|
||||
baseUrl: "https://www.wcostream.org",
|
||||
lang: "en",
|
||||
typeSource: "single",
|
||||
iconUrl: getIconUrl("wcostream", "en"),
|
||||
sourceCodeUrl: wcostreamSourceCodeUrl,
|
||||
version: wcostreamVersion,
|
||||
isManga: false,
|
||||
isFullData: false);
|
||||
@@ -1,223 +0,0 @@
|
||||
import 'dart:convert';
|
||||
import 'package:bridge_lib/bridge_lib.dart';
|
||||
|
||||
getPopularAnime(MangaModel anime) async {
|
||||
return await getLatestUpdatesAnime(anime);
|
||||
}
|
||||
|
||||
Future<MangaModel> getLatestUpdatesAnime(MangaModel anime) async {
|
||||
final data = {
|
||||
"url": anime.baseUrl,
|
||||
"headers": {"referer": "https://wcostream.org/"},
|
||||
"sourceId": anime.sourceId
|
||||
};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
}
|
||||
final urlss = MBridge.xpath(
|
||||
res,
|
||||
'//*[@id="content"]/div/div[contains(text(),"Recent Releases")]/div/ul/li/div[@class="img"]/a/img/@alt',
|
||||
'._')
|
||||
.split('._');
|
||||
List<String> 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',
|
||||
'._')
|
||||
.split('._');
|
||||
List<String> images = [];
|
||||
for (var image in MBridge.listParse(imagess, 0)) {
|
||||
images.add(fixUrl(image));
|
||||
}
|
||||
anime.images = images;
|
||||
final namess = MBridge.xpath(
|
||||
res,
|
||||
'//*[@id="content"]/div/div[contains(text(),"Recent Releases")]/div/ul/li/div[@class="recent-release-episodes"]/a/text()',
|
||||
'._')
|
||||
.split('._');
|
||||
List<String> names = [];
|
||||
for (var name in MBridge.listParse(namess, 0)) {
|
||||
names.add(MBridge.subString(name, ' Episode', 0));
|
||||
}
|
||||
anime.names = names;
|
||||
anime.hasNextPage = false;
|
||||
return anime;
|
||||
}
|
||||
|
||||
String fixUrl(String url) {
|
||||
return MBridge.regExp(url, r"^(?:(?:https?:)?//|www\.)", 'https://', 0, 0);
|
||||
}
|
||||
|
||||
getAnimeDetail(MangaModel anime) async {
|
||||
final url = '${anime.baseUrl}${anime.link}';
|
||||
print(url);
|
||||
final data = {
|
||||
"url": url,
|
||||
"headers": {"referer": "https://wcostream.org/"}
|
||||
};
|
||||
final res = await MBridge.http(json.encode(data), 0);
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
}
|
||||
|
||||
anime.status = 5;
|
||||
anime.description = MBridge.xpath(
|
||||
res,
|
||||
'//*[@class="katcont"]/div/p[contains(text(),"Plot Summary:")]/text()',
|
||||
'')
|
||||
.replaceAll('Plot Summary: ', '');
|
||||
|
||||
anime.genre = MBridge.xpath(
|
||||
res, '//*[@id="cat-genre"]/div[@class="wcobtn"]/a/text()', '._')
|
||||
.split('._');
|
||||
|
||||
anime.urls = MBridge.xpath(
|
||||
res,
|
||||
'//*[@id="catlist-listview" and @class^="cat-listview"]/ul/li/a/@href',
|
||||
'._')
|
||||
.split('._');
|
||||
anime.names = MBridge.xpath(
|
||||
res,
|
||||
'//*[@id="catlist-listview" and @class^="cat-listview"]/ul/li/a/text()',
|
||||
'._')
|
||||
.split('._');
|
||||
anime.chaptersDateUploads = [];
|
||||
return anime;
|
||||
}
|
||||
|
||||
searchAnime(MangaModel anime) async {
|
||||
final data = {
|
||||
"url": "${anime.baseUrl}/search",
|
||||
"fields": {'catara': anime.query.replaceAll(" ", "+"), 'konuara': 'series'},
|
||||
"headers": {"Referer": "${anime.baseUrl}/"},
|
||||
"sourceId": anime.sourceId
|
||||
};
|
||||
final res = await MBridge.httpMultiparFormData(json.encode(data), 1);
|
||||
if (res.isEmpty) {
|
||||
return anime;
|
||||
}
|
||||
|
||||
anime.urls = MBridge.xpath(
|
||||
res,
|
||||
'//*[@id="blog"]/div[@class="cerceve"]/div[@class="iccerceve"]/a/@href',
|
||||
'._')
|
||||
.split('._');
|
||||
|
||||
anime.names = MBridge.xpath(
|
||||
res,
|
||||
'//*[@id="blog"]/div[@class="cerceve"]/div[@class="iccerceve"]/a/@title',
|
||||
'._')
|
||||
.split('._');
|
||||
anime.images = MBridge.xpath(
|
||||
res,
|
||||
'//*[@id="blog"]/div[@class="cerceve"]/div[@class="iccerceve"]/a/img/@src',
|
||||
'._')
|
||||
.split('._');
|
||||
anime.hasNextPage = false;
|
||||
return anime;
|
||||
}
|
||||
|
||||
getVideoList(MangaModel anime) async {
|
||||
final datas = {
|
||||
"url": anime.link,
|
||||
"headers": null,
|
||||
"sourceId": anime.sourceId
|
||||
};
|
||||
|
||||
final res = await MBridge.http(json.encode(datas), 0);
|
||||
|
||||
if (res.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
final script = MBridge.xpath(
|
||||
res, '//script[contains(text(), "decodeURIComponent")]/text()', "");
|
||||
final stringList = MBridge.jsonDecodeToList(
|
||||
"[${MBridge.subString(MBridge.subString(script, '[', 2), ']', 0)}]", 0);
|
||||
final shiftNumber = MBridge.intParse(
|
||||
MBridge.subString(MBridge.subString(script, '- ', 1), ')', 0));
|
||||
|
||||
print(shiftNumber - 1);
|
||||
List<String> iframeStuff = [];
|
||||
for (var i = 0; i < stringList.length; i++) {
|
||||
final decoded = MBridge.bAse64(MBridge.listParse(stringList, 0)[i], 0);
|
||||
final intValue =
|
||||
MBridge.intParse(MBridge.regExp(decoded, r"""\D""", '', 0, 0));
|
||||
iframeStuff
|
||||
.add(MBridge.stringParse("${intValue - shiftNumber}".toString(), 1));
|
||||
}
|
||||
|
||||
final iframeUrl =
|
||||
MBridge.xpath(MBridge.listParse(iframeStuff, 6)[0], '//iframe/@src', "");
|
||||
final iframeHeaders = {
|
||||
'Accept':
|
||||
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
|
||||
'Connection': 'keep-alive',
|
||||
'Host': MBridge.listParse(iframeUrl.split('/'), 0)[2],
|
||||
'Referer': '${anime.baseUrl}/',
|
||||
'Sec-Fetch-Dest': 'iframe',
|
||||
'Sec-Fetch-Mode': 'navigate',
|
||||
'Sec-Fetch-Site': 'cross-site',
|
||||
'Upgrade-Insecure-Requests': '1',
|
||||
'User-Agent':
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36 Edg/88.0.705.63',
|
||||
};
|
||||
final datasIframe = {"url": iframeUrl, "headers": iframeHeaders};
|
||||
|
||||
final resIframe = await MBridge.http(json.encode(datasIframe), 0);
|
||||
final getVideoLinkScript = MBridge.xpath(
|
||||
resIframe, '//script[contains(text(), "getJSON")]/text()', "");
|
||||
|
||||
final getVideoLinkUrl = MBridge.subString(
|
||||
MBridge.subString(getVideoLinkScript, "getJSON(\"", 2), "\"", 0);
|
||||
final getVideoHeaders = {
|
||||
'Accept': 'application/json, text/javascript, */*; q=0.01',
|
||||
'Host': MBridge.listParse(iframeUrl.split('/'), 0)[2],
|
||||
'Referer': iframeUrl,
|
||||
'User-Agent':
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36 Edg/88.0.705.63',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
};
|
||||
final datasVideoLink = {
|
||||
"url":
|
||||
'https://${MBridge.listParse(iframeUrl.split('/'), 0)[2]}$getVideoLinkUrl',
|
||||
"headers": getVideoHeaders
|
||||
};
|
||||
|
||||
final resVideoLink = await MBridge.http(json.encode(datasVideoLink), 0);
|
||||
final server = MBridge.getMapValue(resVideoLink, "server", 0);
|
||||
final enc = MBridge.getMapValue(resVideoLink, "enc", 0);
|
||||
final hd = MBridge.getMapValue(resVideoLink, "hd", 0);
|
||||
final fhd = MBridge.getMapValue(resVideoLink, "fhd", 0);
|
||||
final videoUrl = "$server/getvid?evid=$enc";
|
||||
|
||||
final videoHeaders = {
|
||||
'Accept':
|
||||
'video/webm,video/ogg,video/*;q=0.9,application/ogg;q=0.7,audio/*;q=0.6,*/*;q=0.5',
|
||||
'Host': MBridge.listParse(videoUrl.split('/'), 0)[2],
|
||||
'Referer': MBridge.listParse(iframeUrl.split('/'), 0)[2],
|
||||
'User-Agent':
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36 Edg/88.0.705.63',
|
||||
};
|
||||
List<VideoModel> videos = [];
|
||||
videos.add(MBridge.toVideo(
|
||||
videoUrl, "Video 480p", videoUrl, json.encode(videoHeaders)));
|
||||
if (hd.isEmpty) {
|
||||
} else {
|
||||
final hdVideoUrl = "$server/getvid?evid=$hd";
|
||||
videos.add(MBridge.toVideo(
|
||||
hdVideoUrl, "Video 720p", hdVideoUrl, json.encode(videoHeaders)));
|
||||
}
|
||||
if (fhd.isEmpty) {
|
||||
} else {
|
||||
final fhdVideoUrl = "$server/getvid?evid=$fhd";
|
||||
videos.add(MBridge.toVideo(
|
||||
fhdVideoUrl, "Video 1080p", fhdVideoUrl, json.encode(videoHeaders)));
|
||||
}
|
||||
return videos;
|
||||
}
|
||||
Reference in New Issue
Block a user