I've been using the twit NodeJs library that calls through to the twitter api, and I was having trouble searching for a combination of multiple keywords in a tweet. Luckily, I found this great page that they call basic search operations: Probably the most useful operator I found that I was not aware of was OR. By default something like, "hedgehog, watermelon" would look for that exact phrase, but "hedgehodge OR watermelon" will return all the tweets containing the keyword hedgehog and tweets containing watermelon (and tweets containing both as well, if any exist...). Another cool thing to do is only get original tweets (not retweets) by adding the minus filter flag like this, "obama -filter:retweets". I also like to use "since" to only get somewhat recent posts: "guacamole since:2015-12-21". One last cool thing is the "sentiment" analysis. Put a smily or sad face in your query to filter by sentiment: "rainbows :)". Lucky for you, I'm going to give you a look at the current code for a lambda function I have in production right now for my Captain Clojure twitter liker / reposter bot. In particular, this line is where I build the query object. I'm taking an array or strings and joining the with " OR " so I can extract them out into a configuration file.
0 Comments
Your comment will be posted after it is approved.
Leave a Reply. |
AuthorThe posts on this site are written and maintained by Jim Lynch. About Jim...
Categories
All
Archives
August 2021
|