mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 19:01:15 +00:00
Update serienstream.js
Serienstream: - copied the changes from Aniworld Aniworld: - shortened getSourcePreferences() and made it more readable/maintainable - used array in getRandomString() for better readability
This commit is contained in:
@@ -173,6 +173,8 @@ class DefaultExtension extends MProvider {
|
|||||||
return videos;
|
return videos;
|
||||||
}
|
}
|
||||||
getSourcePreferences() {
|
getSourcePreferences() {
|
||||||
|
const hosterOptions = ["Streamtape", "VOE", "Vidoza", "Doodstream"];
|
||||||
|
const languageOptions = ["Deutscher Sub", "Deutscher Dub", "Englischer Sub"];
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"key": "preferred_lang",
|
"key": "preferred_lang",
|
||||||
@@ -180,16 +182,8 @@ class DefaultExtension extends MProvider {
|
|||||||
"title": "Bevorzugte Sprache",
|
"title": "Bevorzugte Sprache",
|
||||||
"summary": "",
|
"summary": "",
|
||||||
"valueIndex": 0,
|
"valueIndex": 0,
|
||||||
"entries": [
|
"entries": languageOptions,
|
||||||
"Deutscher Sub",
|
"entryValues": languageOptions
|
||||||
"Deutscher Dub",
|
|
||||||
"Englischer Sub"
|
|
||||||
],
|
|
||||||
"entryValues": [
|
|
||||||
"Deutscher Sub",
|
|
||||||
"Deutscher Dub",
|
|
||||||
"Englischer Sub"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -198,18 +192,8 @@ class DefaultExtension extends MProvider {
|
|||||||
"title": "Standard-Hoster",
|
"title": "Standard-Hoster",
|
||||||
"summary": "",
|
"summary": "",
|
||||||
"valueIndex": 0,
|
"valueIndex": 0,
|
||||||
"entries": [
|
"entries": hosterOptions,
|
||||||
"Streamtape",
|
"entryValues": hosterOptions
|
||||||
"VOE",
|
|
||||||
"Vidoza",
|
|
||||||
"Doodstream"
|
|
||||||
],
|
|
||||||
"entryValues": [
|
|
||||||
"Streamtape",
|
|
||||||
"Voe",
|
|
||||||
"Vidoza",
|
|
||||||
"Doodstream"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -217,24 +201,9 @@ class DefaultExtension extends MProvider {
|
|||||||
"multiSelectListPreference": {
|
"multiSelectListPreference": {
|
||||||
"title": "Hoster auswählen",
|
"title": "Hoster auswählen",
|
||||||
"summary": "",
|
"summary": "",
|
||||||
"entries": [
|
"entries": hosterOptions,
|
||||||
"Streamtape",
|
"entryValues": hosterOptions,
|
||||||
"VOE",
|
"values": hosterOptions
|
||||||
"Vidoza",
|
|
||||||
"Doodstream"
|
|
||||||
],
|
|
||||||
"entryValues": [
|
|
||||||
"Streamtape",
|
|
||||||
"VOE",
|
|
||||||
"Vidoza",
|
|
||||||
"Doodstream"
|
|
||||||
],
|
|
||||||
"values": [
|
|
||||||
"Streamtape",
|
|
||||||
"VOE",
|
|
||||||
"Vidoza",
|
|
||||||
"Doodstream"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
@@ -296,10 +265,9 @@ extractAny.methods = {
|
|||||||
|
|
||||||
function getRandomString(length) {
|
function getRandomString(length) {
|
||||||
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
|
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
|
||||||
let result = "";
|
const charArray = new Array(length);
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
const random = Math.floor(Math.random() * 61);
|
charArray[i] = chars[Math.floor(Math.random() * chars.length)];
|
||||||
result += chars[random];
|
|
||||||
}
|
}
|
||||||
return result;
|
return charArray.join("");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,16 +7,20 @@ const mangayomiSources = [{
|
|||||||
"typeSource": "single",
|
"typeSource": "single",
|
||||||
"isManga": false,
|
"isManga": false,
|
||||||
"isNsfw": false,
|
"isNsfw": false,
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"dateFormat": "",
|
"dateFormat": "",
|
||||||
"dateFormatLocale": "",
|
"dateFormatLocale": "",
|
||||||
"pkgPath": "anime/src/de/serienstream.js"
|
"pkgPath": "anime/src/de/serienstream.js"
|
||||||
}];
|
}];
|
||||||
|
|
||||||
class DefaultExtension extends MProvider {
|
class DefaultExtension extends MProvider {
|
||||||
|
constructor () {
|
||||||
|
super();
|
||||||
|
this.client = new Client();
|
||||||
|
}
|
||||||
async getPopular(page) {
|
async getPopular(page) {
|
||||||
const baseUrl = this.source.baseUrl;
|
const baseUrl = this.source.baseUrl;
|
||||||
const res = await new Client().get(`${baseUrl}/beliebte-serien`);
|
const res = await this.client.get(`${baseUrl}/beliebte-serien`);
|
||||||
const elements = new Document(res.body).select("div.seriesListContainer div");
|
const elements = new Document(res.body).select("div.seriesListContainer div");
|
||||||
const list = [];
|
const list = [];
|
||||||
for (const element of elements) {
|
for (const element of elements) {
|
||||||
@@ -33,7 +37,7 @@ class DefaultExtension extends MProvider {
|
|||||||
}
|
}
|
||||||
async getLatestUpdates(page) {
|
async getLatestUpdates(page) {
|
||||||
const baseUrl = this.source.baseUrl;
|
const baseUrl = this.source.baseUrl;
|
||||||
const res = await new Client().get(`${baseUrl}/neu`);
|
const res = await this.client.get(`${baseUrl}/neu`);
|
||||||
const elements = new Document(res.body).select("div.seriesListContainer div");
|
const elements = new Document(res.body).select("div.seriesListContainer div");
|
||||||
const list = [];
|
const list = [];
|
||||||
for (const element of elements) {
|
for (const element of elements) {
|
||||||
@@ -50,13 +54,13 @@ class DefaultExtension extends MProvider {
|
|||||||
}
|
}
|
||||||
async search(query, page, filters) {
|
async search(query, page, filters) {
|
||||||
const baseUrl = this.source.baseUrl;
|
const baseUrl = this.source.baseUrl;
|
||||||
const res = await new Client().get(`${baseUrl}/serien`);
|
const res = await this.client.get(`${baseUrl}/serien`);
|
||||||
const elements = new Document(res.body).select("#seriesContainer > div > ul > li > a").filter(e => e.attr("title").toLowerCase().includes(query.toLowerCase()));
|
const elements = new Document(res.body).select("#seriesContainer > div > ul > li > a").filter(e => e.attr("title").toLowerCase().includes(query.toLowerCase()));
|
||||||
const list = [];
|
const list = [];
|
||||||
for (const element of elements) {
|
for (const element of elements) {
|
||||||
const name = element.text;
|
const name = element.text;
|
||||||
const link = element.attr("href");
|
const link = element.attr("href");
|
||||||
const img = new Document((await new Client().get(baseUrl + link)).body).selectFirst("div.seriesCoverBox img").attr("data-src");
|
const img = new Document((await this.client.get(baseUrl + link)).body).selectFirst("div.seriesCoverBox img").attr("data-src");
|
||||||
const imageUrl = baseUrl + img;
|
const imageUrl = baseUrl + img;
|
||||||
list.push({ name, imageUrl, link });
|
list.push({ name, imageUrl, link });
|
||||||
}
|
}
|
||||||
@@ -67,8 +71,7 @@ class DefaultExtension extends MProvider {
|
|||||||
}
|
}
|
||||||
async getDetail(url) {
|
async getDetail(url) {
|
||||||
const baseUrl = this.source.baseUrl;
|
const baseUrl = this.source.baseUrl;
|
||||||
const client = new Client();
|
const res = await this.client.get(baseUrl + url);
|
||||||
const res = await client.get(baseUrl + url);
|
|
||||||
const document = new Document(res.body);
|
const document = new Document(res.body);
|
||||||
const imageUrl = baseUrl +
|
const imageUrl = baseUrl +
|
||||||
document.selectFirst("div.seriesCoverBox img").attr("data-src");
|
document.selectFirst("div.seriesCoverBox img").attr("data-src");
|
||||||
@@ -82,18 +85,29 @@ class DefaultExtension extends MProvider {
|
|||||||
author = produzent[0].select("li").map(e => e.text).join(", ");
|
author = produzent[0].select("li").map(e => e.text).join(", ");
|
||||||
}
|
}
|
||||||
const seasonsElements = document.select("#stream > ul:nth-child(1) > li > a");
|
const seasonsElements = document.select("#stream > ul:nth-child(1) > li > a");
|
||||||
const episodes = (await Promise.all(seasonsElements.map(element => this.parseEpisodesFromSeries(element, client)))).flat();
|
|
||||||
episodes.reverse();
|
const promises = [];
|
||||||
return {
|
const episodes = [];
|
||||||
name, imageUrl, description, author, status: 5, genre, episodes
|
for (const element of seasonsElements) {
|
||||||
};
|
promises.push(this.parseEpisodesFromSeries(element));
|
||||||
}
|
}
|
||||||
async parseEpisodesFromSeries(seriesElement, client) {
|
for (const p of (await Promise.allSettled(promises))) {
|
||||||
const seasonId = seriesElement.getHref;
|
if (p.status == 'fulfilled') {
|
||||||
const response = await client.get(`${this.source.baseUrl}${seasonId}`);
|
episodes.push(...p.value);
|
||||||
const episodeElements = new Document(response.body).select("table.seasonEpisodesList tbody tr");
|
}
|
||||||
const episodes = Array.from(episodeElements).map((episodeElement) => this.episodeFromElement(episodeElement));
|
}
|
||||||
return episodes.filter(ep => Object.keys(ep).length > 0);
|
episodes.reverse();
|
||||||
|
return { name, imageUrl, description, author, status: 5, genre, episodes };
|
||||||
|
}
|
||||||
|
async parseEpisodesFromSeries(element) {
|
||||||
|
const seasonId = element.getHref;
|
||||||
|
const res = await this.client.get(this.source.baseUrl + seasonId);
|
||||||
|
const episodeElements = new Document(res.body).select("table.seasonEpisodesList tbody tr");
|
||||||
|
const list = [];
|
||||||
|
for (const episodeElement of episodeElements) {
|
||||||
|
list.push(this.episodeFromElement(episodeElement));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
episodeFromElement(element) {
|
episodeFromElement(element) {
|
||||||
const titleAnchor = element.selectFirst("td.seasonEpisodeTitle a");
|
const titleAnchor = element.selectFirst("td.seasonEpisodeTitle a");
|
||||||
@@ -110,114 +124,57 @@ class DefaultExtension extends MProvider {
|
|||||||
}
|
}
|
||||||
return name && url ? { name, url } : {};
|
return name && url ? { name, url } : {};
|
||||||
}
|
}
|
||||||
getRandomString(length) {
|
|
||||||
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
|
|
||||||
let result = "";
|
|
||||||
for (let i = 0; i < length; i++) {
|
|
||||||
const random = Math.floor(Math.random() * 61);
|
|
||||||
result += chars[random];
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
async doodExtractor(url, quality) {
|
|
||||||
let response = await new Client({ 'useDartHttpClient': true, "followRedirects": false }).get(url);
|
|
||||||
while("location" in response.headers) {
|
|
||||||
response = await new Client({ 'useDartHttpClient': true, "followRedirects": false }).get(response.headers.location);
|
|
||||||
}
|
|
||||||
const newUrl = response.request.url;
|
|
||||||
const doodhost = newUrl.match(/https:\/\/(.*?)\//, newUrl)[0].slice(8, -1);
|
|
||||||
const md5 = response.body.match(/'\/pass_md5\/(.*?)',/, newUrl)[0].slice(11, -2);
|
|
||||||
const token = md5.substring(md5.lastIndexOf("/") + 1);
|
|
||||||
const expiry = new Date().valueOf();
|
|
||||||
const randomString = this.getRandomString(10);
|
|
||||||
|
|
||||||
response = await new Client().get(`https://${doodhost}/pass_md5/${md5}`, {"Referer": newUrl});
|
|
||||||
const videoUrl = `${response.body}${randomString}?token=${token}&expiry=${expiry}`;
|
|
||||||
const headers = { "User-Agent": "Mangayomi", "Referer": doodhost };
|
|
||||||
return [{ url: videoUrl, originalUrl: videoUrl, headers: headers, quality }];
|
|
||||||
}
|
|
||||||
async vidozaExtractor(url, quality) {
|
|
||||||
let response = await new Client({ 'useDartHttpClient': true, "followRedirects": true }).get(url);
|
|
||||||
const videoUrl = response.body.match(/https:\/\/\S*\.mp4/)[0];
|
|
||||||
return [{ url: videoUrl, originalUrl: videoUrl, quality }];
|
|
||||||
}
|
|
||||||
async getVideoList(url) {
|
async getVideoList(url) {
|
||||||
const baseUrl = this.source.baseUrl;
|
const baseUrl = this.source.baseUrl;
|
||||||
const res = await new Client().get(baseUrl + url);
|
const res = await this.client.get(baseUrl + url, {
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Referer': baseUrl + url,
|
||||||
|
'Priority': 'u=0, i',
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0'
|
||||||
|
});
|
||||||
const document = new Document(res.body);
|
const document = new Document(res.body);
|
||||||
const redirectlink = document.select("ul.row li");
|
let promises = [];
|
||||||
const preference = new SharedPreferences();
|
|
||||||
const hosterSelection = preference.get("hoster_selection_new");
|
|
||||||
const videos = [];
|
const videos = [];
|
||||||
for (const element of redirectlink) {
|
|
||||||
try {
|
const redirectsElements = document.select("ul.row li");
|
||||||
|
const hosterSelection = new SharedPreferences().get("hoster_selection_new");
|
||||||
|
const dartClient = new Client({ 'useDartHttpClient': true, "followRedirects": false });
|
||||||
|
|
||||||
|
for (const element of redirectsElements) {
|
||||||
|
const host = element.selectFirst("a h4").text;
|
||||||
|
|
||||||
|
if (hosterSelection.includes(host)) {
|
||||||
const langkey = element.attr("data-lang-key");
|
const langkey = element.attr("data-lang-key");
|
||||||
let language = "";
|
const lang = (langkey == 1 || langkey == 3) ? 'Deutscher' : 'Englischer';
|
||||||
if (langkey.includes("3")) {
|
const type = (langkey == 1) ? 'Dub' : 'Sub';
|
||||||
language = "Deutscher Sub";
|
const redirect = baseUrl + element.selectFirst("a.watchEpisode").attr("href");
|
||||||
} else if (langkey.includes("1")) {
|
promises.push((async (redirect, lang, type, host) => {
|
||||||
language = "Deutscher Dub";
|
const location = (await dartClient.get(redirect)).headers.location;
|
||||||
} else if (langkey.includes("2")) {
|
return await extractAny(location, host.toLowerCase(), lang, type, host);
|
||||||
language = "Englischer Sub";
|
})(redirect, lang, type, host));
|
||||||
}
|
|
||||||
const redirectgs = baseUrl + element.selectFirst("a.watchEpisode").attr("href");
|
|
||||||
const hoster = element.selectFirst("a h4").text;
|
|
||||||
|
|
||||||
if (hoster == "Streamtape" && hosterSelection.includes("Streamtape")) {
|
|
||||||
const location = (await new Client({ 'useDartHttpClient': true, "followRedirects": false }).get(redirectgs)).headers.location;
|
|
||||||
const quality = `${language} - Streamtape`;
|
|
||||||
const vids = await streamTapeExtractor(location, quality);
|
|
||||||
for (const vid of vids) {
|
|
||||||
videos.push(vid);
|
|
||||||
}
|
|
||||||
} else if (hoster == "VOE" && hosterSelection.includes("VOE")) {
|
|
||||||
const location = (await new Client({ 'useDartHttpClient': true, "followRedirects": false }).get(redirectgs)).headers.location;
|
|
||||||
const quality = `${language} - `;
|
|
||||||
const vids = await voeExtractor(location, quality);
|
|
||||||
for (const vid of vids) {
|
|
||||||
videos.push(vid);
|
|
||||||
}
|
|
||||||
} else if (hoster == "Vidoza" && hosterSelection.includes("Vidoza")) {
|
|
||||||
const location = (await new Client({ 'useDartHttpClient': true, "followRedirects": false }).get(redirectgs)).headers.location;
|
|
||||||
const quality = `${language} - Vidoza`;
|
|
||||||
const vids = await this.vidozaExtractor(location, quality);
|
|
||||||
for (const vid of vids) {
|
|
||||||
videos.push(vid);
|
|
||||||
}
|
|
||||||
} else if (hoster == "Doodstream" && hosterSelection.includes("Doodstream")) {
|
|
||||||
const location = (await new Client({ 'useDartHttpClient': true, "followRedirects": false }).get(redirectgs)).headers.location;
|
|
||||||
const quality = `${language} - Doodstream`;
|
|
||||||
const vids = await this.doodExtractor(location, quality);
|
|
||||||
for (const vid of vids) {
|
|
||||||
videos.push(vid);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (_) {
|
for (const p of (await Promise.allSettled(promises))) {
|
||||||
|
if (p.status == 'fulfilled') {
|
||||||
|
videos.push.apply(videos, p.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.sortVideos(videos);
|
return this.sortVideos(videos);
|
||||||
}
|
}
|
||||||
sortVideos(videos) {
|
sortVideos(videos) {
|
||||||
const preference = new SharedPreferences();
|
const preference = new SharedPreferences();
|
||||||
const hoster = preference.get("preferred_hoster_new");
|
const hoster = RegExp(preference.get("preferred_hoster_new"));
|
||||||
const subPreference = preference.get("preferred_lang");
|
const lang = RegExp(preference.get("preferred_lang"));
|
||||||
videos.sort((a, b) => {
|
videos.sort((a, b) => {
|
||||||
let qualityMatchA = 0;
|
let qualityMatchA = hoster.test(a.quality) * lang.test(a.quality);
|
||||||
if (a.quality.includes(hoster) &&
|
let qualityMatchB = hoster.test(b.quality) * lang.test(b.quality);
|
||||||
a.quality.includes(subPreference)) {
|
|
||||||
qualityMatchA = 1;
|
|
||||||
}
|
|
||||||
let qualityMatchB = 0;
|
|
||||||
if (b.quality.includes(hoster) &&
|
|
||||||
b.quality.includes(subPreference)) {
|
|
||||||
qualityMatchB = 1;
|
|
||||||
}
|
|
||||||
return qualityMatchB - qualityMatchA;
|
return qualityMatchB - qualityMatchA;
|
||||||
});
|
});
|
||||||
return videos;
|
return videos;
|
||||||
}
|
}
|
||||||
getSourcePreferences() {
|
getSourcePreferences() {
|
||||||
|
const hosterOptions = ["Streamtape", "VOE", "Vidoza", "Doodstream"];
|
||||||
|
const languageOptions = ["Deutscher Sub", "Deutscher Dub", "Englischer Sub"];
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"key": "preferred_lang",
|
"key": "preferred_lang",
|
||||||
@@ -225,16 +182,8 @@ class DefaultExtension extends MProvider {
|
|||||||
"title": "Bevorzugte Sprache",
|
"title": "Bevorzugte Sprache",
|
||||||
"summary": "",
|
"summary": "",
|
||||||
"valueIndex": 0,
|
"valueIndex": 0,
|
||||||
"entries": [
|
"entries": languageOptions,
|
||||||
"Deutscher Sub",
|
"entryValues": languageOptions
|
||||||
"Deutscher Dub",
|
|
||||||
"Englischer Sub"
|
|
||||||
],
|
|
||||||
"entryValues": [
|
|
||||||
"Deutscher Sub",
|
|
||||||
"Deutscher Dub",
|
|
||||||
"Englischer Sub"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -243,16 +192,8 @@ class DefaultExtension extends MProvider {
|
|||||||
"title": "Standard-Hoster",
|
"title": "Standard-Hoster",
|
||||||
"summary": "",
|
"summary": "",
|
||||||
"valueIndex": 0,
|
"valueIndex": 0,
|
||||||
"entries": [
|
"entries": hosterOptions,
|
||||||
"Streamtape",
|
"entryValues": hosterOptions
|
||||||
"VOE",
|
|
||||||
"Vidoza", "Doodstream"
|
|
||||||
],
|
|
||||||
"entryValues": [
|
|
||||||
"Streamtape",
|
|
||||||
"VOE",
|
|
||||||
"Vidoza", "Doodstream"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -260,23 +201,73 @@ class DefaultExtension extends MProvider {
|
|||||||
"multiSelectListPreference": {
|
"multiSelectListPreference": {
|
||||||
"title": "Hoster auswählen",
|
"title": "Hoster auswählen",
|
||||||
"summary": "",
|
"summary": "",
|
||||||
"entries": [
|
"entries": hosterOptions,
|
||||||
"Streamtape",
|
"entryValues": hosterOptions,
|
||||||
"VOE",
|
"values": hosterOptions
|
||||||
"Vidoza", "Doodstream"
|
|
||||||
],
|
|
||||||
"entryValues": [
|
|
||||||
"Streamtape",
|
|
||||||
"VOE",
|
|
||||||
"Vidoza", "Doodstream"
|
|
||||||
],
|
|
||||||
"values": [
|
|
||||||
"Streamtape",
|
|
||||||
"VOE",
|
|
||||||
"Vidoza", "Doodstream"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function doodExtractor(url) {
|
||||||
|
const dartClient = new Client({ 'useDartHttpClient': true, "followRedirects": false });
|
||||||
|
let response = await dartClient.get(url);
|
||||||
|
while ("location" in response.headers) {
|
||||||
|
response = await dartClient.get(response.headers.location);
|
||||||
|
}
|
||||||
|
const newUrl = response.request.url;
|
||||||
|
const doodhost = newUrl.match(/https:\/\/(.*?)\//, newUrl)[0].slice(8, -1);
|
||||||
|
const md5 = response.body.match(/'\/pass_md5\/(.*?)',/, newUrl)[0].slice(11, -2);
|
||||||
|
const token = md5.substring(md5.lastIndexOf("/") + 1);
|
||||||
|
const expiry = new Date().valueOf();
|
||||||
|
const randomString = getRandomString(10);
|
||||||
|
|
||||||
|
response = await new Client().get(`https://${doodhost}/pass_md5/${md5}`, { "Referer": newUrl });
|
||||||
|
const videoUrl = `${response.body}${randomString}?token=${token}&expiry=${expiry}`;
|
||||||
|
const headers = { "User-Agent": "Mangayomi", "Referer": doodhost };
|
||||||
|
return [{ url: videoUrl, originalUrl: videoUrl, headers: headers, quality: '' }];
|
||||||
|
}
|
||||||
|
|
||||||
|
async function vidozaExtractor(url) {
|
||||||
|
let response = await new Client({ 'useDartHttpClient': true, "followRedirects": true }).get(url);
|
||||||
|
const videoUrl = response.body.match(/https:\/\/\S*\.mp4/)[0];
|
||||||
|
return [{ url: videoUrl, originalUrl: videoUrl, quality: '' }];
|
||||||
|
}
|
||||||
|
|
||||||
|
_streamTapeExtractor = streamTapeExtractor;
|
||||||
|
streamTapeExtractor = async (url) => {
|
||||||
|
return await _streamTapeExtractor(url, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
_voeExtractor = voeExtractor;
|
||||||
|
voeExtractor = async (url) => {
|
||||||
|
return (await _voeExtractor(url, '')).map(v => {
|
||||||
|
v.quality = v.quality.replace(/Voe: (\d+p?)/i, '$1');
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function extractAny(link, method, lang, type, host) {
|
||||||
|
const m = extractAny.methods[method];
|
||||||
|
return (!m) ? [] : (await m(link)).map(v => {
|
||||||
|
v.quality = v.quality ? `${lang} ${type} ${v.quality} ${host}` : `${lang} ${type} ${host}`;
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
extractAny.methods = {
|
||||||
|
'doodstream': doodExtractor,
|
||||||
|
'streamtape': streamTapeExtractor,
|
||||||
|
'vidoza': vidozaExtractor,
|
||||||
|
'voe': voeExtractor
|
||||||
|
};
|
||||||
|
|
||||||
|
function getRandomString(length) {
|
||||||
|
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
|
||||||
|
const charArray = new Array(length);
|
||||||
|
for (let i = 0; i < length; i++) {
|
||||||
|
charArray[i] = chars[Math.floor(Math.random() * chars.length)];
|
||||||
|
}
|
||||||
|
return charArray.join("");
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user