Created
October 22, 2020 00:50
-
-
Save yeisoncruz16/7b9d044392b4553cb7801fc3df3092f9 to your computer and use it in GitHub Desktop.
Simple NodeJs script to use Headless to increase Youtube views
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dependencies :
npm install puppeteer