Skip to content

Instantly share code, notes, and snippets.

@bitmvr
Last active July 25, 2019 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitmvr/b83d524c1bffd10ff2830a9336fe749a to your computer and use it in GitHub Desktop.
Save bitmvr/b83d524c1bffd10ff2830a9336fe749a to your computer and use it in GitHub Desktop.
Irvington Halloween Counter
#!/usr/bin/env node
const puppeteer = require('puppeteer');
const submissions = {
one: "https://www.facebook.com/irvhalloween/photos/pcb.10157648652552160/10157648601497160/?type=3&theater",
two: "https://www.facebook.com/irvhalloween/photos/pcb.10157648652552160/10157648601502160/?type=3&theater",
mark : "https://www.facebook.com/irvhalloween/photos/a.451834352159/10157648601317160/?type=3&theater",
four: "https://www.facebook.com/irvhalloween/photos/pcb.10157648652552160/10157648602242160/?type=3&theater",
five: "https://www.facebook.com/irvhalloween/photos/pcb.10157648652552160/10157648602677160/?type=3&theater",
six: "https://www.facebook.com/irvhalloween/photos/pcb.10157648652552160/10157648602437160/?type=3&theater",
seven: "https://www.facebook.com/irvhalloween/photos/pcb.10157648652552160/10157648604097160/?type=3&theater",
eight: "https://www.facebook.com/irvhalloween/photos/pcb.10157648652552160/10157648604302160/?type=3&theater",
nine: "https://www.facebook.com/irvhalloween/photos/pcb.10157648652552160/10157648604132160/?type=3&theater",
ten: "https://www.facebook.com/irvhalloween/photos/pcb.10157648652552160/10157648604427160/?type=3&theater",
eleven: "https://www.facebook.com/irvhalloween/photos/pcb.10157648652552160/10157648604447160/?type=3&theater",
twelve: "https://www.facebook.com/irvhalloween/photos/pcb.10157648652552160/10157648604542160/?type=3&theater",
thirteen: "https://www.facebook.com/irvhalloween/photos/pcb.10157648652552160/10157648604577160/?type=3&theater",
fourteen: "https://www.facebook.com/irvhalloween/photos/pcb.10157648652552160/10157648604622160/?type=3&theater",
fifteen: "https://www.facebook.com/irvhalloween/photos/pcb.10157648652552160/10157648604802160/?type=3&theater",
sixteen: "https://www.facebook.com/irvhalloween/photos/pcb.10157648652552160/10157648604912160/?type=3&theater",
seventeen: "https://www.facebook.com/irvhalloween/photos/pcb.10157648652552160/10157648604932160/?type=3&theater"
};
(async () => {
// const browser = await puppeteer.launch({headless: false});
const browser = await puppeteer.launch();
const page = await browser.newPage();
const keys = Object.entries(submissions)
for ( const [submission, url] of keys) {
await page.goto(url);
let voteCount = await page.$eval('[data-testid="UFI2ReactionsCount/sentenceWithSocialContext"]', e => e.innerText);
console.log(`${submission},${url},${voteCount}`);
}
await browser.close();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment