Facebook图形API调用外部URL无法使用Youtube Urls

时间:2016-01-18 09:23:31

标签: facebook api facebook-graph-api

我试图使用例如此视频网址

来获取youtube网址的详细信息
  

/v2.5/?id = https://www.youtube.com/watch?v=AU_a76wE8fg

但无论我使用哪种视频网址,都会返回此模板结果 -

 {
 "og_object": {
    "id": "10150122667264389",
    "description": "Judas Priest's official music video for 'Turbo Lover'. Click to listen to Judas Priest on Spotify: http://smarturl.it/JudasPriestSpotify?IQid=JudasPTL As fea...",
    "title": "Judas Priest - Turbo Lover",
    "type": "video.other",
    "updated_time": "2016-01-17T18:59:08+0000",
    "url": "https://www.youtube.com/watch?v=JhY9GOhFwN4"
  },
  "share": {
    "comment_count": 28,
    "share_count": 40022
  },
  "id": "https://www.youtube.com/watch?v"
}

出了什么问题。来自youtube的外部网址的facebook API是否已损坏?因为它与其他网站网址一起正常工作。

1 个答案:

答案 0 :(得分:1)

您需要对网址进行UrlEncode,因为它包含=。这是可见的,因为结果仅包含"id": "https://www.youtube.com/watch?v"而不包含"id": "https://www.youtube.com/watch?v=AU_a76wE8fg"

所以/v2.5/?id=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DAU_a76wE8fg应该诀窍。