Skip to content

Instantly share code, notes, and snippets.

@tcurvelo
Created April 18, 2018 00:46
Show Gist options
  • Save tcurvelo/5ba09230817cca64f283f29e5226e3cc to your computer and use it in GitHub Desktop.
Save tcurvelo/5ba09230817cca64f283f29e5226e3cc to your computer and use it in GitHub Desktop.
WIP: Automating Google Takeout Download
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({headless: false});
const page = await browser.newPage();
await page.goto('https://takeout.google.com/');
const input = await page.evaluate(() => {
const next = document.querySelector('#identifierNext');
document.querySelector('input[type=email]')
.value = 'login@gmail.com' ;
next.click();
document.querySelector('input[type=password]')
.value = 'password' ;
next.click()
});
await page.goto('https://takeout.google.com/settings/takeout/light');
document
.querySelectorAll('input[type=checkbox]')
.forEach((e) => e.checked=false);
document
.querySelectorAll(`
[value=profile],
[value=calendar],
[value=drive],
[value=plus_photos],
[value=keep],
[value=gmail]
`)
.forEach((e) => e.checked=true);
// ...
await browser.close();
})();
@prithvi514
Copy link

@tcurvelo looking forward for the complete code. Thanks

@dm17
Copy link

dm17 commented Aug 24, 2020

@prithvi514 @tcurvelo end up using a different solution? Would be good if it did not overwrite the latest Takeout if the new take is < the size of the last one. Also an adjustable value on how many Takeouts to keep and how often to do it would be ideal.
Thanks.

@ROBERT-MCDOWELL
Copy link

where to find the complete code?

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