Skip to content

Instantly share code, notes, and snippets.

@devasheeshG
Created December 28, 2024 22:37
Show Gist options
  • Save devasheeshG/31355eb900d676e1e4bba934c51ea4dd to your computer and use it in GitHub Desktop.
Save devasheeshG/31355eb900d676e1e4bba934c51ea4dd to your computer and use it in GitHub Desktop.
const fetch = require('node-fetch');
const crypto = require('crypto');
const API_URL = "https://returnyoutubedislikeapi.com";
const VIDEO_ID = "xQrx8pqsWPU";
function countLeadingZeroes(uInt8View, limit) {
let zeroes = 0;
let value = 0;
for (let i = 0; i < uInt8View.length; i++) {
value = uInt8View[i];
if (value === 0) {
zeroes += 8;
} else {
let count = 1;
if (value >>> 4 === 0) {
count += 4;
value <<= 4;
}
if (value >>> 6 === 0) {
count += 2;
value <<= 2;
}
zeroes += count - (value >>> 7);
break;
}
if (zeroes >= limit) {
break;
}
}
return zeroes;
}
// Puzzle solving function from original code
async function solvePuzzle(puzzle) {
const challenge = Uint8Array.from(atob(puzzle.challenge), c => c.charCodeAt(0));
const buffer = new ArrayBuffer(20);
const uInt8View = new Uint8Array(buffer);
const uInt32View = new Uint32Array(buffer);
const maxCount = Math.pow(2, puzzle.difficulty) * 3;
for (let i = 4; i < 20; i++) {
uInt8View[i] = challenge[i - 4];
}
for (let i = 0; i < maxCount; i++) {
uInt32View[0] = i;
const hash = await crypto.subtle.digest('SHA-512', buffer);
const hashUint8 = new Uint8Array(hash);
if (countLeadingZeroes(hashUint8) >= puzzle.difficulty) {
return {
solution: btoa(String.fromCharCode.apply(null, uInt8View.slice(0, 4)))
};
}
}
return {};
}
function generateUserID(length = 36) {
const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
let result = "";
const values = new Uint32Array(length);
crypto.getRandomValues(values);
for (let i = 0; i < length; i++) {
result += charset[values[i] % charset.length];
}
return result;
}
async function register() {
const userId = generateUserID();
const registrationResponse = await fetch(
`${API_URL}/puzzle/registration?userId=${userId}`,
{
method: "GET",
headers: {
"Accept": "application/json"
}
}
).then(response => response.json());
const solvedPuzzle = await solvePuzzle(registrationResponse);
if (!solvedPuzzle.solution) {
return register();
}
const result = await fetch(
`${API_URL}/puzzle/registration?userId=${userId}`,
{
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(solvedPuzzle)
}
).then(response => response.json());
if (result === true) {
return userId;
}
}
async function sendDislike(userId, videoId) {
const voteResponse = await fetch(`${API_URL}/interact/vote`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
userId,
videoId,
value: -1 // -1 for dislike
})
});
if (voteResponse.status === 401) {
const newUserId = await register();
return sendDislike(newUserId, videoId);
}
const voteResponseJson = await voteResponse.json();
const solvedPuzzle = await solvePuzzle(voteResponseJson);
if (!solvedPuzzle.solution) {
return sendDislike(userId, videoId);
}
return fetch(`${API_URL}/interact/confirmVote`, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
...solvedPuzzle,
userId,
videoId
})
});
}
async function startDislikeLoop() {
while (true) {
try {
let userId = await register();
console.log("Registered with userId:", userId);
await sendDislike(userId, VIDEO_ID);
console.log("Dislike sent successfully");
} catch (error) {
console.error("Error:", error);
}
}
}
// Start the dislike loop
startDislikeLoop().catch(console.error);
@shar-mayank
Copy link

discord pe live dekha tha yeh sab hote hue. aaj bhi vo din yaad hai lmaooo

@devasheeshG
Copy link
Author

Huqum kro sur bas app

@shar-mayank
Copy link

Huqum kro sur bas app

khana bana lo babu aap, nahi toh bhookhe pet sona padega. SF mein aapke liye mein khana banane toh aa nahi paaunga aur na hi can kholne lmfaoooo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment