Closed krist0n3 closed 3 years ago
last working by Cappos :-)
const puppeteer = require('puppeteer');
async function main() { //const browser = await puppeteer.launch(); const browser = await puppeteer.launch({ headless: false, dumpio: false, devtools: false });
const page = await browser.newPage(); await page.setViewport({width: 1200, height: 720}) await page.goto('https://gurushots.com/', {waitUntil: 'networkidle0'});
//__ sign in _____ const login = '#dialogContent_0 > md-dialog-content > form > div:nth-child(1) > input'; const password = '#dialogContent_0 > md-dialog-content > form > div:nth-child(2) > input'; const loginSubmit = '#dialogContent_0 > md-dialog-content > form > button'
const CREDS = require('./LoginData');
await page.evaluate(async () => { const loginBtn = document.querySelectorAll('header gs-header div > div > protection:nth-child(1) a'); for (var btn of loginBtn) { const style = getComputedStyle(btn);
if (style.display !== 'none') {
await btn.click();
break;
}
} })
await page.click(login); await page.waitForTimeout(300); await page.keyboard.type(CREDS.login); await page.waitForTimeout(300);
await page.click(password); await page.keyboard.type(CREDS.password);
await page.click(loginSubmit); await page.waitForNavigation();
//___ await page.waitForTimeout(5000);
await page.evaluate(async () => { const LetsGo = document.getElementsByClassName('modal-vote__greeting'); const voteBtns = document.getElementsByClassName('icon-vote-negative'); const boostBtns = document.getElementsByClassName('boost-state-available');
//vote for photos for (var btn of voteBtns) { $(btn).click(); await new Promise(resolve => setTimeout(resolve, 4000)); $(LetsGo).click(); //const picForVote = $(".modal-votephotovote"); const picForVote = $(".modal-votephotovoted").prev();
if (picForVote.length === 0) {
$('div[ng-click="$ctrl.submit()"]').click();
await new Promise(resolve => setTimeout(resolve, 4000));
$('div[ng-click="$ctrl.close()"]').click();
await new Promise(resolve => setTimeout(resolve, 4000));
continue;
} else {
await picForVote.each(function (i, el) {
r = Math.random();
if (i >= 20 && r > 0.2) {
$(el).click();
}
});
await new Promise(resolve => setTimeout(resolve, 4000));
$('div[ng-click="$ctrl.submit()"]').click();
await new Promise(resolve => setTimeout(resolve, 4000));
$('div[ng-click="$ctrl.close()"]').click();
await new Promise(resolve => setTimeout(resolve, 4000));
}
}
// try to boost //if (boostBtns.length >= 1) { // for (var btn of boostBtns) { // $(btn).click(); // await new Promise(resolve => setTimeout(resolve, 4000)); // const picForVote = document.querySelector('div.c-modal-boost__photos > div:nth-child(1)'); // $(picForVote).click(); // await new Promise(resolve => setTimeout(resolve, 4000));
// } // } });
await console.log('Voting Done');
await browser.close(); } main();
Many thanks all . Have a nice 2021
Thank you. Have a great 2021
Hello, const loginBtn doesent work
const loginBtn = 'header#BLlJle> gs-header > div > div > protection:nth-child(1) > a.BLlJlj'; //primul e header bara toata, al doilea buton de sign in //const loginBtn = 'header#BLlJle > gs-header div > div > a.BLlJlj'; const login = '#dialogContent_0 > md-dialog-content > form > div:nth-child(1) > input'; const password = '#dialogContent_0 > md-dialog-content > form > div:nth-child(2) > input'; const loginSubmit = '#dialogContent_0 > md-dialog-content > form > button'
i don`t know how they change