/twitter

Twitter CLI for collecting tweets

Primary LanguageGoMIT LicenseMIT

Twitter CLI for collecting tweets

CircleCI Build status codecov GoDoc

Installation

Download from GitHub Releases.
Or go get github.com/mpppk/twitter (go modules must be enabled)

Setup

Put below .twitter.yml to ~/.config.

ConsumerKey: xxxx
ConsumerSecret: xxxx
AccessToken: xxxx
AccessTokenSecret: xxxx

Usage

Search

Search tweets by query and some options.
Results are stored in local file DB. (You must specify the DB path by --db-path flag.)
If you want to download images which contained in tweets, execute 'download images' command after search command.

Search command manages two states, 'minID' and 'maxID', which decide tweet ID range of searching. So search command can resume even if the process is interrupted.

$ twitter search \
  ---db-path tweets.db \
  -query [some_words] \
  --exclude retweets \
  --filter images 
  
  100 tweets are saved. (1157495237557678080-1157489067203760128)
  maxID is updated => 1157489067203760127
  100 tweets are saved. (1157489006810206210-1157483911351377921)
  maxID is updated => 1157483911351377920
  ...

Download images

Download images which contained tweets from DB file.
You must execute 'search' command first for collecting tweets to DB.

$ twitter download images -db-path tweets.db

Configuration

Each DB file has two states, 'minID' and 'maxID', which decide the tweet ID range when searching.
These values are updated automatically by search command, but you can also update manually through 'config' command.

$ twitter config set --db-path tweets.db [maxID|minID] [new tweet ID]
$ twitter config get --db-path tweets.db [maxID|minID]
=> 1157483911351377920