forked from 50n50/sources
Update verseriesonline/verseriesonline.js
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
async function searchResults(keyword) {
|
async function searchResults(keyword) {
|
||||||
const urls = [
|
const urls = [
|
||||||
`https://www.verseriesonline.net/recherche?q=${encodeURIComponent(keyword)}`,
|
`https://verseriesonline.net/buscar?q=${encodeURIComponent(keyword)}`,
|
||||||
`https://www.verseriesonline.net/recherche?q=${encodeURIComponent(keyword)}&page=2`,
|
`https://verseriesonline.net/buscar?q=${encodeURIComponent(keyword)}&page=2`,
|
||||||
`https://www.verseriesonline.net/recherche?q=${encodeURIComponent(keyword)}&page=3`,
|
`https://verseriesonline.net/buscar?q=${encodeURIComponent(keyword)}&page=3`,
|
||||||
`https://www.verseriesonline.net/recherche?q=${encodeURIComponent(keyword)}&page=4`
|
`https://verseriesonline.net/buscar?q=${encodeURIComponent(keyword)}&page=4`
|
||||||
];
|
];
|
||||||
const regex = /<div class="short gridder-list">.*?<a[^>]+href="([^"]+)"[^>]*>.*?<img[^>]+src="([^"]+)"[^>]*>.*?<div class="short_title"[^>]*>.*?<a[^>]+title="([^"]+)"/gs;
|
const regex = /<article class="serie-card gridder-list">.*?<a[^>]+href="([^"]+)"[^>]*>.*?<img[^>]+data-src="([^"]+)"[^>]*>.*?<a class="serie-card__title"[^>]*>([^<]+)<\/a>/gs;
|
||||||
try {
|
try {
|
||||||
const fetchPromises = urls.map(url => fetchv2(url).then(r => r.text()));
|
const fetchPromises = urls.map(url => fetchv2(url).then(r => r.text()));
|
||||||
const htmls = await Promise.all(fetchPromises);
|
const htmls = await Promise.all(fetchPromises);
|
||||||
@@ -15,8 +15,8 @@ async function searchResults(keyword) {
|
|||||||
while ((match = regex.exec(html)) !== null) {
|
while ((match = regex.exec(html)) !== null) {
|
||||||
results.push({
|
results.push({
|
||||||
href: match[1].trim(),
|
href: match[1].trim(),
|
||||||
image: "https://www.verseriesonline.net" + match[2].trim(),
|
image: "https://verseriesonline.net" + match[2].trim(),
|
||||||
title: match[3].trim().replace("regarder ","")
|
title: match[3].trim()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
regex.lastIndex = 0;
|
regex.lastIndex = 0;
|
||||||
@@ -36,7 +36,7 @@ async function extractDetails(url) {
|
|||||||
const response = await fetchv2(url);
|
const response = await fetchv2(url);
|
||||||
const html = await response.text();
|
const html = await response.text();
|
||||||
|
|
||||||
const regex = /<div class="full_content-desc">.*?<span>(.*?)<\/span>/s;
|
const regex = /<div class="full_content-desc">[\s\S]*?<p>(.*?)<\/p>/s;
|
||||||
const match = regex.exec(html);
|
const match = regex.exec(html);
|
||||||
const description = match ? match[1].trim() : "N/A";
|
const description = match ? match[1].trim() : "N/A";
|
||||||
|
|
||||||
@@ -61,31 +61,17 @@ async function extractEpisodes(url) {
|
|||||||
const response = await fetchv2(url);
|
const response = await fetchv2(url);
|
||||||
const html = await response.text();
|
const html = await response.text();
|
||||||
|
|
||||||
const seasonRegex = /<a class="th-hover" href="([^"]+)">.*?<div class="th-title1">temporada (\d+)<\/div>/gs;
|
const episodeRegex = /<a class="episode-card line-item" href="([^"]+)"[^>]*>[\s\S]*?T\s*<span>(\d+)<\/span>\s*E\s*<span>(\d+)<\/span>/g;
|
||||||
const seasons = [];
|
let match;
|
||||||
let seasonMatch;
|
|
||||||
while ((seasonMatch = seasonRegex.exec(html)) !== null) {
|
while ((match = episodeRegex.exec(html)) !== null) {
|
||||||
seasons.push({
|
results.push({
|
||||||
url: seasonMatch[1].trim(),
|
season: parseInt(match[2], 10),
|
||||||
number: parseInt(seasonMatch[2], 10)
|
href: match[1].trim(),
|
||||||
|
number: parseInt(match[3], 10)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(seasons.map(async (season) => {
|
|
||||||
const res = await fetchv2(season.url);
|
|
||||||
const seasonHtml = await res.text();
|
|
||||||
|
|
||||||
const episodeRegex = /<a href="([^"]+)">.*?<span class="name">Capítulo (\d+)<\/span>/gs;
|
|
||||||
let epMatch;
|
|
||||||
while ((epMatch = episodeRegex.exec(seasonHtml)) !== null) {
|
|
||||||
results.push({
|
|
||||||
season: season.number,
|
|
||||||
href: epMatch[1].trim(),
|
|
||||||
number: parseInt(epMatch[2], 10)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
results.sort((a, b) => {
|
results.sort((a, b) => {
|
||||||
if (a.season !== b.season) {
|
if (a.season !== b.season) {
|
||||||
return a.season - b.season;
|
return a.season - b.season;
|
||||||
@@ -109,13 +95,13 @@ async function extractStreamUrl(url) {
|
|||||||
const response = await fetchv2(url);
|
const response = await fetchv2(url);
|
||||||
const html = await response.text();
|
const html = await response.text();
|
||||||
|
|
||||||
const blockRegex = /<div class="lien fx-row"[^>]*data-hash="([^"]+)"[^>]*>([\s\S]*?)<\/div>/g;
|
|
||||||
let hash = null;
|
let hash = null;
|
||||||
|
const blockRegex = /<a[^>]*class="play-option"[^>]*data-hash="([^"]+)"[^>]*>[\s\S]*?streamwish\.to[\s\S]*?<\/a>/g;
|
||||||
let blockMatch;
|
let blockMatch;
|
||||||
while ((blockMatch = blockRegex.exec(html)) !== null) {
|
while ((blockMatch = blockRegex.exec(html)) !== null) {
|
||||||
const blockContent = blockMatch[2];
|
const hashMatch = blockMatch[0].match(/data-hash="([^"]+)"/);
|
||||||
if (/class="serv"[^>]*>uqload<\/span>/.test(blockContent)) {
|
if (hashMatch) {
|
||||||
hash = blockMatch[1].trim();
|
hash = hashMatch[1].trim();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,21 +113,22 @@ async function extractStreamUrl(url) {
|
|||||||
console.log("Hash:"+ hash);
|
console.log("Hash:"+ hash);
|
||||||
console.log("Token:"+ token);
|
console.log("Token:"+ token);
|
||||||
|
|
||||||
const embedResponse = await fetchv2("https://www.verseriesonline.net/hashembedlink", {}, "POST", `hash=${encodeURIComponent(hash)}&_token=${encodeURIComponent(token)}`);
|
const embedResponse = await fetchv2("https://www.verseriesonline.net/hashembedlink", { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"}, "POST", `hash=${encodeURIComponent(hash)}&_token=${encodeURIComponent(token)}`);
|
||||||
const embedJson = await embedResponse.json();
|
const embedJson = await embedResponse.json();
|
||||||
const uqloadUrl = embedJson.link;
|
console.log("Embed JSON:"+ JSON.stringify(embedJson));
|
||||||
|
const embedUrl = embedJson.link;
|
||||||
|
|
||||||
const someHtml = await fetchv2(uqloadUrl);
|
const someHtml = await fetchv2(embedUrl);
|
||||||
const someText = await someHtml.text();
|
const someText = await someHtml.text();
|
||||||
|
|
||||||
const finalUrl = await uqloadExtractor(someText, uqloadUrl);
|
const finalUrl = await streamwishExtractor(someText, embedUrl);
|
||||||
const streamObj = {
|
const streamObj = {
|
||||||
streams: [
|
streams: [
|
||||||
{
|
{
|
||||||
title: "Server 1",
|
title: "Server 1",
|
||||||
streamUrl: finalUrl,
|
streamUrl: finalUrl,
|
||||||
headers: {
|
headers: {
|
||||||
referer: "https://uqload.cx/"
|
referer: ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -156,20 +143,129 @@ async function extractStreamUrl(url) {
|
|||||||
/* SCHEME START */
|
/* SCHEME START */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name uqloadExtractor
|
* @name streamwishExtractor
|
||||||
* @author scigward
|
* @author Ibro
|
||||||
*/
|
*/
|
||||||
async function uqloadExtractor(html, embedUrl) {
|
|
||||||
try {
|
|
||||||
const match = html.match(/sources:\s*\[\s*"([^"]+\.mp4)"\s*\]/);
|
|
||||||
const videoSrc = match ? match[1] : "";
|
|
||||||
|
|
||||||
return videoSrc;
|
async function streamwishExtractor(data, url = null) {
|
||||||
} catch (error) {
|
const obfuscatedScript = data.match(/<script[^>]*>\s*(eval\(function\(p,a,c,k,e,d.*?\)[\s\S]*?)<\/script>/);
|
||||||
console.log("uqloadExtractor error:", error.message);
|
|
||||||
return null;
|
const unpackedScript = unpack(obfuscatedScript[1]);
|
||||||
|
|
||||||
|
const m3u8Match = unpackedScript.match(/file:"(https?:\/\/.*?\.m3u8.*?)"/);
|
||||||
|
|
||||||
|
const m3u8Url = m3u8Match[1];
|
||||||
|
console.log(m3u8Url);
|
||||||
|
return m3u8Url;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
///////////////////////////// Helper Functions ////////////////////////////
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/*
|
||||||
|
Credit to GitHub user @mnsrulz for Unpacker Node library
|
||||||
|
|
||||||
|
Credits to @jcpiccodev for writing the full deobfuscator <3
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* REMOVE_START */
|
||||||
|
|
||||||
|
class Unbaser {
|
||||||
|
constructor(base) {
|
||||||
|
this.ALPHABET = {
|
||||||
|
62: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||||
|
95: "' !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'",
|
||||||
|
};
|
||||||
|
this.dictionary = {};
|
||||||
|
this.base = base;
|
||||||
|
if (36 < base && base < 62) {
|
||||||
|
this.ALPHABET[base] = this.ALPHABET[base] ||
|
||||||
|
this.ALPHABET[62].substr(0, base);
|
||||||
|
}
|
||||||
|
if (2 <= base && base <= 36) {
|
||||||
|
this.unbase = (value) => parseInt(value, base);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
[...this.ALPHABET[base]].forEach((cipher, index) => {
|
||||||
|
this.dictionary[cipher] = index;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (er) {
|
||||||
|
throw Error("Unsupported base encoding.");
|
||||||
|
}
|
||||||
|
this.unbase = this._dictunbaser;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_dictunbaser(value) {
|
||||||
|
let ret = 0;
|
||||||
|
[...value].reverse().forEach((cipher, index) => {
|
||||||
|
ret = ret + ((Math.pow(this.base, index)) * this.dictionary[cipher]);
|
||||||
|
});
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SCHEME END */
|
function detect(source) {
|
||||||
|
return source.replace(" ", "").startsWith("eval(function(p,a,c,k,e,");
|
||||||
|
}
|
||||||
|
|
||||||
|
function unpack(source) {
|
||||||
|
let { payload, symtab, radix, count } = _filterargs(source);
|
||||||
|
if (count != symtab.length) {
|
||||||
|
throw Error("Malformed p.a.c.k.e.r. symtab.");
|
||||||
|
}
|
||||||
|
let unbase;
|
||||||
|
try {
|
||||||
|
unbase = new Unbaser(radix);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
throw Error("Unknown p.a.c.k.e.r. encoding.");
|
||||||
|
}
|
||||||
|
function lookup(match) {
|
||||||
|
const word = match;
|
||||||
|
let word2;
|
||||||
|
if (radix == 1) {
|
||||||
|
word2 = symtab[parseInt(word)];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
word2 = symtab[unbase.unbase(word)];
|
||||||
|
}
|
||||||
|
return word2 || word;
|
||||||
|
}
|
||||||
|
source = payload.replace(/\b\w+\b/g, lookup);
|
||||||
|
return _replacestrings(source);
|
||||||
|
function _filterargs(source) {
|
||||||
|
const juicers = [
|
||||||
|
/}\('(.*)', *(\d+|\[\]), *(\d+), *'(.*)'\.split\('\|'\), *(\d+), *(.*)\)\)/,
|
||||||
|
/}\('(.*)', *(\d+|\[\]), *(\d+), *'(.*)'\.split\('\|'\)/,
|
||||||
|
];
|
||||||
|
for (const juicer of juicers) {
|
||||||
|
const args = juicer.exec(source);
|
||||||
|
if (args) {
|
||||||
|
let a = args;
|
||||||
|
if (a[2] == "[]") {
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return {
|
||||||
|
payload: a[1],
|
||||||
|
symtab: a[4].split("|"),
|
||||||
|
radix: parseInt(a[2]),
|
||||||
|
count: parseInt(a[3]),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (ValueError) {
|
||||||
|
throw Error("Corrupted p.a.c.k.e.r. data.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw Error("Could not make sense of p.a.c.k.e.r data (unexpected code structure)");
|
||||||
|
}
|
||||||
|
function _replacestrings(source) {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* REMOVE_END */
|
||||||
|
|
||||||
|
/* SCHEME END */
|
||||||
Reference in New Issue
Block a user