有没有办法使用图形API过滤出审核的评论? [英] Is there a way to filter out moderated comments with the graph API?
本文介绍了有没有办法使用图形API过滤出审核的评论?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们使用评论审核,而图API会传回所有内容(包括应该隐藏的评论)。似乎没有办法查看评论的状态或将其从结果中过滤出来。
We use comment moderation, and the graph API is returning everything (including comments that should be hidden). There doesn't appear to be a way to see the status of the comments or filter them out of the results.
推荐答案
您可以使用FQL仅查询公开的注释。使用注释表的is_private列来实现它(如Ryan所说)。让我添加一些示例:
You can use FQL to query only comments that are public. Use the is_private column of comment table to do it (as Ryan says). Let me add some examples:
例如,要查看只有公开评论:
SELECT post_fbid, fromid, object_id, text, time \
FROM comment \
WHERE object_id IN \
(SELECT comments_fbid \
FROM link_stat \
WHERE url ='http://developers.facebook.com/docs/reference/fql/comment/') \
AND is_private = 0
请注意,您还可以进行多次查询以获取有关用户的更多信息,例如:
Note that you can also make multiple queries to get more info about the user, for example:
# select comments from url
query1 = "SELECT post_fbid,fromid, object_id, text, time, comments "\
"FROM comment WHERE object_id IN " \
"(SELECT comments_fbid FROM link_stat WHERE url ='%s')" \
" and is_private = 0" % (url)
# select all users from query1 and get their names and ids
query2 = "SELECT uid, name FROM user " \
"WHERE uid IN (SELECT fromid FROM #query1)"
# let use string and not json.dumps cos ordering is important
query = '{"query1": "%s", "query2": "%s"}' % (query1, query2)
# make query to facebook using fql and the query...
final_query = "https://graph.facebook.com/fql?q=%s" % query
这篇关于有没有办法使用图形API过滤出审核的评论?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文