Skip to content

Instantly share code, notes, and snippets.

@t-wy
Created November 28, 2022 12:22
Show Gist options
  • Select an option

  • Save t-wy/66faed8679d127793891ecb775efdaa9 to your computer and use it in GitHub Desktop.

Select an option

Save t-wy/66faed8679d127793891ecb775efdaa9 to your computer and use it in GitHub Desktop.
Get Facebook canonical Post ID (share URL) without pfbid parameter
javascript: fbid = /share_fbid":"(\d+)"/g.exec([...document.getElementsByTagName("script")].filter(x => x.innerHTML.includes("share_fbid"))[0].innerHTML)[1]; alert(location.href.split("/").slice(0, -1).join("/") + "/" + fbid);
// can be used in console / bookmark / address bar (remember to add back javascript if the browser strips it automatically)
@JZersche
Copy link

JZersche commented Dec 8, 2025

due to some Facebook updates, this only works if you're not logged in, otherwise it still works but returns some wrong information related too the profileAnchor selecting the wrong profile, and displaying the wrong name. But it still returns the correct post id, and works fine if you're not logged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment