如何获取评论发布时间

发布于 2024-11-26 03:51:09 字数 414 浏览 0 评论 0原文

我正在尝试使用 facebook api 从用户的新闻源中获取最后的帖子以及附加的评论。通过对 STREAM 表的查询,可以轻松获取有关这些评论的信息,例如文本、演员 ID 等,

var query = FB.Data.query('SELECT post_id, actor_id, app_data, message, attribution,创建时间,评论来自流 WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid={0} AND type="newsfeed") LIMIT 20',响应.id);

但它似乎不包括发布这些评论的时间戳(因此我可以使用“created_time”获取帖子本身的时间戳,但不能获取附加的评论的时间戳)。 有人知道如何做到这一点吗? 非常感谢您的帮助。 多谢。

I'm trying use the facebook api to get the last posts from the newsfeed of a user along with the comments attached to it. It's easy to get information about those comments such as the text, the actor id, etc... from a query to the STREAM table,

var query = FB.Data.query('SELECT post_id, actor_id, app_data, message, attribution, created_time, comments FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid={0} AND type="newsfeed") LIMIT 20', response.id);

but it doesn't seem to include the timestamp at which those comments were posted (so I can get the timestamp for the post itself with 'created_time', but not for the comments attached to it).
Does anybody know a way to do this?
Help would be much appreciated.
Thanks a lot.

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

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

发布评论

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

评论(2

夏见 2024-12-03 03:51:09

这是对表 stream 的查询响应示例

在此处输入图像描述

您可以获取 希望这会有所

var query = FB.Data.query('SELECT post_id, actor_id, app_data, message, attribution, created_time, comments FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid={0} AND type="newsfeed") LIMIT 20', response.id);
query.wait(function(rows) {
    for (var i = 0; i < rows.length; i++) {
        if (rows[i].stream_post.comments.count > 0) {
            var comments_list = rows[i].stream_post.comments.comment_list;
            for (var j = 0; j < comments_list.length; j++) {
                var comment = comments_list[j];
                alert(comment.time);//timestamp
            }
        }
    }
});

帮助。

免责声明:尚未调试 JavaScript。可能存在拼写错误。

This is a sample response from a query to the table stream

enter image description here

You could fetch that with something like

var query = FB.Data.query('SELECT post_id, actor_id, app_data, message, attribution, created_time, comments FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid={0} AND type="newsfeed") LIMIT 20', response.id);
query.wait(function(rows) {
    for (var i = 0; i < rows.length; i++) {
        if (rows[i].stream_post.comments.count > 0) {
            var comments_list = rows[i].stream_post.comments.comment_list;
            for (var j = 0; j < comments_list.length; j++) {
                var comment = comments_list[j];
                alert(comment.time);//timestamp
            }
        }
    }
});

Hope this helps.

Disclaimer: Have not debugged the JavaScript. typos may be present.

无名指的心愿 2024-12-03 03:51:09

In:

$resultObject->comments->comment_list[0]->time 

有评论创建时间的unix时间戳。

In:

$resultObject->comments->comment_list[0]->time 

there is the unix timestamp from the comment created time.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文