Facebook posts URL's sometimes show up in a weird format. Is there any way to convert this to post id?
Asked Answered
C

2

5

Usually you'd have 3 formats a post URL will be:

  1. https://www.facebook.com/XXXXX/posts/YYYYY
  2. https://www.facebook.com/XXXXX/photos/a.AAAAA/YYYYY
  3. https://www.facebook.com/permalink.php?story_fbid=YYYYY&id=XXXXX

where XXXXX - page id, and YYYYY - post id (both are a string of digits), but sometimes, very rarely, you get a link which is of the 1st type, but instead of having the post id be a string of digits at the YYYYY spot, it is a string of symbols that seem to always start with "pfbid".

https://www.facebook.com/XXXXX/posts/pfbid02yEJj6dTFRtQ644Gq8qwaXt85pSi8Qvih3M6NBnbMqbJc1NM9QcdjWPpokoggDhNGl

Sometimes you can just click on the date of the post and get a regular link, but sometimes you can't get a link that isn't of this type. Is there any way to convert the string at the end to a post id or is there any other way to get a different Facebook post URL, that would be of type 1, 2 or 3?

Cordi answered 5/7, 2022 at 7:47 Comment(3)
Assuming the URL you got, "works" - what do you need another format for?Thickening
To use the post id in a facebook business api program i'm working on to automate ad creation. I can get the post id's from the first 3 types of links no problem, but I have no idea how to convert this URL to a post id. And yes, the URL takes me to the post I need.Cordi
@CBroe privacy (which doesn't exist anymore, I know)Primipara
M
5

It's possible to retrieve post from graph api by calling endpoint /XXXXX_pfbidYYYYYY

It returns response with numeric id

Mobley answered 12/7, 2022 at 9:18 Comment(1)
I get (#12) singular statuses API is deprecated for versions v2.4 and higherFino
E
1

As of now in August 2023 it's still possible to obtain and use the old format URL. Here's a quick hack that doesn't require any API calls and can be done via simple copy and paste:

https://news.ycombinator.com/item?id=32118095

(I know link-only answers are discouraged, but I don't want to take any credit for someone else's post, so I won't copy it here.)

The whole thread is a discussion on why this move by Facebook is not a good thing.

Elihu answered 14/8, 2023 at 9:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.