Using the Facebook Graph API, you can take a look “behind the scenes” to retrieve the raw information of what is being displayed when you browse Facebook.
Requests under the URL http://graph.facebook.com/ return JSONified data about the requested object, which is identified by it’s ID.
Posts and Threads
Let’s look at threads (posts) and their IDs. There are a couple of ways the thread ID is stored in the thread URL, depending on where it is posted (page, group) and how you browse it (permalink or notification):
https://www.facebook.com/groups/[group id]/permalink/[thread id]/
Since the thread ID is numeric, a simple regex \d+ would be sufficient to retrieve it. However, group IDs may also be numeric, and names may contain digits.
After a bit of experimenting, the regex that I came up with to extract the thread ID from a Facebook URL, is
window.open("http://graph.facebook.com/" + (/[\/=](\d+)[&\/]?/.exec(window.location.toString().replace(/\/groups\/\d+\//),"")) + "/comments", "_blank")
and create a bookmark for it. Since this WordPress installation does not allow to include bookmarklet links, you need to
- Create a bookmark in your browser
- Give it a name, such as “View Comments in FB Graph”
- Set the URL or location to
- Click OK
But this does not give you the contents of the whole thread, just the comments.
To retrieve the whole post, we can use the Graph API Explorer.
The Graph API Explorer retrieves the details of a Facebook object, such as a post or thread, using the URL
So, as we know how to extract the thread ID from a FB URL, let’s create a bookmarklet with the URL
This opens the Graph Explorer with the desired ID. Click Submit to retrieve the data. Probably you need to click Get Access Token first.
Remove the Right Column
If you want to take screenshots of Facebook pages, you probably want to remove the right column before screenshotting, since it only expands the image, but does not include the content you want to save.
The top-most HTML container for right column content is called “rightCol” (yes, surprising).
To remove it from display, simply add this code to a bookmarklet:
Clean up the Likes Page
To get a screenshot of “selected” Likes on a Like Page, there is a way to delete the Likes we don’t like (haha).
Simply scroll down until the list of likes is complete, then run this bookmarklet:
Now clicking on a Like preview image will remove the entry from the list, allowing you to retain only the desired entries, ready to screenshot.