New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

recent-tweets

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

recent-tweets

A library and command line utility to get recent tweets for a given user

latest
Source
npmnpm
Version
0.9.1
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Recent Tweets for Node.js

Main repo: https://github.com/huned/nodejs-recent-tweets

A library and command line utility to get recent tweets for a given user. Also extracts useful information: text, timestamp, permalink, and all links.

Why use it?

  • anonymous: no API credentials needed
  • returns an array of JSON objects with text, permalink, links, and timestamp
  • optionally, automatically unshortens https://t.co shortlinks.
  • includes a rad command line tool

WARNING v0.9.0 has breaking changes from prior releases (<= 0.0.5).

Command Line Usage

# first install the module globally
$ npm install -g recent-tweets

# then use the twls command
$ twls earthquakessf | jq
[
  {
    "time": "2021-11-15T18:27:01.000Z",
    "permalink": "https://twitter.com/earthquakesSF/status/1460313405609287682",
    "textContent": "A 1.7 magnitude earthquake occurred 8.08mi ESE of Angwin, CA. Details: http://eqbot.com/sPf Map:",
    "links": [
      {
        "href": "https://t.co/zwz71Ud5VG?amp=1",
        "textContent": "http://eqbot.com/sPf"
      }
    ]
  },
  {
    "time": "2021-11-14T07:24:01.000Z",
    "permalink": "https://twitter.com/earthquakesSF/status/1459784165889490944",
    "textContent": "A 1.7 magnitude earthquake occurred 4.35mi E of Penngrove, CA. Details: http://eqbot.com/sPY Map:",
    "links": [
      {
        "href": "https://t.co/Q7lR9coDQV?amp=1",
        "textContent": "http://eqbot.com/sPY"
      }
    ]
  },
  {
    "time": "2021-11-13T22:45:01.000Z",
    "permalink": "https://twitter.com/earthquakesSF/status/1459653555606802436",
    "textContent": "A 1.8 magnitude earthquake occurred 4.97mi WSW of Mountain House, CA. Details: http://eqbot.com/sPV Map:",
    "links": [
      {
        "href": "https://t.co/MM5tilm59a?amp=1",
        "textContent": "http://eqbot.com/sPV"
      }
    ]
  },
  ...
]

See man twls for more.

Node.js Usage

# Install the module
npm install recent-tweets --save

# In your code
const getTweets = require('recent-tweets')
const tweets = await getTweets('earthquakessf')

Caveats

  • Expanding shortlinks: one additional network request per shortlink, so can be slow.

TODOs

  • throw an error when puppeteer receives a 4xx response
  • cli: more informative usage message (autogenerated?)
  • bug: install man page correctly
  • chore: tidy up index.js

Author

Huned Botee

License

MIT

Keywords

twitter

FAQs

Package last updated on 05 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts