Suresh Atta
Suresh Atta

Reputation: 121998

Twitter share count url not working. Looking for alternatives

The below Javascript function I used to have the twitter share count for a URL.

Unfortunately, twitter stopped providing the count of shares now. Is there any better alternative for that ?

  // Twitter Shares Count
$.getJSON( 'http://cdn.api.twitter.com/1/urls/count.json?url=' + $URL + '&callback=?', function( twitdata ) {
    $('#twitter-count').text( ReplaceNumberWithCommas(twitdata.count) + ' Tweets ')
});

You can see how it is failing now

http://jsfiddle.net/sureshatta/5TxBd/125/

Previously the above call giving me the exact count of tweets with that url but twitter stopped that.

Can someone suggest any quick alternative for the above call ?

Upvotes: 0

Views: 1677

Answers (1)

Marcio Duarte
Marcio Duarte

Reputation: 771

On the last November 20, Twitter just shut down the JSON endpoint referenced in the question, which provided the share count.

Right now, Open Share Count is a free alternative to get the Twitter Share Count.

There's some caveats, though:

  1. It works but it's a very new service, so we don't know yet from experience how reliable and scalable it is.
  2. It's based on the REST API Search endpoints which, as Twitter mentioned on this page:

The Search API is not meant to be an exhaustive source of Tweets. Not all Tweets will be indexed or made available via the search interface.

Open Share Count mentions that will deal with this, though, so you can always have an accurate share count.

  1. You will need to grant Open Share Count access to your Twitter account, so they can obtain your credentials – this is far from optimal, but inevitable in this particular case.
  2. No information on the Open Share Count site about future plans – like if this will be free forever or a paid service at some point – nor any explanation about the security of your Twitter credentials. There's just a brief mention about a premium service, but that's it.

That said, right now this is probably the easiest and fastest way to make the Twitter share count work again with any degree of accuracy.

Upvotes: 1

Related Questions