使用 FQL 将新闻源过滤为特定类型

发布于 2024-12-05 09:04:57 字数 479 浏览 2 评论 0原文

我正在尝试提交对发送到用户新闻源的特定类型状态的查询,其中 type=video。我基本上想要为用户发布的所有视频,包括那些不是由 FB 托管的视频(否则我会提交视频查询)。如果我能让 FB 不返回除视频之外的任何内容,我会很高兴,但我当然没有看到解决方案。我没有看到返回的查询甚至有一个包含此信息的字段,以便我可以过滤返回的信息。流表中是否有任何字段可以告诉我帖子的类型?

这是我的查询的初始起点:

SELECT post_id, from, name, source, link, picture, updated_time, comments 
FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() 
AND type='newsfeed') AND is_hidden = 0

I'm trying to submit a query for a specific type of status sent to a user's newsfeed, where type=video. I basically want all videos posted for a user, including those not hosted by FB (otherwise I would submit a videos query). I would like it if I could get FB to not return anything except videos, but I certainly don't see a solution for that. I don't see that the returned query even has a field that will contain this information, so that I can filter the returned info. Is there any field in the stream table that will tell me the type of post?

Here's my initial starting point for the query:

SELECT post_id, from, name, source, link, picture, updated_time, comments 
FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() 
AND type='newsfeed') AND is_hidden = 0

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七禾 2024-12-12 09:04:57

您可以设置流的类型(请参阅ref),但是视频( type = 128)将仅返回上传的视频。

SELECT post_id, source_id, actor_id, target_id, message, attachment, permalink, type 
FROM stream 
WHERE source_id IN (SELECT target_id
    FROM connection
    WHERE source_id = me() AND is_following = 1) 
AND is_hidden = 0 
AND type = 128

这与使用图形 api 相矛盾(例如 js sdk:FB.api('/me/home', function(response) {} )),其中 type: 'video' 被赋予附加视频链接(例如 YouTube)。

但是,attachment.media[0] 字段将视频链接标识为 type: video;但这是一个数组(我不知道如何在其中查询),所以我检查了该链接是否包含对 youtube 的引用(youtube 链接可以是长格式或缩写形式,youtu.be

SELECT post_id, source_id, actor_id, target_id, message, attachment, permalink, type 
FROM stream 
WHERE source_id IN (SELECT target_id
    FROM connection
    WHERE source_id=me() AND is_following=1) 
AND is_hidden = 0 
AND type = 80 
AND strpos(attachment.href, "youtu") >= 0

You can set a type for the stream (see ref), but video (type = 128) will return only uploaded videos.

SELECT post_id, source_id, actor_id, target_id, message, attachment, permalink, type 
FROM stream 
WHERE source_id IN (SELECT target_id
    FROM connection
    WHERE source_id = me() AND is_following = 1) 
AND is_hidden = 0 
AND type = 128

This is in contradiction to using the graph api (e.g. js sdk: FB.api('/me/home', function(response) {} )), where type: 'video' is given to attached video links (e.g. YouTube)

However, the attachment.media[0] field, identifies video links as being type: video; but that is an array (and I didn't know how to query in them) so I checked if the link contained a reference to youtube (youtube links can be long-form or shortened, youtu.be)

SELECT post_id, source_id, actor_id, target_id, message, attachment, permalink, type 
FROM stream 
WHERE source_id IN (SELECT target_id
    FROM connection
    WHERE source_id=me() AND is_following=1) 
AND is_hidden = 0 
AND type = 80 
AND strpos(attachment.href, "youtu") >= 0
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文