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

juttle-twitter-adapter

v0.4.0

Published

Juttle adapter for Twitter

Downloads

9

Readme

Juttle Twitter Adapter

Twitter adapter for the Juttle data flow language.

Examples

Filter the real-time Twitter stream for all tweets containing "potus"

read twitter -to :end: 'potus'

Read the last 100 historical tweets referencing "potus":

read twitter -from :0: -limit 100 'potus'

An end-to-end example is described here and deployed to the demo system demo.juttle.io.

Installation

Like Juttle itself, the adapter is installed as a npm package. Both Juttle and the adapter need to be installed side-by-side:

$ npm install juttle
$ npm install juttle-twitter-adapter

Configuration

The adapter needs to be registered and configured so that it can be used from within Juttle. To do so, add the following to your ~/.juttle/config.json file:

{
    "adapters": {
        "twitter": {
            "consumer_key": "...",
            "consumer_secret": "...",
            "access_token_key": "...",
            "access_token_secret": "..."
        }
    }
}

To obtain Twitter credentials, first set up a Twitter App and create an OAuth token.

Usage

The adapter can run in two modes -- streaming or historical, controlled by the -from and -to options.

For historical searches, specify -from :0: (and optionally -to :now:) to indicate that the read should start at the beginning of time and continue to the present.

For live searches, specify -to :end: (and optionally -from :now:) to indicate that the read should start at the current time and continue indefinitely.

In both cases the adapter requires a single search term in the filter expression, as shown in the examples above.

Historical searches are somewhat constrained by the fact that Twitter's API returns tweets in reverse chronological order, but Juttle semantics require data points to be emitted in order.

To handle this, the adapter buffers all the points in memory before emitting them down the flowgraph. There is a limit to control how many points are buffered, which defaults to 1000. This can be overridden using the limit option.

In streaming mode, the adapter will buffer all points for a configurable delay (the lag option) so that they can be properly sorted into increasing time order.

Options

Name | Type | Required | Description -----|------|----------|------------- from | moment | no | time to start reading the data -- must be either :now: or :0: to | moment | no | time to stop reading the data -- must be either :now: or :end: limit | integer | no | maximum number of tweets to emit in historical mode (default: 1000) fetchSize | integer | no | number of tweets to fetch per round-trip in historical mode (default: 100, max: 100) lag | duration | no | in streaming mode, delay for the given amount of time to reorder incoming points (default: 2 seconds)

Contributing

Want to contribute? Awesome! Don’t hesitate to file an issue or open a pull request.