extension(autoembed): added vidsrc.su & removed febapi

This commit is contained in:
Swakshan
2025-03-09 14:29:38 +05:30
parent c08f9d49e1
commit 1f9534c8b2

View File

@@ -7,7 +7,7 @@ const mangayomiSources = [{
"typeSource": "multi", "typeSource": "multi",
"isManga": false, "isManga": false,
"itemType": 1, "itemType": 1,
"version": "1.2.1", "version": "1.2.2",
"dateFormat": "", "dateFormat": "",
"dateFormatLocale": "", "dateFormatLocale": "",
"pkgPath": "anime/src/all/autoembed.js" "pkgPath": "anime/src/all/autoembed.js"
@@ -253,7 +253,7 @@ class DefaultExtension extends MProvider {
// For anime episode video list // For anime episode video list
async getVideoList(url) { async getVideoList(url) {
var streamAPI = parseInt(this.getPreference("autoembed_stream_source")) var streamAPI = parseInt(this.getPreference("autoembed_stream_source_2"))
var parts = url.split("||"); var parts = url.split("||");
var media_type = parts[0]; var media_type = parts[0];
@@ -384,37 +384,67 @@ class DefaultExtension extends MProvider {
var body = JSON.parse(response.body); var body = JSON.parse(response.body);
var strms = body.streams var strms = body.streams
for (var strm of strms) { for (var strm of strms) {
var streamLink = strm.url;
if (streamLink.length > 0) {
streams.push({ streams.push({
url: strm.url, url: strm.url,
originalUrl: strm.url, originalUrl: strm.url,
quality: strm.quality, quality: `${strm.label} - Auto`,
headers: strm.headers headers: strm.headers
}); });
} }
}
break; break;
} }
case 7: { case 7: {
if (media_type == "tv") { if (media_type == "tv") {
id = `${id}/${s}/${e}` id = `${id}/${s}/${e}`
} }
var api = `https://febapi.bludclart.com/${media_type}/${id}` var api = `https://vidsrc.su/embed/${media_type}/${id}`
var response = await new Client().get(api); var response = await new Client().get(api);
if (response.statusCode != 200) { if (response.statusCode != 200) {
throw new Error("Video unavailable"); throw new Error("vidsrc.su unavailable");
} }
var body = response.body
var sKey = 'fixedServers = '
var eKey = "];"
var start = body.indexOf(sKey)
if (start < 0) {
throw new Error("vidsrc.su unavailable");
}
start += sKey.length
var body = JSON.parse(response.body); var end = body.substring(start,).indexOf(eKey) + start + 1
var strms = body.streams.qualities var strms = body.substring(start, end)
for (var strm in strms) {
var quality = strm === "ORG" ? "auto" : strm // Split the data into lines
var url = strms[strm] var lines = strms.split('\n');
streams.push({
url: url, // Regex to match URLs in quotes that start with https://
originalUrl: url, var regex = /url:\s*'(https:\/\/[^']+)'/;
quality: quality, var availableStreams = [];
// Process each line
lines.forEach(line => {
var match = line.match(regex);
if (match && match[1]) {
// Extract the label from the line
var labelMatch = line.match(/label:\s*'([^']+)'/);
var label = labelMatch ? labelMatch[1] : "Unknown";
// Add to our results
availableStreams.push({
url: match[1],
label: label,
}); });
} }
});
for (var stream of availableStreams) {
var streamSplit = await this.splitStreams(stream.url, stream.label);
streams = [...streams, ...streamSplit]
}
break; break;
} }
default: { default: {
@@ -483,12 +513,12 @@ class DefaultExtension extends MProvider {
} }
}, },
{ {
key: 'autoembed_stream_source', key: 'autoembed_stream_source_2',
listPreference: { listPreference: {
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", "febapi (supports 4K)"], entries: ["tom.autoembed.cc", "123embed.net", "autoembed.cc - Indian languages", "flicky.host - Indian languages", "vidapi.click", "hexa.watch", "vidsrc.su"],
entryValues: ["1", "2", "3", "4", "5", "6", "7"] entryValues: ["1", "2", "3", "4", "5", "6", "7"]
} }
}, },