Skip to content

Instantly share code, notes, and snippets.

@yeisoncruz16
Created October 22, 2020 00:50
Show Gist options
  • Save yeisoncruz16/7b9d044392b4553cb7801fc3df3092f9 to your computer and use it in GitHub Desktop.
Save yeisoncruz16/7b9d044392b4553cb7801fc3df3092f9 to your computer and use it in GitHub Desktop.
Simple NodeJs script to use Headless to increase Youtube views
const puppeteer = require('puppeteer');
(async () => {
let proxies = [
'',
'159.89.191.89:8080'
];
let urls = [
'',
"https://www.youtube.com/watch?v=9bZkp7q19f0&ab_channel=officialpsy"
];
let selectedProxy = proxies[Math.floor((Math.random() * 83) + 1)];
console.log("############# "+ selectedProxy +" ###################");
let selectedUrl = urls[Math.floor((Math.random() * 13) + 1)];
console.log("############# "+ selectedUrl +" ###################");
console.log("###################################################");
const browser = await puppeteer.launch({
args: [
'--proxy-server='+selectedProxy,
'--no-sandbox', '--disable-setuid-sandbox'
],
headless: true
});
try{
const page = await browser.newPage();
await page.goto(selectedUrl, {waitUntil: 'load', timeout: 0});
await page.waitFor(3000);
await page.click(".ytp-play-button.ytp-button");
await page.waitFor(120000);
}catch(error){
console.log(error);
await browser.close();
}finally{
await browser.close();
}
})();
@yeisoncruz16
Copy link
Author

Dependencies :

npm install puppeteer

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