8

Scrape your Google Play Console cookies with Puppeteer

 2 years ago
source link: https://gist.github.com/axeldelafosse/816b9e2856b358c4b8a29ced031f99b7
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Scrape your Google Play Console cookies with Puppeteer 🍪 · GitHub

Instantly share code, notes, and snippets.

Scrape your Google Play Console cookies with Puppeteer

import puppeteer from 'puppeteer-extra'; import StealthPlugin from 'puppeteer-extra-plugin-stealth';

async function scrapeGooglePlayCookies() { console.log('Scraping Google Play cookies...');

const browser = await puppeteer.use(StealthPlugin()).launch({ headless: false, executablePath: process.env.PUPPETEER_EXEC_PATH, args: [ '--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', ], }); const page = await browser.newPage(); await page.goto( 'https://accounts.google.com/signin/v2/identifier?service=androiddeveloper&passive=true&continue=https%3A%2F%2Fplay.google.com%2Fconsole%2Fdeveloper%2F&flowName=GlifWebSignIn&flowEntry=ServiceLogin', ); await page.waitForSelector('input[type="email"]'); await page.type('input[type="email"]', process.env.GOOGLE_PLAY_EMAIL); await Promise.all([ await page.keyboard.press('Enter'), page.waitForNavigation(), ]); await page.waitForSelector('input[type="password"]', { visible: true }); await page.type('input[type="password"]', process.env.GOOGLE_PLAY_PASSWORD); await Promise.all([ await page.keyboard.press('Enter'), page.waitForNavigation(), ]); await page.waitForFunction( 'document.querySelector("body").innerText.includes("Choose developer account")', ); const cookies = await page.cookies();

cookies.map((cookie) => { console.log(cookie); });

await browser.close();

console.log('Done!'); }


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK