Best way to get common “likes” from public info page out of your friends list

和自甴很熟 提交于 2019-12-24 05:39:13

问题


I'm trying to get a list of common likes (public) between a user and his friends. I thought this FQL query would work but I'm getting an unknown user error:

--get page_id that you have and any of your friends have

https://api.facebook.com/method/fql.query?query=
select uid, page_id from page_fan where uid in (SELECT uid2 FROM friend WHERE uid1 = me()) and page_id in (select page_id from page_fan where uid= me())
&access_token=ABC

I'm getting this error:

<error_response><error_code>1</error_code><error_msg>An unknown error occurred</error_msg></error_response>

Any suggestions?


回答1:


It seems that the result set is way to big for the API to handle. Your best bet is to try to limit the result set by either query a set of friends against the user's like or query one, two ...etc pages at a time (if that also didn't work try to LIMIT your friends to say 100 to make sure you are actually getting something). Example of a query:

select uid, page_id 
from page_fan 
where uid in (
    SELECT uid2 
    FROM friend 
    WHERE uid1 = me()
) and page_id in (
    select page_id 
    from page_fan 
    where uid= me() 
    LIMIT 1
)

Obviously there is no offset in FQL. So first, you need to retrieve the user's likes and then query against them. You can always use the batch api to make multiple calls in a single batch call.




回答2:


SELECT page_id from page_fan WHERE uid = me() and page_id IN ( SELECT page_id from page_fan WHERE uid = give one hid here )



来源:https://stackoverflow.com/questions/8215177/best-way-to-get-common-likes-from-public-info-page-out-of-your-friends-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!