mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-14 19:01:15 +00:00
add novel support
This commit is contained in:
@@ -7,16 +7,20 @@ const mangayomiSources = [{
|
||||
"typeSource": "single",
|
||||
"itemType": "anime",
|
||||
"isNsfw": false,
|
||||
"version": "0.0.15",
|
||||
"version": "0.0.28",
|
||||
"dateFormat": "",
|
||||
"dateFormatLocale": "",
|
||||
"pkgPath": "anime/src/de/aniworld.js"
|
||||
}];
|
||||
|
||||
class DefaultExtension extends MProvider {
|
||||
constructor () {
|
||||
super();
|
||||
this.client = new Client();
|
||||
}
|
||||
async getPopular(page) {
|
||||
const baseUrl = this.source.baseUrl;
|
||||
const res = await new Client().get(`${baseUrl}/beliebte-animes`);
|
||||
const res = await this.client.get(`${baseUrl}/beliebte-animes`);
|
||||
const elements = new Document(res.body).select("div.seriesListContainer div");
|
||||
const list = [];
|
||||
for (const element of elements) {
|
||||
@@ -33,7 +37,7 @@ class DefaultExtension extends MProvider {
|
||||
}
|
||||
async getLatestUpdates(page) {
|
||||
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 list = [];
|
||||
for (const element of elements) {
|
||||
@@ -50,13 +54,13 @@ class DefaultExtension extends MProvider {
|
||||
}
|
||||
async search(query, page, filters) {
|
||||
const baseUrl = this.source.baseUrl;
|
||||
const res = await new Client().get(`${baseUrl}/animes`);
|
||||
const res = await this.client.get(`${baseUrl}/animes`);
|
||||
const elements = new Document(res.body).select("#seriesContainer > div > ul > li > a").filter(e => e.attr("title").toLowerCase().includes(query.toLowerCase()));
|
||||
const list = [];
|
||||
for (const element of elements) {
|
||||
const name = element.text;
|
||||
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;
|
||||
list.push({ name, imageUrl, link });
|
||||
}
|
||||
@@ -67,7 +71,7 @@ class DefaultExtension extends MProvider {
|
||||
}
|
||||
async getDetail(url) {
|
||||
const baseUrl = this.source.baseUrl;
|
||||
const res = await new Client().get(baseUrl + url);
|
||||
const res = await this.client.get(baseUrl + url);
|
||||
const document = new Document(res.body);
|
||||
const imageUrl = baseUrl +
|
||||
document.selectFirst("div.seriesCoverBox img").attr("data-src");
|
||||
@@ -81,22 +85,23 @@ class DefaultExtension extends MProvider {
|
||||
author = produzent[0].select("li").map(e => e.text).join(", ");
|
||||
}
|
||||
const seasonsElements = document.select("#stream > ul:nth-child(1) > li > a");
|
||||
let episodes = [];
|
||||
|
||||
const promises = [];
|
||||
const episodes = [];
|
||||
for (const element of seasonsElements) {
|
||||
const eps = await this.parseEpisodesFromSeries(element);
|
||||
for (const ep of eps) {
|
||||
episodes.push(ep);
|
||||
promises.push(this.parseEpisodesFromSeries(element));
|
||||
}
|
||||
for (const p of (await Promise.allSettled(promises))) {
|
||||
if (p.status == 'fulfilled') {
|
||||
episodes.push(...p.value);
|
||||
}
|
||||
}
|
||||
episodes.reverse();
|
||||
|
||||
return {
|
||||
name, imageUrl, description, author, status: 5, genre, episodes
|
||||
};
|
||||
return { name, imageUrl, description, author, status: 5, genre, episodes };
|
||||
}
|
||||
async parseEpisodesFromSeries(element) {
|
||||
const seasonId = element.getHref;
|
||||
const res = await new Client().get(this.source.baseUrl + seasonId);
|
||||
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) {
|
||||
@@ -105,94 +110,71 @@ class DefaultExtension extends MProvider {
|
||||
return list;
|
||||
}
|
||||
episodeFromElement(element) {
|
||||
const titleAnchor = element.selectFirst("td.seasonEpisodeTitle a");
|
||||
const episodeSpan = titleAnchor.selectFirst("span");
|
||||
const url = titleAnchor.attr("href");
|
||||
const episodeSeasonId = element.attr("data-episode-season-id");
|
||||
let episode = episodeSpan.text.replace(/'/g, "'");
|
||||
let name = "";
|
||||
let url = "";
|
||||
if (element.selectFirst("td.seasonEpisodeTitle a").attr("href").includes("/film")) {
|
||||
const num = element.attr("data-episode-season-id");
|
||||
name = `Film ${num}` + " : " + element.selectFirst("td.seasonEpisodeTitle a span").text;
|
||||
url = element.selectFirst("td.seasonEpisodeTitle a").attr("href");
|
||||
if (url.includes("/film")) {
|
||||
name = `Film ${episodeSeasonId} : ${episode}`;
|
||||
} else {
|
||||
const season =
|
||||
element.selectFirst("td.seasonEpisodeTitle a").attr("href").substringAfter("staffel-").substringBefore("/episode");;
|
||||
const num = element.attr("data-episode-season-id");
|
||||
name = `Staffel ${season} Folge ${num}` + " : " + element.selectFirst("td.seasonEpisodeTitle a span").text;
|
||||
url = element.selectFirst("td.seasonEpisodeTitle a").attr("href");
|
||||
const seasonMatch = url.match(/staffel-(\d+)\/episode/);
|
||||
name = `Staffel ${seasonMatch[1]} Folge ${episodeSeasonId} : ${episode}`;
|
||||
}
|
||||
if (name.length > 0 && url.length > 0) {
|
||||
return { name, url }
|
||||
}
|
||||
return {}
|
||||
return name && url ? { name, url } : {};
|
||||
}
|
||||
async getVideoList(url) {
|
||||
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 redirectlink = document.select("ul.row li");
|
||||
const preference = new SharedPreferences();
|
||||
const hosterSelection = preference.get("hoster_selection");
|
||||
let promises = [];
|
||||
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");
|
||||
let language = "";
|
||||
if (langkey.includes("3")) {
|
||||
language = "Deutscher Sub";
|
||||
} else if (langkey.includes("1")) {
|
||||
language = "Deutscher Dub";
|
||||
} else if (langkey.includes("2")) {
|
||||
language = "Englischer Sub";
|
||||
}
|
||||
const redirectgs = baseUrl + element.selectFirst("a.watchEpisode").attr("href");
|
||||
const hoster = element.selectFirst("a h4").text;
|
||||
|
||||
if (hoster == "Streamtape" && hosterSelection.includes("Streamtape")) {
|
||||
const body = (await new Client().get(redirectgs)).body;
|
||||
const quality = `Streamtape ${language}`;
|
||||
const vids = await streamTapeExtractor(body.match(/https:\/\/streamtape\.com\/e\/[a-zA-Z0-9]+/g)[0], quality);
|
||||
for (const vid of vids) {
|
||||
videos.push(vid);
|
||||
}
|
||||
} else if (hoster == "VOE" && hosterSelection.includes("VOE")) {
|
||||
const body = (await new Client().get(redirectgs)).body;
|
||||
const quality = `VOE ${language}`;
|
||||
const vids = await voeExtractor(body.match(/https:\/\/voe\.sx\/e\/[a-zA-Z0-9]+/g)[0], quality);
|
||||
for (const vid of vids) {
|
||||
videos.push(vid);
|
||||
}
|
||||
} else if (hoster == "Vidoza" && hosterSelection.includes("Vidoza")) {
|
||||
const body = (await new Client().get(redirectgs)).body;
|
||||
const quality = `Vidoza ${language}`;
|
||||
const match = body.match(/https:\/\/[^\s]*\.vidoza\.net\/[^\s]*\.mp4/g);
|
||||
if (match.length > 0) {
|
||||
videos.push({ url: match[0], originalUrl: match[0], quality });
|
||||
}
|
||||
}
|
||||
} catch (_) {
|
||||
|
||||
const lang = (langkey == 1 || langkey == 3) ? 'Deutscher' : 'Englischer';
|
||||
const type = (langkey == 1) ? 'Dub' : 'Sub';
|
||||
const redirect = baseUrl + element.selectFirst("a.watchEpisode").attr("href");
|
||||
promises.push((async (redirect, lang, type, host) => {
|
||||
const location = (await dartClient.get(redirect)).headers.location;
|
||||
return await extractAny(location, host.toLowerCase(), lang, type, host);
|
||||
})(redirect, lang, type, host));
|
||||
}
|
||||
}
|
||||
for (const p of (await Promise.allSettled(promises))) {
|
||||
if (p.status == 'fulfilled') {
|
||||
videos.push.apply(videos, p.value);
|
||||
}
|
||||
}
|
||||
return this.sortVideos(videos);
|
||||
}
|
||||
sortVideos(videos) {
|
||||
const preference = new SharedPreferences();
|
||||
const hoster = preference.get("preferred_hoster");
|
||||
const subPreference = preference.get("preferred_lang");
|
||||
const hoster = RegExp(preference.get("preferred_hoster_new"));
|
||||
const lang = RegExp(preference.get("preferred_lang"));
|
||||
videos.sort((a, b) => {
|
||||
let qualityMatchA = 0;
|
||||
if (a.quality.includes(hoster) &&
|
||||
a.quality.includes(subPreference)) {
|
||||
qualityMatchA = 1;
|
||||
}
|
||||
let qualityMatchB = 0;
|
||||
if (b.quality.includes(hoster) &&
|
||||
b.quality.includes(subPreference)) {
|
||||
qualityMatchB = 1;
|
||||
}
|
||||
let qualityMatchA = hoster.test(a.quality) * lang.test(a.quality);
|
||||
let qualityMatchB = hoster.test(b.quality) * lang.test(b.quality);
|
||||
return qualityMatchB - qualityMatchA;
|
||||
});
|
||||
return videos;
|
||||
}
|
||||
getSourcePreferences() {
|
||||
const hosterOptions = ["Streamtape", "VOE", "Vidoza", "Doodstream"];
|
||||
const languageOptions = ["Deutscher Sub", "Deutscher Dub", "Englischer Sub"];
|
||||
return [
|
||||
{
|
||||
"key": "preferred_lang",
|
||||
@@ -200,58 +182,92 @@ class DefaultExtension extends MProvider {
|
||||
"title": "Bevorzugte Sprache",
|
||||
"summary": "",
|
||||
"valueIndex": 0,
|
||||
"entries": [
|
||||
"Deutscher Sub",
|
||||
"Deutscher Dub",
|
||||
"Englischer Sub"
|
||||
],
|
||||
"entryValues": [
|
||||
"Deutscher Sub",
|
||||
"Deutscher Dub",
|
||||
"Englischer Sub"
|
||||
]
|
||||
"entries": languageOptions,
|
||||
"entryValues": languageOptions
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "preferred_hoster",
|
||||
"key": "preferred_hoster_new",
|
||||
"listPreference": {
|
||||
"title": "Standard-Hoster",
|
||||
"summary": "",
|
||||
"valueIndex": 0,
|
||||
"entries": [
|
||||
"Streamtape",
|
||||
"VOE",
|
||||
"Vidoza"
|
||||
],
|
||||
"entryValues": [
|
||||
"Streamtape",
|
||||
"VOE",
|
||||
"Vidoza"
|
||||
]
|
||||
"entries": hosterOptions,
|
||||
"entryValues": hosterOptions
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "hoster_selection",
|
||||
"key": "hoster_selection_new",
|
||||
"multiSelectListPreference": {
|
||||
"title": "Hoster auswählen",
|
||||
"summary": "",
|
||||
"entries": [
|
||||
"Streamtape",
|
||||
"VOE",
|
||||
"Vidoza"
|
||||
],
|
||||
"entryValues": [
|
||||
"Streamtape",
|
||||
"VOE",
|
||||
"Vidoza"
|
||||
],
|
||||
"values": [
|
||||
"Streamtape",
|
||||
"VOE",
|
||||
"Vidoza"
|
||||
]
|
||||
"entries": hosterOptions,
|
||||
"entryValues": hosterOptions,
|
||||
"values": hosterOptions
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
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("");
|
||||
}
|
||||
|
||||
273
javascript/anime/src/de/serienstream.js
Normal file
273
javascript/anime/src/de/serienstream.js
Normal file
@@ -0,0 +1,273 @@
|
||||
const mangayomiSources = [{
|
||||
"name": "SerienStream",
|
||||
"lang": "de",
|
||||
"baseUrl": "https://s.to",
|
||||
"apiUrl": "",
|
||||
"iconUrl": "https://s.to/favicon.ico",
|
||||
"typeSource": "single",
|
||||
"isManga": false,
|
||||
"isNsfw": false,
|
||||
"version": "0.0.2",
|
||||
"dateFormat": "",
|
||||
"dateFormatLocale": "",
|
||||
"pkgPath": "anime/src/de/serienstream.js"
|
||||
}];
|
||||
|
||||
class DefaultExtension extends MProvider {
|
||||
constructor () {
|
||||
super();
|
||||
this.client = new Client();
|
||||
}
|
||||
async getPopular(page) {
|
||||
const baseUrl = this.source.baseUrl;
|
||||
const res = await this.client.get(`${baseUrl}/beliebte-serien`);
|
||||
const elements = new Document(res.body).select("div.seriesListContainer div");
|
||||
const list = [];
|
||||
for (const element of elements) {
|
||||
const linkElement = element.selectFirst("a");
|
||||
const name = element.selectFirst("h3").text;
|
||||
const imageUrl = baseUrl + linkElement.selectFirst("img").attr("data-src");
|
||||
const link = linkElement.attr("href");
|
||||
list.push({ name, imageUrl, link });
|
||||
}
|
||||
return {
|
||||
list: list,
|
||||
hasNextPage: false
|
||||
}
|
||||
}
|
||||
async getLatestUpdates(page) {
|
||||
const baseUrl = this.source.baseUrl;
|
||||
const res = await this.client.get(`${baseUrl}/neu`);
|
||||
const elements = new Document(res.body).select("div.seriesListContainer div");
|
||||
const list = [];
|
||||
for (const element of elements) {
|
||||
const linkElement = element.selectFirst("a");
|
||||
const name = element.selectFirst("h3").text;
|
||||
const imageUrl = baseUrl + linkElement.selectFirst("img").attr("data-src");
|
||||
const link = linkElement.attr("href");
|
||||
list.push({ name, imageUrl, link });
|
||||
}
|
||||
return {
|
||||
list: list,
|
||||
hasNextPage: false
|
||||
}
|
||||
}
|
||||
async search(query, page, filters) {
|
||||
const baseUrl = this.source.baseUrl;
|
||||
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 list = [];
|
||||
for (const element of elements) {
|
||||
const name = element.text;
|
||||
const link = element.attr("href");
|
||||
const img = new Document((await this.client.get(baseUrl + link)).body).selectFirst("div.seriesCoverBox img").attr("data-src");
|
||||
const imageUrl = baseUrl + img;
|
||||
list.push({ name, imageUrl, link });
|
||||
}
|
||||
return {
|
||||
list: list,
|
||||
hasNextPage: false
|
||||
}
|
||||
}
|
||||
async getDetail(url) {
|
||||
const baseUrl = this.source.baseUrl;
|
||||
const res = await this.client.get(baseUrl + url);
|
||||
const document = new Document(res.body);
|
||||
const imageUrl = baseUrl +
|
||||
document.selectFirst("div.seriesCoverBox img").attr("data-src");
|
||||
const name = document.selectFirst("div.series-title h1 span").text;
|
||||
const genre = document.select("div.genres ul li").map(e => e.text);
|
||||
const description = document.selectFirst("p.seri_des").attr("data-full-description");
|
||||
const produzent = document.select("div.cast li")
|
||||
.filter(e => e.outerHtml.includes("Produzent:"));
|
||||
let author = "";
|
||||
if (produzent.length > 0) {
|
||||
author = produzent[0].select("li").map(e => e.text).join(", ");
|
||||
}
|
||||
const seasonsElements = document.select("#stream > ul:nth-child(1) > li > a");
|
||||
|
||||
const promises = [];
|
||||
const episodes = [];
|
||||
for (const element of seasonsElements) {
|
||||
promises.push(this.parseEpisodesFromSeries(element));
|
||||
}
|
||||
for (const p of (await Promise.allSettled(promises))) {
|
||||
if (p.status == 'fulfilled') {
|
||||
episodes.push(...p.value);
|
||||
}
|
||||
}
|
||||
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) {
|
||||
const titleAnchor = element.selectFirst("td.seasonEpisodeTitle a");
|
||||
const episodeSpan = titleAnchor.selectFirst("span");
|
||||
const url = titleAnchor.attr("href");
|
||||
const episodeSeasonId = element.attr("data-episode-season-id");
|
||||
let episode = episodeSpan.text.replace(/'/g, "'");
|
||||
let name = "";
|
||||
if (url.includes("/film")) {
|
||||
name = `Film ${episodeSeasonId} : ${episode}`;
|
||||
} else {
|
||||
const seasonMatch = url.match(/staffel-(\d+)\/episode/);
|
||||
name = `Staffel ${seasonMatch[1]} Folge ${episodeSeasonId} : ${episode}`;
|
||||
}
|
||||
return name && url ? { name, url } : {};
|
||||
}
|
||||
async getVideoList(url) {
|
||||
const baseUrl = this.source.baseUrl;
|
||||
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);
|
||||
let promises = [];
|
||||
const videos = [];
|
||||
|
||||
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 lang = (langkey == 1 || langkey == 3) ? 'Deutscher' : 'Englischer';
|
||||
const type = (langkey == 1) ? 'Dub' : 'Sub';
|
||||
const redirect = baseUrl + element.selectFirst("a.watchEpisode").attr("href");
|
||||
promises.push((async (redirect, lang, type, host) => {
|
||||
const location = (await dartClient.get(redirect)).headers.location;
|
||||
return await extractAny(location, host.toLowerCase(), lang, type, host);
|
||||
})(redirect, lang, type, host));
|
||||
}
|
||||
}
|
||||
for (const p of (await Promise.allSettled(promises))) {
|
||||
if (p.status == 'fulfilled') {
|
||||
videos.push.apply(videos, p.value);
|
||||
}
|
||||
}
|
||||
return this.sortVideos(videos);
|
||||
}
|
||||
sortVideos(videos) {
|
||||
const preference = new SharedPreferences();
|
||||
const hoster = RegExp(preference.get("preferred_hoster_new"));
|
||||
const lang = RegExp(preference.get("preferred_lang"));
|
||||
videos.sort((a, b) => {
|
||||
let qualityMatchA = hoster.test(a.quality) * lang.test(a.quality);
|
||||
let qualityMatchB = hoster.test(b.quality) * lang.test(b.quality);
|
||||
return qualityMatchB - qualityMatchA;
|
||||
});
|
||||
return videos;
|
||||
}
|
||||
getSourcePreferences() {
|
||||
const hosterOptions = ["Streamtape", "VOE", "Vidoza", "Doodstream"];
|
||||
const languageOptions = ["Deutscher Sub", "Deutscher Dub", "Englischer Sub"];
|
||||
return [
|
||||
{
|
||||
"key": "preferred_lang",
|
||||
"listPreference": {
|
||||
"title": "Bevorzugte Sprache",
|
||||
"summary": "",
|
||||
"valueIndex": 0,
|
||||
"entries": languageOptions,
|
||||
"entryValues": languageOptions
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "preferred_hoster_new",
|
||||
"listPreference": {
|
||||
"title": "Standard-Hoster",
|
||||
"summary": "",
|
||||
"valueIndex": 0,
|
||||
"entries": hosterOptions,
|
||||
"entryValues": hosterOptions
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "hoster_selection_new",
|
||||
"multiSelectListPreference": {
|
||||
"title": "Hoster auswählen",
|
||||
"summary": "",
|
||||
"entries": hosterOptions,
|
||||
"entryValues": hosterOptions,
|
||||
"values": hosterOptions
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
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