开发者

Facebook: common URL format for accessing objects and their comments from a browser

开发者 https://www.devze.com 2023-02-15 04:49 出处:网络
I am trying to figure out whether there is a common format for Facebook URLs that can be used to navigate via a browser to different Facebook object types (e.g. status, video, album, photo, etc) and t

I am trying to figure out whether there is a common format for Facebook URLs that can be used to navigate via a browser to different Facebook object types (e.g. status, video, album, photo, etc) and their comments. I need this for the Facebook application I am developing.

For example, a status object and its comments can be reached via a URL of the form:

http://www.facebook.com/facebookAccountID/posts/facebookStatusID.

For videos: http://www.facebook.com/video/video.php?v=facebookVidoeID

For albums: htp://www.facebook.com/album.php?id=facebookAccountID&开发者_如何学JAVAamp;aid=albumID

For photos: htp://www.facebook.com/photo.php?fbid=facebookPhotoID

Is there a common URL format for accessing any object (regardless of its type) and its comments, rather than the inconsistent forms above?


The json objects returned by the graph api all have a link property which you can use to direct people to view the object on facebook and post/read comments/likes and view the content.


This is eleven years late, but you can construct a functional url knowing only the postID (from the API) by prefacing it with facebook.com/, so that the final url is in this form:

facebook.com/postID

You can also construct it if you have the handle or brandID and the status ID. In the postID, the numbers to the left of the underscore are the brandID, and the numbers to the right are the status ID. Not 100% sure what they call it, and you can't get it out of the API anymore, and it's been deprecated, so you can't call the api with it even if you do have it. But you can still construct the url if you have that instead of the full postID, or you can extract it from the postID if you need to get the url in one of the following formats.

facebook.com/brandID/posts/statusID facebook.com/handle/posts/statusID

Other than that, you just have to fetch the permalink_url from the api, but I prefer to construct the URLs dynamically so that they are all in a standard format, and so that it is easy to relate a link to a postID.

As of a few weeks ago, the user facing URLs in the browser no longer use this format, but the constructed url will still work.

0

精彩评论

暂无评论...
验证码 换一张
取 消