搜索朋友的共享YouTube链接

问题描述:

我试图获取由朋友分享的所有YouTube视频的列表。搜索朋友的共享YouTube链接

直到现在,请求/me/home?q=youtube.com确实返回了所有youtube.com链接。 显然,API已更改,它现在似乎只返回邮件正文中包含“youtube.com”的链接。

有没有办法检索某个域的所有共享链接?

你必须知道的第一件事是如何得到你想要的过滤器键,

SELECT filter_key,name FROM stream_filter WHERE uid = me() 

您可以参考https://developers.facebook.com/docs/reference/fql/stream_filter进行更详细。输出

示例部分:

{ 
    "data": [ 
    { 
     "filter_key": "nf", 
     "name": "News Feed" 
    }, 
    { 
     "filter_key": "app_2309869772", 
     "name": "Links" 
    }, 

比方说,你得到的链接filter_key,然后打开https://www.facebook.com/home.php?filter=app_2309869772,首页只显示所有这些都是“链接”类型的职位。

这里有两种主要类型的视频分享从YouTube:

第一个的份额直接使用YouTube网站的分享按钮,你需要“NF”作为filter_key。然后您需要按照app_id进行过滤,这是''(您可以参考http://graph.facebook.com/87741124305)。您可以通过attribution ='Youtube'来过滤,如果您担心应用ID可能会改变未来。

第二个是用户复制youtube链接并粘贴到墙上。这种帖子可能会显示为'nf'类型。但是,看起来很可能youtube链接不会显示为'nf'类型。所以,你需要filter_key“app_2309869772”(链接)来获得这些帖子。当然,我们希望这仅仅是个YouTube视频的链接,所以我们有一个FQL内attachment.caption =“www.youtube.com”

因此,我们结合两个filter_key(新闻频道和链接)过滤器查询,例如:

SELECT action_links,actor_id,app_data,app_id,attachment,attribution,claim_count,comment_info,created_time,description,description_tags,expiration_timestamp,feed_targeting,filter_key,impressions,is_exportable,is_hidden,is_published,likes,message,message_tags,parent_post_id,permalink,place,post_id,privacy,scheduled_publish_time,share_count,source_id,subscribed,tagged_ids,target_id,targeting,timeline_visibility,type,updated_time,via_id,viewer_id,with_location,with_tags,xid FROM stream WHERE post_id IN (SELECT post_id FROM stream WHERE filter_key in(SELECT filter_key FROM stream_filter WHERE uid=me() AND name='Links') AND attachment.caption='www.youtube.com' AND created_time<=now() LIMIT 150) OR post_id IN(SELECT post_id FROM stream WHERE filter_key in(SELECT filter_key FROM stream_filter WHERE uid=me() AND name='News Feed') AND app_id='87741124305' AND created_time<=now() LIMIT 150) ORDER BY created_time DESC 

截图与https://developers.facebook.com/tools/explorer测试(您可以编辑根据您的需求的链接,你不打算把如果你不使用此信息action_links):

enter image description here

在这个例子中,我使用每页150项(我用很大的数字,因为这是YouTube视频工作岗位的实际总不是很多)。您可以尝试通过减少created_time来获得下一页,但是,这并不能保证每个页面至少有一个帖子。

报价后的链接(让你在结束访问令牌)将是:

https://graph.facebook.com/fql?format=json&q=SELECT+action_links%2Cactor_id%2Capp_data%2Capp_id%2Cattachment%2Cattribution%2Cclaim_count%2Ccomment_info%2Ccreated_time%2Cdescription%2Cdescription_tags%2Cexpiration_timestamp%2Cfeed_targeting%2Cfilter_key%2Cimpressions%2Cis_exportable%2Cis_hidden%2Cis_published%2Clikes%2Cmessage%2Cmessage_tags%2Cparent_post_id%2Cpermalink%2Cplace%2Cpost_id%2Cprivacy%2Cscheduled_publish_time%2Cshare_count%2Csource_id%2Csubscribed%2Ctagged_ids%2Ctarget_id%2Ctargeting%2Ctimeline_visibility%2Ctype%2Cupdated_time%2Cvia_id%2Cviewer_id%2Cwith_location%2Cwith_tags%2Cxid+FROM+stream+WHERE+post_id+IN+%28SELECT+post_id+FROM+stream+WHERE+filter_key+in%28SELECT+filter_key+FROM+stream_filter+WHERE+uid%3Dme%28%29+AND+name%3D%27Links%27%29+AND+attachment.caption%3D%27www.youtube.com%27+AND+created_time%3C%3Dnow%28%29+LIMIT+150%29+OR+post_id+IN%28SELECT+post_id+FROM+stream+WHERE+filter_key+in%28SELECT+filter_key+FROM+stream_filter+WHERE+uid%3Dme%28%29+AND+name%3D%27News+Feed%27%29+AND+app_id%3D%2787741124305%27+AND+created_time%3C%3Dnow%28%29+LIMIT+150%29+ORDER+BY+created_time+DESC&access_token=

干杯

+0

是不是'SELECT ... FROM流WHERE filter_key = '他人' AND attachment.caption ='www.youtube.com'ORDER BY created_time DESC LIMIT 1000'够了吗? – brillout 2013-08-01 12:44:00