Zavavilyliar333
New member
I'm going to get right to the point. I'm trying to bypass Twitch's login funcaptcha using 2captcha's API. Everything works well: My bot communicates with 2captcha fast enough where the captcha won't timeout and my bot receives the token needed to authenticate the captcha and login, except there is no submit button to actually go through with the login. To the best of my knowledge, I've looked through every Github post, every stackoverflow post regarding this issue, and the best solution I could find was to look through the Google Network tab in the devtools to look for a function to call manually which would simulate a button and get you through the captcha. With my limited coding ability, I was able to find a function which references ArkoseEnforcement & the word "callback" which I believe is what I'm trying to find. After attempting to scavenge the sources tab and network tab the best I could find was this:
I've been trying to implement this function for an hour with no success and I also tried looking at "callback" and "ArkoseEnforment.funcaptcha_events" etc. etc.
I seriously have no idea how to implement them into my code and I would appreciate any help on where to start.
Here is an example of my code logging the "tc-token" value for the funcaptcha:
Here is what the captcha interface looks like (no button):
I've been trying to implement this function for an hour with no success and I also tried looking at "callback" and "ArkoseEnforment.funcaptcha_events" etc. etc.
I seriously have no idea how to implement them into my code and I would appreciate any help on where to start.
Code:
//require packages
require('dotenv').config(); const fs = require('fs'); const puppeteer = require('puppeteer'); const https = require('https');
//define varibles
var usernames = []; var pkValue; var surl = process.env.SURL ; var pk = process.env.PUBLICKEY ; var api = process.env.APIKEY;
const readFile = fs.readFileSync("accounts.txt").toString().split("\n");
//read accounts
console.log(`Reading ${readFile.length} lines.`);
for(i in readFile) {
(readFile[i].toLowerCase().startsWith("u") ? usernames.push(readFile[i].slice(10).replace("\r", "")) : null);
}
//get captcha
//retreive stream keys
async function getKey(username) {
const browser = await puppeteer.launch({headless:false}); const page = await browser.newPage(); const navigationPromise = page.waitForNavigation()
//get captcha
function getCaptcha(captchaID) {
https.get(`https://2captcha.com/res.php?key=${api}&action=get&id=${captchaID.slice(3)}`, (response) => {
var dataRes = '';
response.on('data', (chunk) => {
dataRes += chunk;
})
response.on('end', () => {
if (dataRes.toLowerCase()==="capcha_not_ready") {
setTimeout(() => {getCaptcha(captchaID)}, 5000)
}
else {
pkValue = dataRes.slice(3)
console.log(pkValue);
page.evaluate((pkValue) => {
//add token to val
document.querySelector('#FunCaptcha-Token').value = pkValue;
//submit form
//somehow need to submit the form here.
}, pkValue)
}
})
})
}
await page.goto(`https://dashboard.twitch.tv/u/${username}/settings/stream`, { waitUntil: ['networkidle2'] })
await page.setViewport({ width: 1920, height: 880 })
await page.waitForSelector('.sc-AxjAm #login-username')
await page.click('.sc-AxjAm #login-username')
await page.type('.sc-AxjAm #login-username', username)
await page.waitForSelector('.sc-AxjAm #password-input')
await page.click('.sc-AxjAm #password-input')
await page.type('.sc-AxjAm #password-input', process.env.PASSWORD)
await page.waitForSelector('.sc-AxjAm > .sc-AxjAm:nth-child(3) > .ScCoreButton-sc-1qn4ixc-0 > .ScCoreButtonLabel-lh1yxp-0 > .sc-AxjAm', {visible:true})
await page.click('.sc-AxjAm > .sc-AxjAm:nth-child(3) > .ScCoreButton-sc-1qn4ixc-0 > .ScCoreButtonLabel-lh1yxp-0 > .sc-AxjAm')
await page.waitForSelector('#FunCaptcha-Token')
//request 2captcha funcaptcha
await https.get(`https://2captcha.com/in.php?key=${api}&method=funcaptcha&publickey=${pk}&surl=${surl}&pageurl=https://dashboard.twitch.tv/u/${username}/settings/stream`, (response) => {
var data = '';
response.on('data', (chunk) => {
data += chunk;
})
response.on('end', () => {
setTimeout(() => {getCaptcha(data)}, 20000)
})
})
.on('error', (e) => {
console.log(e);
})
await page.waitForSelector('.sc-AxjAm:nth-child(2) > .sc-AxjAm > .ScCoreButton-sc-1qn4ixc-0 > .ScCoreButtonLabel-lh1yxp-0 > .sc-AxjAm', {visible:true,timeout:0})
var streamkey = await page.evaluate(() => document.querySelector('.sc-AxjAm:nth-child(2) > .sc-AxjAm > .ScCoreButton-sc-1qn4ixc-0 > .ScCoreButtonLabel-lh1yxp-0 > .sc-AxjAm').innerHTML);
await navigationPromise
await fs.appendFile('userkeys.txt', `${username}:${streamkey}`, e => console.log(`error: ${e}`))
}
console.log(`Getting keys.`);
(async () => {
for(i in usernames) {
await getKey(usernames[i]);
}
})();
//https://dashboard.twitch.tv/u/stokeshester/settings/stream trying to login as soon as I enter this link
Here is an example of my code logging the "tc-token" value for the funcaptcha:
Here is what the captcha interface looks like (no button):