https://github.com/arnaudjuracek/twitter-get-likes
Get all your twitter likes
https://github.com/arnaudjuracek/twitter-get-likes
cli favorites likes nodejs twitter
Last synced: 4 months ago
JSON representation
Get all your twitter likes
- Host: GitHub
- URL: https://github.com/arnaudjuracek/twitter-get-likes
- Owner: arnaudjuracek
- License: mit
- Created: 2019-03-30T15:04:57.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-31T11:16:03.000Z (over 6 years ago)
- Last Synced: 2025-05-16T03:07:39.085Z (7 months ago)
- Topics: cli, favorites, likes, nodejs, twitter
- Language: JavaScript
- Size: 31.3 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `$ twitter-get-likes`
**Get all your twitter likes**
## Installation
```sh
npm install --global arnaudjuracek/twitter-get-likes
```
## Usage
### CLI
```sh
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](https://www.tldp.org/LDP/abs/html/io-redirection.html) to write files.
#### Credentials
Twitter API must be used with [access tokens](https://developer.twitter.com/en/docs/basics/authentication/guides/access-tokens.html), which are passed to **`twitter-get-likes`** cli using environment variables. See [`.env.example`](.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
```console
$ 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`
```json
{
"date": "new Date(tweet.created_at)",
"id": "tweet.id"
}
```
#### Options
Some additionnals options are available through environment variables, see [`.env.example`](.env.example).
### Programmatic
```js
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.](https://tldrlegal.com/license/mit-license)