Facebook:用于从浏览器访问对象及其评论的通用 URL 格式
我试图弄清楚 Facebook URL 是否有一种通用格式,可用于通过浏览器导航到不同的 Facebook 对象类型(例如状态、视频、相册、照片等)及其评论。我正在开发的 Facebook 应用程序需要这个。
例如,可以通过以下形式的 URL 访问状态对象及其注释:
http://www.facebook.com/facebookAccountID/posts/facebookStatusID。
对于视频:http://www.facebook.com /video/video.php?v=facebookVidoeID
对于相册:htp://www.facebook.com/album.php?id=facebookAccountID&aid=albumID
对于照片:htp://www.facebook.com/photo.php?fbid=facebookPhotoID
是否有一个通用的 URL 格式来访问任何对象(无论其类型)及其评论,而不是上面的表格不一致?
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&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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
图形 api 返回的 json 对象都有一个 link 属性,您可以使用该属性引导人们在 Facebook 上查看该对象并发布/阅读评论/点赞并查看内容。
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.
这已经晚了 11 年,但是您可以通过在 facebook.com/ 前面构建一个仅知道 postID(来自 API)的功能 url,以便最终的 url 采用以下形式:
facebook.com/postID
您还可以构建如果您有句柄或品牌 ID 和状态 ID,则可以使用它。在postID中,下划线左边的数字是brandID,右边的数字是状态ID。不能 100% 确定他们如何称呼它,并且您无法再从 API 中获取它,并且它已被弃用,因此即使您确实拥有它,也无法使用它调用 api。但是,如果您有 url 而不是完整的 postID,您仍然可以构造 url,或者如果您需要获取以下格式之一的 url,则可以从 postID 中提取它。
facebook.com/brandID/posts/statusID
facebook.com/handle/posts/statusID
除此之外,您只需从 api 获取 permalink_url,但我更喜欢动态构造 URL,以便它们都是标准格式,这样就很容易关联指向 postID 的链接。
截至几周前,用户在浏览器中面对的 URL 不再使用此格式,但构造的 url 仍然有效。
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.