0.2.0 • Published 9 years ago

sociare-counter v0.2.0

Weekly downloads
5
License
-
Repository
github
Last release
9 years ago

Sociare Counter Build Status Coverage Status

A small NodeJS utility for fetching share counts of a given URL across many popular social networks.

Installation

Sociare Counter can be installed with npm

$ npm install --save sociare-counter

Usage Example

const sociare = require('sociare-counter');

sociare.getCounts('http://google.com', {
	networks: ['facebook', 'linkedin', 'pinterest']
}).then((counts) => {
	// Do something with the counts
});

ExpressJS endpoint

This example is helpful if you are using the Sociare button generator in browser:

const sociare = require('sociare-counter');
const app = express();

app.get('/share-counts', (req, res) => {
	sociare.getCounts(req.query.url, {
        networks: req.query.networks.split(','),
        omitQuery: req.query.omitQuery === 'true'
    })
    .then(counts => res.send(counts));
});

API

Sociare Counter has only one method: sociare.getCounts(url, [options]), which returns a Promise.

Configurable Options:

PropertyTypeDescription
networksArrayStringNetworks to fetch counts from. Defaults to ['facebook', 'pinterest', 'linkedin', 'googleplus']
omitQueryBooleanWhether query strings should be stripped from the URL before getting counts. Defaults to false

Motivation

Getting share counts from all the different social networks is... a pain, to say the least. Wouldn't it be great to have one way to get said counts, and have it always return a standard, known format? Yeah, we thought so too, which is where Sociare Counter comes into play! Simply specify the networks you want counts from and give it a url, it's easy as that!

Sociare Counter currently supports the following networks:

  • Facebook
  • Pinterest
  • LinkedIn
  • Google+

Why no Twitter??

In November of 2015, Twitter shut down it's public API access to share count data, in favor of it archiving service, GNIP. Until a suitable replacement is found (that does not require additional authentication), this plugin will not be able to return share counts from Twitter.

Contributing

Pull requests for bug-fixes and additions of other services are always welcome! Please be sure to include any tests for new code & follow the current coding style as best you can.

You can run the test suite with the following command:

$ npm test

License

Sociare Counter is distributed under the MIT license.

0.2.0

9 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago