Facebook Graph API 和 FQL 之类的指望照片都不正确? [英] Facebook Graph API and FQL like count on photo's both incorrect?

查看:19
本文介绍了Facebook Graph API 和 FQL 之类的指望照片都不正确?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我为比赛制作了一个 Facebook 应用程序,它允许用户上传他们的照片.上传后,照片将发布到他们个人资料的专用相册中.一旦照片出现,用户应该尽可能多地收集喜欢.

I've made a facebook application for a contest, which allows users to upload their photo. Once uploaded, the photo gets posted to a dedicated album on their profile. Once the photo is there, the users should collect as many likes as possible.

目前我已尝试使用 Facebook Graph API 和 Facebook FQL 来检索喜欢的数量,但检索到的喜欢并不总是与用户个人资料上的喜欢相匹配.

Currently i have tried both the Facebook Graph API and Facebook FQL to retrieve the amount of likes, but the retrieved likes don't always match the likes on a users profile.

一些用户声称有超过 200 个赞,但 API 到目前为止最多只返回 101 个赞.

Some users claim to have more then 200 likes, yet the API only returned a maximum of 101 likes so far.


要求所有用户授予应用程序以下权限:

All users are requested to grant the application the following permissions:

user_hometown, publish_stream, read_stream, user_photos and offline_access


使用 Facebook PHP SDK 3.0.1 我尝试了这个 FQL 查询来收集照片的喜欢数量:

Using Facebook PHP SDK 3.0.1 I tried this FQL query to collect the amount of likes of a photo:

  # fql query
  $fql = "SELECT object_id FROM like WHERE object_id=" . $photo_id;

  # api request
  $request = array(
    'method' => 'fql.query', 'query' => $fql
  );

  # run batch request
  $likes = $this->facebook->api($request);

  # return like count
  return count($likes);


我还尝试了以下 Graph API 请求(也使用 Facebook PHP SDK 3.0.1)来收集照片的点赞量:

I also tried the following Graph API request (Also with Facebook PHP SDK 3.0.1) to collect the amount of likes of a photo:

$likes = $this->facebook->api($photo_id.'/likes');
return count($likes['data']);


奇怪的是,两者似乎都没有返回正确的结果.我可以理解 API 是否有点不准确,但根据 API,有些图片今天早上收到 100 个赞,几个小时后收到 0 个赞.

Strangely, neither seem to return correct results. I can understand if the API is slightly inaccurate, but according to the API some pictures recieved 100 likes this morning and then 0 likes a few hours later.

有人知道我可能做错了什么吗?照片及其相册需要公开吗?喜欢照片的人是否需要公开个人资料才能显示在 API 中?我需要申请额外的权限吗?

Does anyone have any ideas what i might be doing wrong? Do the photo's and their albums need to be public? Do the people who liked the photo need to have a public profile in order to show up in the API? Do i need to request additional permissions?

任何帮助或建议将不胜感激!

Any help or suggestions will be greatly appreciated!

推荐答案

刚刚在这里遇到了同样的问题.默认情况下,喜欢似乎按数百分页.使用LIMIT"查询选项覆盖此设置.

Just had the same problem here. The likes seems to be paginated by hundreds by default. Override this setting by using the "LIMIT" query option.

这篇关于Facebook Graph API 和 FQL 之类的指望照片都不正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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