Skip to content

Instantly share code, notes, and snippets.

@joshm21
Last active June 27, 2020 17:06
Show Gist options
  • Save joshm21/cfd7cb3a29a4be27311db48b7d739549 to your computer and use it in GitHub Desktop.
Save joshm21/cfd7cb3a29a4be27311db48b7d739549 to your computer and use it in GitHub Desktop.
Parse profile link, birthday month, and birthday day from Facebook birthdays page. Make sure you scroll to bottom first!
function parse() {
let people = document.querySelectorAll("._43q7");
for (let i = 0; i < people.length; i++) {
const profile = people[i].childNodes[0].href
const tooltip = people[i].childNodes[0].getAttribute("data-tooltip-content");
const monthRegex = new RegExp("\\((\\d{1,2})/\\d{1,2}\\)$", "g");
const dayRegex = new RegExp("\\(\\d{1,2}/(\\d{1,2})\\)$", "g");
const monthMatch = monthRegex.exec(tooltip);
const dayMatch = dayRegex.exec(tooltip);
const month = monthMatch == null ? null : monthMatch[1];
const day = dayMatch == null ? null : dayMatch[1];
console.log(`${profile},${month},${day}`);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment