Skip to content

Instantly share code, notes, and snippets.

@gsemino
Last active May 8, 2017 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gsemino/db29df2fd7c5d9e170ede5739fb5b62a to your computer and use it in GitHub Desktop.
Save gsemino/db29df2fd7c5d9e170ede5739fb5b62a to your computer and use it in GitHub Desktop.
Sample Queries for the SYNQ video Query API
/* search videos that have player views greater than 9000 and return the all the information for the videos that match
the query */
if (video.get("player.views") > 9000) { return video }
//search videos that have been uploaded and return only the video id
if (video.state == 'uploaded') { return {"video_id": video.video_id}; }
/* search videos that have been uploaded and where player views is greater than 1, return only the video id and
player embed url */
if (video.state == 'uploaded' && video.get("player.views") >= 1)
{
return {"video_id": video.video_id , "embed": video.get("player.embed_url")};
}
/* search uploaded videos where player views is greater than 1 and are from the last 7 days only;
return the video created at date, video id and player embed url */
if (video.state == 'uploaded' && video.get("player.views") >= 1 &&
moment(video.created_at).isAfter(moment().subtract('days', 7).format('YYYY-MM-DD')))
{
return {"created": video.created_at,"video_id": video.video_id , "embed": video.get("player.embed_url")};
}
/* search uploaded videos where the player views is greater than 1 and are from the last 7 days only plus are part of custom
user data groupid 99; return the video created at date, video id and player embed url */
if (video.state == 'uploaded' && video.get("player.views") >= 1 &&
moment(video.created_at).isAfter(moment().subtract('days', 7).format('YYYY-MM-DD')) && video.userdata.groupid == 99)
{
return {"groupid": video.userdata.groupid,"created": video.created_at,"video_id": video.video_id ,
"embed": video.get("player.embed_url")};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment