I need to build a Twitter module entirely on the client side.
I intended to use the Twitter API for the data and YQL to get across Same Origin Policy, and also for its higher rate limiting. I have used this combination before with success.
One thing I need to do is to get a list of tweets with a hashtag and from a finite set of users.
This gets tweets with the #stackoverflow hash tag by users alexdickson and lizardbill.
I also need to get a different set of tweets.
This gets all tweets with the #stackoverflow hash tag.
Now, I need to display the second collection but excluding the results from the first set. This would be a diff of the results, like PHP’s array_diff().
For completeness, I may also need to achieve something by getting an intersection of two results, that is, a list of tweets which appear in both result sets. This is similar to PHP’s array_intersect().
It has been a while since I’ve used SQL and can’t think of how to achieve this in YQL.
YQL supports sub-selects (subqueries). See Joining Tables with Sub-selects. Sub-selects are used with the
INoperator, to filter the results of the outer select.For your particular query, there is also a
twitter.searchCommunity Open Data Table available to save you from building the Twitter URLs and using thejsontable.(Try this query in the YQL console.)