gpt4 book ai didi

Facebook 公开相册

转载 作者:行者123 更新时间:2023-11-30 05:26:12 26 4
gpt4 key购买 nike

我正在尝试在桌面上使用 C# 开发一个应用程序,其中一个用户通过电子邮件或姓名搜索一个人。然后它将列出用户以及用户的信息和公开的相册或图片。然后该程序的用户将查看照片,如果可以找到合适的搜索人将添加 friend 。

我的问题是我无法列出和显示公开相册。我尝试使用 FQL 和图形 API,但都返回了空数据。我为此编写的代码:

ArrayList  pictureLink;
public void userPhotos(string userID)
{
var fb2 = new FacebookClient(_accessToken);

//result1 and result2 aren't using in code only for looking for with breakpoint
dynamic result1 = fb2.Get("fql", new { q = "SELECT aid,cover_pid FROM album WHERE owner=" + kisiID });
dynamic result2 = fb2.Get("fql", new { q = "SELECT pid,aid FROM photo WHERE owner=" + kisiID });

ArrayList imageSize; //for gettig highest pixell of picture
pictureLink = new ArrayList();
var fb = new FacebookClient(_accessToken);

//dynamic albums = fb.Get("me/albums"); // THİS code is rigth runnig
dynamic albums = fb.Get(userID + "/albums");

foreach (dynamic albumInfo in albums.data)
{
//Get the Pictures inside the album this gives JASON objects list that has photo attributes
// described here http://developers.facebook.com/docs/reference/api/photo/
dynamic albumsPhotos = fb.Get(albumInfo.id + "/photos");
foreach (dynamic rs in albumsPhotos.data)
{
imageSize= new ArrayList();
foreach (dynamic rsa in rs.images)
{
imageSize.Add(rsa.height);
}
int highestImage = Convert.ToInt32(imageSize[0]);
foreach (dynamic rsa in rs.images)
{
if (rsa.height == highestImage )
{
string link= rsa.source;
pictureLink.Add(link);
}
}
}
}
}

最佳答案

To read an Album you need:

  • Any valid access token if it is public and belongs to a Page
  • The user_photos permission if it belongs to a User
  • The friend_photos permission if it belongs to a User's friend

来源:https://developers.facebook.com/docs/reference/api/album/

您需要的是以下语句,它在列表中。

  • Any valid access token if it is public and belongs to a User

这意味着 API 根本不允许您访问公共(public)相册。 events也是一样.

关于 Facebook 公开相册,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13567253/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com