您可以使用 Facebook API 进行基于用户的搜索吗? [英] Can you make a user-based search with Facebook API?

查看:36
本文介绍了您可以使用 Facebook API 进行基于用户的搜索吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Facebook 顶部的搜索框中输入内容时.

On Facebook when you write something in the search box in the top.

喜欢埃里克"

首先你会得到你的朋友 Eric 的结果,然后你会得到一些你可能认识的人,其中有 X 个共同的朋友,以及附近你可能认识的一些随机人.

You first get the results with your friends named Eric and further down you get people you might know with X mutual friends and some random people in the vicinity you might know.

是否可以使用 Facebook API 进行类似的搜索?

Is it possible to make a similar search with the Facebook API?

我试过了:

https://graph.facebook.com/search?q=eric&type=user&fields=id,name&access_token= (my token)

我想如果我添加了我的 access_token,我会在 Facebook 上进行类似的搜索.但我只是从世界各地随机得到一些 Eric.

And thought if I added my access_token I would get a search like the one on Facebook. But I just get some random Eric's from all over the world.

我正在编写一个简单的网络应用程序,让这个搜索工作会很棒!谢谢!

I'm writing a simple web application and getting this search to work would be great! Thanks!

推荐答案

这在一定程度上是可能的,但在进一步研究之前确保这不是您应用的主要服务,否则您将面临违反 Facebook 复制核心功能政策的风险.

It's possible to an extent but before looking further ensure this isn't the main service of your app otherwise you run the risk of violating Facebook policy on replicating core functionality.

您需要查看用户 FQL 表好友表

按如下方式执行 FQL 调用:

Do an FQL call as follow:

SELECT name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me())

然后保存来自该调用的 JSON 响应并使用预输入算法/插件.

Then save the JSON response from that call and use a typeahead algorithm / plugin.

这篇关于您可以使用 Facebook API 进行基于用户的搜索吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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