-
-
Save eldorplus/c03efd492a256759a19c2130a087ffba to your computer and use it in GitHub Desktop.
Create a google account and go to youtube with puppeteer.
This file contains hidden or 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'); | |
const uuid = require('uuid'); | |
const sleep = ms => new Promise(r => setTimeout(r, ms)); | |
(async () => { | |
const browser = await puppeteer.launch({ headless: false }); | |
const page = await browser.newPage(); | |
const id = uuid.v4(); | |
const [firstName, lastName] = id.split('-'); | |
const username = id.slice(0, 30).replace(/-/g, '.'); | |
const password = `${id}123!`; | |
await page.goto('https://accounts.google.com/signin/v2/identifier?hl=en&continue=https%3A%2F%2Fwww.youtube.com%2Fsignin%3Fhl%3Den%26next%3D%252F%26app%3Ddesktop%26action_handle_signin%3Dtrue&passive=true&service=youtube&uilel=3&flowName=GlifWebSignIn&flowEntry=ServiceLogin'); | |
// Click "Create an account" | |
await Promise.all([ | |
page.waitForNavigation(), | |
page.click('.U26fgb.O0WRkf.oG5Srb.HQ8yf.C0oVfc.nDKKZc.NpwL8d.t29vte.G3hhxb'), | |
]); | |
// Wait for page to load | |
await sleep(1000); | |
// Click "Create a Gmail account instead" | |
await page.tap('.uBOgn'); | |
await page.type('#firstName', firstName); | |
await page.type('#lastName', lastName); | |
await page.type('#username', username); | |
await page.type('input[type="password"][name="Passwd"]', password); | |
await page.type('input[type="password"][name="ConfirmPasswd"]', password); | |
// Click "Next" | |
await page.tap('#accountDetailsNext'); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment