如何获取由群组管理员以外的人上传的 Facebook 群组照片? (通过 JavaScript)

发布于 2024-12-13 12:10:02 字数 745 浏览 1 评论 0原文

我正在为一个反映 Facebook 群组的群组建立一个网站,我想从 Facebook 中提取该群组的所有照片并将其显示在我的网站上。但这些照片可能是由完全陌生的人上传的:所以基本上,一个随机的人拍摄该团体的照片并将其上传到 Facebook,我们希望该照片在我们的网站上可见。

我可以想到三种方法来执行此操作:

  1. 将照片标记为组并查找标记为组的所有照片

    您似乎无法通过 Graph API 访问标记为特定组的照片(请证明我错了)。我可以在 FQL 中执行此操作:SELECT images FROM photo WHERE pid in (SELECT pid FROM photo_tag WHERE subject=GROUP_ID),但据我所知,这需要网站访问者登录 Facebook 才能创建FB 会话,这不好。

  2. 在我们的 FB 页面上“分享”照片,并以某种方式找到我们在我们的页面上分享的所有照片

    我似乎想不出一种方法来将共享对象的搜索限制为照片,但我愿意接受建议。

  3. 自行重新上传照片到群组控制相册

    嗯。前两个选项不涉及在 facebook 上创建任何新对象,并且是首选,但我很难做到其中任何一个,这让我不得不从 facebook 下载照片并在我们的应用程序中重新上传它们。自己的相册,我知道怎么展示。

请告诉我有比#3更好的方法吗?

I'm building a website for a group that mirrors a facebook group, and I'd like to pull any photos of the group from facebook and display them on my site. BUT the photos might be uploaded by perfect strangers: so basically, a random person takes a picture of the group and uploads it to facebook, and we want that photo to be visible on our website.

I could think of three ways to do this:

  1. tag the photo as the group and find all photos tagged as the group

    It seems you can't get Graph API access to photos tagged as a particular group (please prove me wrong). I can do this in FQL: SELECT images FROM photo WHERE pid in (SELECT pid FROM photo_tag WHERE subject=GROUP_ID), but from what I can tell, this requires the website visitor to log into facebook to create a FB session, which is no good.

  2. 'share' the photo on our FB Page and somehow find all photos we've shared on our page

    I can't seem to think of a way to restrict a search of shared objects to photos, but I'm open to suggestions.

  3. re-upload the photo ourselves into a group-controlled photo album

    meh. The first two options don't involve creating any new objects on facebook, and would be preferred, but I'm having a hard time doing either of them, which leaves me with downloading the photos from facebook and uploading them all over again in our own photo album, which I know how to show.

Please tell me there's a better way to do it than #3?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

黯然#的苍凉 2024-12-20 12:10:02

我编写了一个 PHP 小应用程序,它将我的 Facebook 新闻提要 (/me/home) 转换为 RSS,并可以通过 Google Reader 进行订阅。虽然我的项目与发布无关,但我认为您需要一些与我在那里使用的offline_access类似的技术。

所以,首先,你需要一个虚拟的 Facebook 用户帐户,该帐户有权在群组中读取和发布(因为这是一个公共群组,所以可以避免一些麻烦)

使用“offline_access”和其他方式获取该用户的 access_token发布所需的范围,例如此处的直接 url 示例 http://developers.facebook.com/docs/reference/dialogs/oauth/

然后...将访问令牌硬编码到 PHP 脚本中

$access_token = the access token from oauth;
$facebook->setAccessToken($access_token);

因此,该脚本将充当该用户。浏览镜像网站的任何人甚至不需要 Facebook 帐户。

解决了认证问题之后,剩下的就是简单的查询、上传、发布的编码了。希望这会有所帮助

I've wrote a little PHP app which turned my Facebook news feed (/me/home) into RSS, and make it possible to subscribe by Google Reader. Although my project has nothing to do with publishing, I think you'll need some similar technique with the offline_access I've used there.

So, first of all, you'll need dummy Facebook user account which have the permission to read and publish in the group (since that's a public group so save you from some trouble)

Get the access_token of this user with "offline_access" and other scopes required for publishing like direct url example here http://developers.facebook.com/docs/reference/dialogs/oauth/

Then... hard code the access token into the PHP script

$access_token = the access token from oauth;
$facebook->setAccessToken($access_token);

Therefor, this script would act as that user. Anyone browsing the mirrored website doesn't even need a Facebook account.

After solving the authentication issue, the rest just simple coding for querying, uploading, publishing. Hope this would help

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文