开发者

A way to bypass the per-ip limit retrieving profile picture?

My app download all the user's friends pictures.

All the requests are of this kind:

https://graph.facebook.com/<friend id>/p开发者_开发技巧icture?type=small

But, after a certain limit is reached, instead of the picture I get:

{"error""message":"(#4) Application request limit reached","type":"OAuthException"}}

Actually, the only way I found to prevent this is to change the server ip (manually). There isn't a better way?


For the record:

The limit is related to the Graph Api only, and the graph.facebook.com/<user>/picture url is a graph api call that returns a redirect.

So, to avoid the daily limit, simply fetch all the images url from FQL, like:

SELECT uid, pic_small, pic_big, pic, pic_square FROM user WHERE uid = me() or IN (SELECT uid2 FROM friend WHERE uid1=me())

now these are the direct urls to the images, for eg:

http://profile.ak.fbcdn.net/hprofile-ak-snc4/275716_1546085527_622218197_q.jpg

so don't store them since they continuously change.


If it's needed for an online app better way not to download those images, but use an online version, there is couple of reasons for doing so:

  • Users change pictures (some frequently), do you need an updated version?
  • Facebook's servers probably faster than yours and friends pictures probably cached within browser of your user.

Update: Since limit you reach is Graph API call limit, not the image retrieval, another solution that comes to my head just now is using friends connection of user in Graph API and specifying picture in fields argument, eq: https://graph.facebook.com/me/friends?fields=picture, this will return direct URL-s for friends pictures so you can do only one call to get all needed info to download the images for every user...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜