如何获得最喜欢和最喜欢的Page Photo评论? [英] How to get Page Photo with the most likes & comments?

查看:75
本文介绍了如何获得最喜欢和最喜欢的Page Photo评论?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Facebook PHP SDK来尝试获得页面喜欢最多的照片,以便能够用作英雄照片".逻辑是最喜欢的照片是&评论是最有趣的.

I'm using the Facebook PHP SDK to try and get the photo with the most number of likes for a Page, to be able to use as a "hero photo". The logic being that the photo with the most likes & comments is the most interesting to look at.

但是,我能想到的唯一方法是缓慢而繁琐.

However, the only method I can think of is slow and cumbersome.

有没有比以下方法更好的方法?

Is there a better method than using the below?

1. Query the Graph API for the albums belonging to a Page
2. Query the Graph API for Photos in each Album
3. Add the likes & comments for each photo
4. Re-order the list of photos and return the best few

您可以看到,相对较低的回报而言,这是很多工作,但我想不出一种更好的方法来返回给定Page的最受欢迎照片.

As you can see it's a lot of work for a relatively low payoff, but I can't think of a better way to return the most popular photo of a given Page.

有什么建议吗?

推荐答案

似乎这是检索此信息的唯一方法. 我建议将这一系列查询放在定期运行的cron作业中,并更新包含结果的静态文件.然后,您可以仅获取该文件,而不必为每个用户运行查询.如果每个用户都执行这批查询,则您的应用程序将非常慢或加载时间长...

It seems this is the only way to retrieve this information. I would recommend placing this series of queries in a cron job that runs periodically and updates a static file containing the results. Then you can just source that file and not have to run the queries for each user. If each user were to execute this batch of queries your application would be extremely slow or have a large load time...

这篇关于如何获得最喜欢和最喜欢的Page Photo评论?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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