Last active
June 27, 2020 17:06
-
-
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!
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
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