extension(autembed): Added vidapi server

This commit is contained in:
Swakshan
2025-01-03 18:30:48 +05:30
parent 9f97d0d486
commit 8229e582ec

View File

@@ -6,7 +6,7 @@ const mangayomiSources = [{
"iconUrl": "https://www.google.com/s2/favicons?sz=64&domain=https://autoembed.cc/", "iconUrl": "https://www.google.com/s2/favicons?sz=64&domain=https://autoembed.cc/",
"typeSource": "multi", "typeSource": "multi",
"isManga": false, "isManga": false,
"version": "1.1.3", "version": "1.1.4",
"dateFormat": "", "dateFormat": "",
"dateFormatLocale": "", "dateFormatLocale": "",
"pkgPath": "anime/src/all/autoembed.js" "pkgPath": "anime/src/all/autoembed.js"
@@ -152,6 +152,8 @@ class DefaultExtension extends MProvider {
chaps.reverse(); chaps.reverse();
return item; return item;
} }
// Extracts the streams url for different resolutions from a hls stream.
async extractStreams(url, lang = "", hdr = {}) { async extractStreams(url, lang = "", hdr = {}) {
const response = await new Client().get(url); const response = await new Client().get(url);
const body = response.body; const body = response.body;
@@ -180,6 +182,7 @@ class DefaultExtension extends MProvider {
} }
// For some streams, we can form stream url using a default template.
async splitStreams(url, lang = "", hdr = {}) { async splitStreams(url, lang = "", hdr = {}) {
var streams = []; var streams = [];
var quality = ["auto", "360", "480", "720", "1080"] var quality = ["auto", "360", "480", "720", "1080"]
@@ -199,7 +202,7 @@ class DefaultExtension extends MProvider {
return streams; return streams;
} }
// Sorts streams based on user preference.
async sortStreams(streams) { async sortStreams(streams) {
var sortedStreams = []; var sortedStreams = [];
@@ -219,6 +222,7 @@ class DefaultExtension extends MProvider {
return [...sortedStreams, ...copyStreams] return [...sortedStreams, ...copyStreams]
} }
// Gets subtitles based on TMDB id.
async getSubtitleList(id, s, e) { async getSubtitleList(id, s, e) {
var api = `https://sub.wyzie.ru/search?id=${id}` var api = `https://sub.wyzie.ru/search?id=${id}`
if (s != "0") api = `${api}&season=${s}&episode=${e}` if (s != "0") api = `${api}&season=${s}&episode=${e}`
@@ -272,7 +276,6 @@ class DefaultExtension extends MProvider {
}); });
break; break;
} }
case 3: { case 3: {
var s = "0" var s = "0"
var e = "0" var e = "0"
@@ -343,6 +346,23 @@ class DefaultExtension extends MProvider {
break; break;
} }
case 5: {
if (media_type == "tv") {
id = `${id}/${parts[2]}/${parts[3]}`
}
var api = `https://vidapi.click/api/video/${media_type}/${id}`
var response = await new Client().get(api);
if (response.statusCode != 200) {
throw new Error("Video unavailable");
}
var body = JSON.parse(response.body);
var link = body.sources[0].file
subtitles = body.tracks
streams = await this.extractStreams(link);
break;
}
default: { default: {
if (media_type == "tv") { if (media_type == "tv") {
@@ -368,8 +388,9 @@ class DefaultExtension extends MProvider {
} }
if (subtitles.length < 1) { if (subtitles.length < 1) {
streams[0].subtitles = await this.getSubtitleList(tmdb, s, e) subtitles = await this.getSubtitleList(tmdb, s, e)
} }
streams[0].subtitles = subtitles
return await this.sortStreams(streams) return await this.sortStreams(streams)
} }
@@ -416,8 +437,8 @@ class DefaultExtension extends MProvider {
title: 'Preferred stream source', title: 'Preferred stream source',
summary: '', summary: '',
valueIndex: 0, valueIndex: 0,
entries: ["tom.autoembed.cc", "123embed.net", "autoembed.cc - Indian languages", "flicky.host - Indian languages"], entries: ["tom.autoembed.cc", "123embed.net", "autoembed.cc - Indian languages", "flicky.host - Indian languages", "vidapi.click"],
entryValues: ["1", "2", "3", "4"] entryValues: ["1", "2", "3", "4", "5"]
} }
}, },
]; ];