Reputation: 21
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
Upvotes: 2
Views: 1131
Reputation: 102
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
Upvotes: 1