npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

recent-tweets

v0.9.1

Published

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

Downloads

4

Readme

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