Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
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
import { fetch } from "https://esm.town/v/std/fetch";
let { failureCount } = await import("https://esm.town/v/pranjaldotdev/failureCount");
let { successCount } = await import("https://esm.town/v/pranjaldotdev/successCount");
export const sendBulkVote = (async () => {
const doVote = async (): Promise<boolean> => {
try {
const votingURL =
"https://jc-voting-prod.api.engageapps.jio/api/voting/questions/q-e4d1acfe-abd5-4417-a80b-1a9e0f54174a/answer";
const token =
"eyJhbGciOiJIUzI1NiJ9.eyJwbGF0Zm9ybSI6Imppb3Zvb3QiLCJ1c2VyaWR0eXBlIjoidXVpZCIsImlzSmlvVXNlciI6ZmFsc2UsImlzR3Vlc3QiOmZhbHNlLCJwaG9uZU5vIjoiMzM2NjBiNzQtM2U5YS00ZWJhLTlmMTMtNzBkNTQ3NmUwOTNkIiwicHJvZmlsZUlkIjoiMTE1ODc3YWQtZDE3Mi00YTAwLWI2OTMtMDlkZmNjNT
const response = await fetch(votingURL, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: token,
"user-agent":
"Mozilla/5.0 (iPhone; CPU iPhone OS 16_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148",
origin: "https://engage.jiocinema.com",
referer: "https://engage.jiocinema.com/",
},
body: JSON.stringify({
answer: ["alpha_Elvish Yadav"],
}),
});
const statusCode = response.status;
if (statusCode === 200) {
return true;
}
return false;
}
catch (ex) {
console.log("Error: ", ex);
return false;
}
};
const fireRequests = async () => {
console.log("Script booting up 🚀");
let successRequest = 0;
let failureRequest = 0;
for (let idx = 0; idx < 100; idx++) {
const isSuccess = await doVote();
if (isSuccess)
successCount += 1;
else
failureCount += 1;
}
};
await fireRequests();
})();
October 23, 2023