Getting more than 25 photos from the Facebook Grap

2020-03-03 07:54发布

I'm trying to retrieve all the photos a user is tagged in using the Graph API but I can only get the latest 25.

Is it possible to get more, and if so, how?

3条回答
对你真心纯属浪费
2楼-- · 2020-03-03 08:15

Have you tried adding a limit and offset parameters? Quoting the documentation:

Paging

When querying connections, there are several useful parameters that enable you to filter and page through connection data:

查看更多
\"骚年 ilove
3楼-- · 2020-03-03 08:17

Currently there is 100 items limitation per query both on photos and likes: However, 100 pics query takes so much time to run for me.

The following API call:

https://graph.facebook.com/me/photos?limit=500

gives only 100 results with paging link.

Run in FQL explorer (If you have more than 100 pic on your account): https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Fphotos%3Flimit%3D500

查看更多
够拽才男人
4楼-- · 2020-03-03 08:21

Setting limit=0 may not always work in the case that a user has a huge number of tagged photos. Also note that the tagged photos graph API can return a large number of embedded comments as well, so especially if you are developing a mobile app, it can take a long time to return all the photo data. Finally I find that sometimes Facebook will limit the number of entries it can return in times of high load.

So... perhaps the best way is to use the "paging" "next" url that appears at the end of the returned photo data. This gives you the next graphAPI call that you can then use to get the next x photos. It does this by using and pre-populating the limit and until parameters and incorporating them within the graph api call. Very handy.

查看更多
登录 后发表回答