Skip to content

onmax/happy-tweet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Happy tweet 😊

A tool that fetches happy tweets given a search term

It will only retrieve tweets less than 7 days old, as searching the full archive is only allowed for academic research. More information in the official documentation.

Installation

Remember that you will need a Twitter Bearer Token

Cargo run

cargo run -- "#banana" -o output.json -t YOUR_TOKEN_HERE

#banana is the search term, replace it with your search

Dockerfile

Modify the Dockerfile and replace:

make build #you are suppose to run only once
make run

Advance Search Features

The term accepts a string as follows: happy-tweet eurovision. You can filter the results using the advance search features that Twitter offers.

Some examples:

  • One hashtag: happy-tweet "#disney"
  • Ignore retweet happy-tweet -is:retweet
  • Multiple hashtags: happy-tweet "(#dc OR #marvel)"
  • Specific language: happy-tweet "lang:de"
  • Specific author: happy-tweet "(from:barackobama)"

And of course you can combine them:

happy-tweet "paella lang:es"

happy-tweet "(happy OR happiness) lang:en -birthday -is:retweet"

Read official docs on Advance Search.

Twitter Bearer Token

How to generate a Bearer Token

Output

You can select the output file path using the flag -o or --output. It will append the new results to the existing file, otherwise it will create the file. The output has a JSON format. By default it will write the output in /dev/stdout.