使用 Facebook API 获取页面的所有照片 [英] Get all photos of a page using Facebook API

查看:50
本文介绍了使用 Facebook API 获取页面的所有照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Facebook API 的新手,但我必须从 Facebook 页面获取所有照片.我设法获得了一个图形 api 查询,该查询返回页面上仅第一个创建的相册的所有图片,该页面是个人资料图片相册.例如:

I am new to Facebook API but I have to get all photos from a Facebook page. I managed to get a graph api query that returns all pictures of only the first ever created album on the page which is the profile picture album. For example:

https://graph.facebook.com/227843870675663/photos

但我需要对页面中的所有其他现有专辑执行相同的操作.任何指针都非常感谢.

But I need to do the same for all other existing albums in the page. Any pointers are really appreciated.

推荐答案

试试这个,让我知道你的效果如何,我已经成功拉取了所有照片.

try this and let me know how it goes for you, I've successfully pulled all photos.

  1. 确保您是 Facebook 主页的管理员.

  1. Ensure that you are an Admin of the Facebook Page.

转到:http://developers.facebook.com/tools/explorer

在 API Navigator 中,您可以看到 "/me" 会调出您的基本信息.

In the API Navigator, you can see "/me" will bring up the basic information of yourself.

尝试输入 "/me/accounts" 看看是否可以看到任何内容.它应该给你一个错误.

Try typing in "/me/accounts" to see if you can see anything. It should give you an error.

点击获取访问令牌"

会弹出一个窗口.导航到扩展权限"

a window will pop-up. Navigate to "Extended Permissions"

选择manage_pages"

点击获取访问令牌"

现在再次尝试"/me/accounts".您应该会在查看窗口中看到一个页面列表.

Now try "/me/accounts" again. You should see a list of Pages inside the viewing window.

选择您想要的主页,然后点击id"字段

Select the Page you want, and click on the "id" field

接下来,在左侧窗口中,您可以看到 节点:" 和一个 + 符号.单击 + 号以查看您有哪些选项.

Next, on the left window, you can see "Node: " and a + sign. Click on the + sign to see what are the options you have.

点击 + 号并向下滚动到连接"并选择相册"

Click on the + sign and scroll down to "connections" and select "Albums"

子级,选择照片"

照片"子级,选择来源"

现在点击右侧的提交".您将看到一个 JSON 返回,其中包含您选择的 Facebook 主页中所有照片的网址.

Now click "Submit" on the right hand side. You will see a JSON returned with the url of all the photos in your selected Facebook Page.

复制网址 - https://graph.facebook.com/?fields=albums.fields(photos.fields(source)) 并将其插入浏览器.您应该会在 Facebook 的 CDN 上看到所有照片的 JSON 及其对应的 URL.

Copy the URL - https://graph.facebook.com/?fields=albums.fields(photos.fields(source)) and plug it into your browser. You should see a JSON of all your photos, and its corresponding url on Facebook's CDN.

这篇关于使用 Facebook API 获取页面的所有照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆