1

我正在使用 C# Facebook SDK 向 Facebook 查询 /home 提要,并且提要包含照片。提要中的“图片”链接是低分辨率的,所以我必须从提要中查找照片的“object_id”才能获得高分辨率版本。

这就是我想要完成的

  1. 获取 /home 饲料
  2. 从 /home 响应中的所有“object_id”中,获取“object_id”

        Common._fb.BatchTaskAsync(new[]{
            new FacebookBatchParameter(HttpMethod.Get, "/me", new Dictionary<string, object> { { "limit", 25 }, {"access_token", Common._fb.AccessToken} }),
            new FacebookBatchParameter("/me/home", new { limit = 25 }) { Data = new { name = "home-feed", omit_response_on_success = false } },
            new FacebookBatchParameter(HttpMethod.Get, "/{result=home-feed:$.data.*.object_id}", new { limit = 25 }),                
            new FacebookBatchParameter("/me/error")});
    

我遇到的问题是 object_id 调用失败,但出现以下异常:

{"error":{"message":"(#803) Some of the aliases you requested do not exist: 432468803491390,10151350857109036,388654974561669,197117360426100,443878372332478,445366662199631,457265447662406,475836539118390,474145425981640,363838440380681","type": "OAuthException","code":803}} 对象 {Facebook.JsonObject}

这是第一次调用的数据的样子:

"type": "photo", "status_type": "shared_story", "object_id": "379861798777414", 

在graph API中,object_id可以这样直接查询:/379861798777414

id": 
"379861798777414", 
  "from": 
{
    "category": 
"Automobiles and parts", 
    "name": 
"Legendary Speed Inc.", 
"id": 
"142234555873474"
  }, 
  "name": 
"FOR SALE:\nClick the link for Price and Info\nhttp://www.legendaryfind.com/cars/pin/38000/", 
  "picture": 
"https://photos-b.xx.fbcdn.net/hphotos-ash4/603137_379861798777414_485849814_s.jpg", 
  "source": 
"https://sphotos-b.xx.fbcdn.net/hphotos-ash4/603137_379861798777414_485849814_n.jpg", 
  "height": 
265, 
  "width": 
400, 
  "images": 
[ 
{
 "height": 1356, 
 "width": 2048, 
"source": "https://sphotos-b.xx.fbcdn.net/hphotos-ash4/s2048x2048/603137_379861798777414_485849814_n.jpg"
} 

我不知道为什么,但我无法像这样从批处理参数中调用 object_id。有点卡在这里。

4

1 回答 1

0

在发现 FQL 之后,图调用已成为过去。FQL 的新代码在执行此操作时更快、更高效:

stream = "SELECT post_id, actor_id, created_time, message, attachment FROM stream WHERE filter_key IN ( SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed')", //WHERE source_id = me()
users = "SELECT uid, name from user WHERE uid IN (SELECT actor_id FROM #stream)",
photos = "SELECT images, caption, like_info FROM photo WHERE pid IN (SELECT attachment.fb_object_id FROM #stream)"
于 2013-01-17T19:44:21.130 回答