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
import cheerio from "npm:cheerio";
const url =
"https://streambucket.net/playvideo.php?video_id=S0dpVVFEbWV3ZDBBNGI3QldBPT0=&server_id=42&token=S0dLWFR6NkcxTUllNHIzSlRGb0tTaXFTVStiSHNRdkpNcXFsOWtJamljYU5nQ1JId1dac2hVeTN5VGkrRG1ZN2FiSUs0ZU9MUEo1Sk9XcEhUTHJLOUt0cGc0aXZvTGhDUDhRV1IyMGR3Qnl4d0YyNERsQWRhO
const req = await fetch(
"https://streambucket.net/playvideo.php?video_id=S0dpVVFEbWV3ZDBBNGI3QldBPT0=&server_id=42&token=S0dLWFR6NkcxTUllNHIzSlRGb0tTaXFTVStiSHNRdkpNcXFsOWtJamljYU5nQ1JId1dac2hVeTN5VGkrRG1ZN2FiSUs0ZU9MUEo1Sk9XcEhUTHJLOUt0cGc0aXZvTGhDUDhRV1IyMGR3Qnl4d0YyNERsQWRhO
);
const html = await req.text();
const $ = cheerio.load(html);
// Extract the value of the hidden input field with name 'captcha_id'
const captchaId = $("input[name=\"captcha_id\"]").val();
const captchaAnswerValues = [];
$("input[name=\"captcha_answer[]\"]").each(function() {
captchaAnswerValues.push($(this).val());
});
console.log(captchaAnswerValues);
console.log(captchaId);
const headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0",
"Accept":
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.5",
"Content-Type": "application/x-www-form-urlencoded",
"Alt-Used": "streambucket.net",
"Upgrade-Insecure-Requests": "1",
"Sec-Fetch-Dest": "iframe",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-User": "?1",
"Priority": "u=4",
"Pragma": "no-cache",
"Cache-Control": "no-cache",
};
function getCombinations(arr, k) {
const result = [];
// Helper function to generate combinations recursively
function combine(prefix, start) {
if (prefix.length === k) {
result.push(prefix);
return;
}
for (let i = start; i < arr.length; i++) {
combine(prefix.concat(arr[i]), i + 1);
}
}
combine([], 0);
return result;
}
// Example usage
const items = captchaAnswerValues;
const combinations = getCombinations(items, 3);
console.log(combinations.length);
async function postCombinations(combinations, url, headers, captchaId) {
for (const combination of combinations) {
// Create the body for the POST request
const body = new URLSearchParams({
captcha_id: captchaId,
"captcha_answer[]": combination[0],
"captcha_answer[]": combination[1],
"captcha_answer[]": combination[2],
}).toString();
try {
// Perform the fetch request
const response = await fetch(url, {
method: "POST",
headers: headers,
body: body,
});
// Await and log the result of the fetch request
const result = await response.status;
console.log(result);
} catch (error) {
console.error("Error fetching combination:", combination, error);
}
}
}
postCombinations(combinations, url, headers, captchaId);
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!
July 28, 2024