Facebook图表API和FQL像照片上的计数都不正确? [英] Facebook Graph API and FQL like count on photo's both incorrect?

查看:148
本文介绍了Facebook图表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图表API和FQL像照片上的计数都不正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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