Created
July 26, 2019 04:48
-
-
Save adrienjoly/64a2729454181fabce01b441cf349d14 to your computer and use it in GitHub Desktop.
A script to paste into the js console of a Facebook note (i.e. blog post) in order to extract its meta-data
This file contains 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
// copy and paste that script in the js console, from a facebook "note" url | |
permalink = $$('.mts a')[0]; | |
[_, monthName, day, year] = new Date(permalink.innerText.split(' at ')[0]).toString().split(' '); | |
monthNum = { | |
Jan: 0, | |
Feb: 1, | |
Mar: 2, | |
Apr: 3, | |
May: 4, | |
Jun: 5, | |
Jul: 6, | |
Aug: 7, | |
Sep: 8, | |
Oct: 9, | |
Nov: 10, | |
Dec: 11, | |
}[monthName.substr(0, 3)]; | |
` | |
- date: "${year}-${monthNum}-${day}" | |
title: "${$$('h2')[0].innerText}" | |
url: "${permalink.href}" | |
source: "facebook.com" | |
` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment