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

bank-fan

v0.0.1

Published

Inspired by the great @BofA_Help bot, a demonstration of how to use Twitter's Streaming API with sentiment analysis to get yourself in trouble

Downloads

2

Readme

BankFan

The code behind @BofA_Fan.

BankFan is a little proof-of-concept Twitter bot in the spirit of Bank of America's great @BofA_Help bot, which listens to a keyword stream and tweets replies, with ... results.

Bot Behavior

The bot currently listens for mentions of Bank of America, or BofA, and then does sentiment analysis based on the AFINN wordlist.

For instance, the tweet:

Protip:the @highmuseumofart is free 4 Bank of America users the 1st weekend of every month, & the new girl w/ a pearl earring exhib is great

... appears positive. Sentiment analysis confirms:

SENTIMENT ANALYSIS:

{"score":4,"comparative":0.15384615384615385,
 "tokens":["protipthe","highmuseumofart","is","free","","bank","of","america","users","the",
           "st","weekend","of","every","month","amp","the","new","girl","w","a","pearl",
           "earring","exhib","is","great"],
 "words":["free","great"],
 "positive":["free","great"],
 "negative":[]
}

... and so BankFan responds positively, with a link to a news story about another great Bank of America initiative: their bots!

@screenName Bank of America really rocks. http://t.co/mzr134Z5hM

Meanwhile, the tweet:

So the Bank of America ATM wants to play games w/me tonight & take all my money I worked for all day today & say it wasn't processed. Cool.

Is recognized as negative, because we've extended the wordlist with words like 'atm', 'checking', 'routing', etc. They need help, and we respond appropriately, alerting them to the fantastic automated @BofA_Help service!

@screenName maybe @BofA_Help has some input here? http://t.co/mzr134Z5hM

That Sounds Pretty Fishy

This bot is definitely abuse under the Twitter Automation Best Practices, just like the original @Bofa_Help bot. Be advised that running it will probably get your account suspended every few hours unless you make the messages more diverse.

So How Do I Run It

Well, of course you need a Twitter dev account. To run it, just add a file called twitter_config.coffee that looks like:

module.exports =                                                                                     
  consumer_key: ''                                                                                   
  consumer_secret: ''                                                                                
  access_token: ''                                                                                   
  access_token_secret: ''                                                                            

You can fill in the values from any application in your dev.twitter.com account, where you will see those fields on the first page. Then run:

coffee bankfan.coffee

So, what'd you learn?

That the Twitter API changes a lot. Beware your library selection.

That Sentiment Analysis algorithms are more than 70% accurate, but that humans only agree about 80% of the time -- making them almost as good as humans, though even with the AFINN list, you can tell that tiny messages make it harder.

Oh, yeah, and something something social media customer service.