1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import { decrypt } from "https://esm.town/v/tempdev/vidsrcDecryptor";
import * as cheerio from "npm:cheerio";
const BASEDOM = "https://whisperingauroras.com";
interface Servers {
name: string | null;
dataHash: string | null;
}
interface APIResponse {
name: string | null;
image: string | null;
mediaId: string | null;
stream: string | null;
}
interface RCPResponse {
metadata: {
title: string;
image: string;
};
data: string;
}
async function serversLoad(html): Promise<Servers[]> {
const $ = cheerio.load(html);
const servers: Servers[] = [];
$(".serversList .server").each((index, element) => {
const server = $(element);
servers.push({
name: server.text().trim(),
dataHash: server.attr("data-hash"),
});
});
return servers;
}
async function SRCRCPhandler() {
}
async function PRORCPhandler(prorcp: string): Promise<string | null> {
const prorcpFetch = await fetch(`${BASEDOM}/prorcp/${prorcp}`);
const prorcpResponse = await prorcpFetch.text();
const jsFile =
prorcpResponse.match(/<script\s+src="\/([^"]*\.js)\?\_=([^"]*)"><\/script>/gm)?.reduce((_, match) =>
match.replace(/.*src="\/([^"]*\.js)\?\_=([^"]*)".*/, "$1?_=$2")
) || "";
const jsFileReq = await fetch(
`${BASEDOM}/${jsFile}`,
{
"headers": {
"accept": "*/*",
"accept-language": "en-US,en;q=0.9",
"priority": "u=1",
"sec-ch-ua": "\"Chromium\";v=\"128\", \"Not;A=Brand\";v=\"24\", \"Google Chrome\";v=\"128\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "script",
"sec-fetch-mode": "no-cors",
"sec-fetch-site": "same-origin",
"Referer": `${BASEDOM}/`,
"Referrer-Policy": "origin",
},
"body": null,
"method": "GET",
},
);
const jsCode = await jsFileReq.text();
const decryptRegex = /{}\}window\[([^"]+)\("([^"]+)"\)/;
const decryptMatches = jsCode.match(decryptRegex);
// ^ this func is the decrypt function (fn name)
const $ = cheerio.load(prorcpResponse);
if (!decryptMatches || decryptMatches?.length < 3) return null;
const id = decrypt(decryptMatches[2].toString().trim(), decryptMatches[1].toString().trim());
const data = $("#" + id);
const result = await decrypt(await data.text(), decryptMatches[2].toString().trim());
return result;
}
async function rcpGrabber(html: string): Promise<RCPResponse | null> {
const regex = /src:\s*'([^']*)'/;
const match = html.match(regex);
if (!match) return null;
return {
metadata: {
title: "",
image: "",
},
data: match[1],
};
}
async function tmdbScrape(tmdbId: string, type: "movie" | "tv", season?: number, episode?: number) {
if (season && episode && (type === "movie")) {
throw new Error("Invalid Data.");
}
const url = (type === "movie")
? `https://vidsrc.net/embed/${type}?tmdb=${tmdbId}`
: `https://vidsrc.net/embed/${type}?tmdb=${tmdbId}&season=${season}&episode=${episode}`;
const embed = await fetch(url);
const embedResp = await embed.text();
const servers = await serversLoad(embedResp);
const rcpFetchPromises = servers.map(element => {
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
September 16, 2024