Public
Script
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
import { customAlphabet } from "npm:nanoid";
const nanoid = customAlphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 10);
export interface DataSheet {
site: "dood" | "streamtape" | null;
siteSpecificId: string;
extractedURL: string;
accessHeaders: {};
fromCache: boolean;
subtitles?: {
language: string;
url: string;
}[];
thumbnails?: {
size: string;
url: string;
}[];
storyboard?: {
url: string;
}[];
}
export async function Fetcher(url: string, referer: string) {
const design = `?destination=${encodeURIComponent(url)}&referer=${encodeURIComponent(referer)}`;
const request = await fetch(`https://eb305cc8-973e-4f2d2-85dd-b1f16649c4d4.cloudflarepreviews.com/proxy${design}`, {
headers: {
"Cookie": "token=35b2fb9d503a9c50e0564db305bbe971817e63dbfb88c61461eef2afaf0fd6f1",
"Referer": referer,
},
});
return request.text();
}
export async function doodstreamExtractor(id: string): Promise<DataSheet> {
const returnData: DataSheet = {
site: "dood",
siteSpecificId: id,
extractedURL: "",
accessHeaders: {
Referer: `https://d000d.com/e/${id}`,
},
fromCache: false,
};
const baseUrl = "https://d000d.com";
const doodData = await Fetcher(`${baseUrl}/e/${id}`, baseUrl);
const poster = "";
const dataForLater = doodData.match(/\?token=([^&]+)&expiry=/)?.[1];
const path = doodData.match(/\$\.get\('\/pass_md5([^']+)/)?.[1];
const thumbnailTrack = `https:${doodData.match(/thumbnails:\s\{\s*vtt:\s'([^']*)'/)?.[1]}`;
const doodPage = await Fetcher(`${baseUrl}/pass_md5${path}`, `${baseUrl}/e/${id}`);
returnData.extractedURL = `${doodPage}${nanoid()}?token=${dataForLater}&expiry=${Date.now()}`;
returnData.storyboard = [{ url: thumbnailTrack }];
if (!returnData.extractedURL.startsWith("http")) {
throw new Error(`{ error: "Server Busy Try again !!!" }`);
}
return returnData;
}
// console.log(await doodstreamExtractor("9x3w3pu0xemy"));
export async function streamtapeExtractor(id: string): Promise<DataSheet> {
console.log(id);
const returnData: DataSheet = {
site: "streamtape",
siteSpecificId: id,
extractedURL: "https://streamtape.com/e/" + id,
accessHeaders: {
Referer: `https://streamtape.com/e/${id}`,
},
fromCache: false,
subtitles: [],
thumbnails: [],
storyboard: [],
};
const baseUrl = "https://streamtape.com";
const embed = await Fetcher(`${baseUrl}/e/${id}`, "");
const match = embed.match(/robotlink'\)\.innerHTML = '(.*)'/);
if (!match) throw new Error("No match found");
const [fh, sh] = match[1].split("+ ('");
if (!fh || !sh) throw new Error("No match found");
const url = `https:${fh.replace(/'/g, "").trim()}${sh.substring(3).trim()}`;
returnData.extractedURL = url;
return returnData;
}
// console.log(await streamtapeExtractor("Q24MWewWZes0Yxg"));
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 10, 2024