mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 10:51:17 +00:00
extension(autoembed): Added provider: embed*su
This commit is contained in:
@@ -7,17 +7,32 @@ const mangayomiSources = [{
|
|||||||
"typeSource": "multi",
|
"typeSource": "multi",
|
||||||
"isManga": false,
|
"isManga": false,
|
||||||
"itemType": 1,
|
"itemType": 1,
|
||||||
"version": "1.2.4",
|
"version": "1.2.5",
|
||||||
"dateFormat": "",
|
"dateFormat": "",
|
||||||
"dateFormatLocale": "",
|
"dateFormatLocale": "",
|
||||||
"pkgPath": "anime/src/all/autoembed.js"
|
"pkgPath": "anime/src/all/autoembed.js"
|
||||||
}];
|
}];
|
||||||
|
|
||||||
class DefaultExtension extends MProvider {
|
class DefaultExtension extends MProvider {
|
||||||
|
decodeBase64 = function (f) {
|
||||||
getHeaders() {
|
var g = {},
|
||||||
|
b = 65,
|
||||||
|
d = 0,
|
||||||
|
a, c = 0,
|
||||||
|
h, e = "",
|
||||||
|
k = String.fromCharCode,
|
||||||
|
l = f.length;
|
||||||
|
for (a = ""; 91 > b;) a += k(b++);
|
||||||
|
a += a.toLowerCase() + "0123456789+/";
|
||||||
|
for (b = 0; 64 > b; b++) g[a.charAt(b)] = b;
|
||||||
|
for (a = 0; a < l; a++)
|
||||||
|
for (b = g[f.charAt(a)], d = (d << 6) + b, c += 6; 8 <= c;)((h = d >>> (c -= 8) & 255) || a < l - 2) && (e += k(h));
|
||||||
|
return e
|
||||||
|
};
|
||||||
|
getHeaders(url) {
|
||||||
return {
|
return {
|
||||||
Referer: this.source.apiUrl
|
Referer: url,
|
||||||
|
Origin: url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,18 +170,19 @@ class DefaultExtension extends MProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extracts the streams url for different resolutions from a hls stream.
|
// Extracts the streams url for different resolutions from a hls stream.
|
||||||
async extractStreams(url, lang = "", hdr = {}) {
|
async extractStreams(url, lang = "", hdr = {},host="") {
|
||||||
var streams = [{
|
var streams = [{
|
||||||
url: url,
|
url: url,
|
||||||
originalUrl: url,
|
originalUrl: url,
|
||||||
quality: `${lang} - Auto`,
|
quality: `${lang} - Auto`,
|
||||||
|
headers:hdr
|
||||||
}];
|
}];
|
||||||
|
|
||||||
var pref = this.getPreference("autoembed_split_stream_quality");
|
var pref = this.getPreference("autoembed_split_stream_quality");
|
||||||
if(!pref) return streams
|
if (!pref) return streams
|
||||||
|
|
||||||
|
|
||||||
const response = await new Client().get(url);
|
const response = await new Client().get(url,hdr);
|
||||||
const body = response.body;
|
const body = response.body;
|
||||||
const lines = body.split('\n');
|
const lines = body.split('\n');
|
||||||
|
|
||||||
@@ -176,6 +192,9 @@ class DefaultExtension extends MProvider {
|
|||||||
resolution = `${lang} ${resolution}`
|
resolution = `${lang} ${resolution}`
|
||||||
var m3u8Url = lines[i + 1].trim();
|
var m3u8Url = lines[i + 1].trim();
|
||||||
m3u8Url = m3u8Url.replace("./", `${url}/`)
|
m3u8Url = m3u8Url.replace("./", `${url}/`)
|
||||||
|
if(host.length>0){
|
||||||
|
m3u8Url = `${host}${m3u8Url}`
|
||||||
|
}
|
||||||
streams.push({
|
streams.push({
|
||||||
url: m3u8Url,
|
url: m3u8Url,
|
||||||
originalUrl: m3u8Url,
|
originalUrl: m3u8Url,
|
||||||
@@ -198,7 +217,7 @@ class DefaultExtension extends MProvider {
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
var pref = this.getPreference("autoembed_split_stream_quality");
|
var pref = this.getPreference("autoembed_split_stream_quality");
|
||||||
if(!pref) return streams
|
if (!pref) return streams
|
||||||
|
|
||||||
|
|
||||||
var quality = ["360", "480", "720", "1080"]
|
var quality = ["360", "480", "720", "1080"]
|
||||||
@@ -462,12 +481,46 @@ class DefaultExtension extends MProvider {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 8: {
|
||||||
|
function reverse(str) {
|
||||||
|
return str.split("").reverse().join("")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (media_type == "tv") {
|
||||||
|
id = `${id}/${s}/${e}`
|
||||||
|
}
|
||||||
|
var baseUrl = "https://embed.su"
|
||||||
|
var embedUrl = `${baseUrl}/embed/${media_type}/${id}`
|
||||||
|
var response = await new Client().get(embedUrl, this.getHeaders(baseUrl));
|
||||||
|
|
||||||
|
var body = response.body
|
||||||
|
var sKey = "JSON.parse(atob(`";
|
||||||
|
var s = body.indexOf(sKey) + sKey.length;
|
||||||
|
var e = body.substring(s,).indexOf("`") + s
|
||||||
|
var configHash = body.substring(s, e)
|
||||||
|
|
||||||
|
|
||||||
|
var config = JSON.parse(this.decodeBase64(configHash));
|
||||||
|
var encodedHash = this.decodeBase64(config.hash);
|
||||||
|
var decodeHash = reverse(encodedHash.split(".").map((item) => reverse(item)).join(""))
|
||||||
|
encodedHash = JSON.parse(this.decodeBase64(decodeHash))
|
||||||
|
var serverHash = encodedHash[0].hash
|
||||||
|
|
||||||
|
var api = `${baseUrl}/api/e/${serverHash}`
|
||||||
|
response = await new Client().get(api, this.getHeaders(baseUrl));
|
||||||
|
var jsonRes = JSON.parse(response.body);
|
||||||
|
|
||||||
|
streams = await this.extractStreams(jsonRes.source,"",this.getHeaders(baseUrl),baseUrl);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
if (media_type == "tv") {
|
if (media_type == "tv") {
|
||||||
id = `${id}/${s}/${e}`
|
id = `${id}/${s}/${e}`
|
||||||
}
|
}
|
||||||
var api = `${this.source.apiUrl}/api/getVideoSource?type=${media_type}&id=${id}`
|
var api = `${this.source.apiUrl}/api/getVideoSource?type=${media_type}&id=${id}`
|
||||||
var response = await new Client().get(api, this.getHeaders());
|
var response = await new Client().get(api, this.getHeaders(this.source.apiUrl));
|
||||||
|
|
||||||
if (response.statusCode != 200) {
|
if (response.statusCode != 200) {
|
||||||
throw new Error("tom.autoembed.cc unavailable\nPlease choose a different server");
|
throw new Error("tom.autoembed.cc unavailable\nPlease choose a different server");
|
||||||
@@ -541,8 +594,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", "vidapi.click", "hexa.watch", "vidsrc.su"],
|
entries: ["tom.autoembed.cc", "123embed.net", "autoembed.cc - Indian languages", "flicky.host - Indian languages", "vidapi.click", "hexa.watch", "vidsrc.su", "embed.su"],
|
||||||
entryValues: ["1", "2", "3", "4", "5", "6", "7"]
|
entryValues: ["1", "2", "3", "4", "5", "6", "7", "8"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user