Skip to content

arnaudjuracek/twitter-get-likes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

$ twitter-get-likes

Get all your twitter likes


Installation

npm install --global arnaudjuracek/twitter-get-likes

Usage

CLI

twitter-get-likes

twitter-get-likes username
twitter-get-likes username > my-likes.csv
twitter-get-likes username --json > my-likes.json
twitter-get-likes --help
twitter-get-likes --version

Options
  -h, --help       Show this screen.
  -v, --version    Print the current version.
  --json           Output tweets as a JSON object instead of CSV.
  --schema         Specify a custom CSV schema path.

NOTE: This tool does not provide file writing capabilities ; use stdout redirection to write files.

Credentials

Twitter API must be used with access tokens, which are passed to twitter-get-likes cli using environment variables. See .env.example.

Specifying a custom CSV export schema

You can specify your own CSV export schema using a simple JSON to JavaScript eval implementation, where tweet is an object containing the current tweet (as exposed when using the --json flag):

example
$ twitter-get-likes @nodejs --schema="date-and-id.json"
date,id

Wed Mar 27 2019 18:43:04 GMT+0100 (CET),1110960442292256800
date-and-id.json
{
  "date": "new Date(tweet.created_at)",
  "id": "tweet.id"
}

Options

Some additionnals options are available through environment variables, see .env.example.

Programmatic

const getLikes = require('twitter-get-likes')

const options = {
  credentials: {
    consumer_key: '',
    consumer_secret: '',
    access_token_key: '',
    access_token_secret: ''
  },
  count: 200,
  endpoint: 'favorites/list',
  maxRequests: Number.POSITIVE_INFINITY,
  trimUser: false,
  tweetMode: 'extended'
}

getLikes('nodejs', options)
  .then(tweets => console.log(tweets))
  .catch(error => console.error(error))

License

MIT.