2011-02-07 165 views

回答

4

使用社交图谱,您可以执行此操作,前提是该脚本具有您的Facebook页面应用程序ID的访问令牌,或者您的照片权限设置为完全公开。

使用社交图谱,您基本上可以通过类似Web服务的REST访问照片。该Web服务调用将返回dataExample的JSON对象:

https://graph.facebook.com/cocacola/albums 

(相册为可口可乐的粉丝专页)

因此,第一步将检索使用类似上面的一个URL的相册。 遍历相册并获取所需专辑的对象ID。

{ 
     "id": "455377148305", 
     "from": { 
      "name": "Coca-Cola", 
      "category": "Company", 
      "id": "40796308305" 
     }, 
     "name": "Coca-Cola Fanmeile FIFA WM 2010", 
     "link": "http://www.facebook.com/album.php?aid=249745&id=40796308305", 
     "count": 20, 
     "type": "normal", 
     "created_time": "2010-10-22T15:53:36+0000", 
     "updated_time": "2010-10-22T15:55:23+0000", 
     "comments": {} 
}, 

只要将对象ID设置为图形URL的第一个参数,就可以访问它。例如:

https://graph.facebook.com/40796308305 

从那里,你应该能够抓住实际的URL的图像(根据权限设置)

{ 
    "id": "40796308305", 
    "name": "Coca-Cola", 
    "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs236.ash2/50516_40796308305_7651_s.jpg", 
    "link": "http://www.facebook.com/coca-cola", 
    "category": "Company", 
    "website": "http://www.coca-cola.com", 
    "username": "coca-cola", 
    "products": "Coca-Cola is the most popular and biggest-selling soft drink in history, as well as the best-known product in the world.\n\nCreated in Atlanta, Georgia, by Dr. John S. Pemberton, Coca-Cola was first offered as a fountain beverage by mixing Coca-Cola syrup with carbonated water. Coca-Cola was introduced in 1886, patented in 1887, registered as a trademark in 1893 and by 1895 it was being sold in every state and territory in the United States. In 1899, The Coca-Cola Company began franchised bottling operations in the United States.\n\nCoca-Cola might owe its origins to the United States, but its popularity has made it truly universal. Today, you can find Coca-Cola in virtually every part of the world.", 
    "likes": 22264613 
} 
+0

这是辉煌的,有没有办法我们的游客可以在评论照片,然后评论将显示在Facebook上呢? – steven 2011-02-09 21:38:33