rodrigobertin
2/21/2014 - 11:14 AM

Get number of shares from social platforms

Get number of shares from social platforms

Facebook*:
https://api.facebook.com/method/links.getStats?urls=%%URL%%&format=json
+ works, returns shares, likes, comments and total

Twitter: 
http://urls.api.twitter.com/1/urls/count.json?url=%%URL%%&callback=twttr.receiveCount
+ v1 API but still works

Reddit:
http://buttons.reddit.com/button_info.json?url=%%URL%%
+ works

LinkedIn: 
http://www.linkedin.com/countserv/count/share?url=%%URL%%&format=json
+ works

Digg: 
http://widgets.digg.com/buttons/count?url=%%URL%%
- NOT WORKING!

Delicious: 
http://feeds.delicious.com/v2/json/urlinfo/data?url=%%URL%%
+ works

StumbleUpon: 
http://www.stumbleupon.com/services/1.01/badge.getinfo?url=%%URL%%
+ works

Pinterest: 
http://widgets.pinterest.com/v1/urls/count.json?source=6&url=%%URL%%
+ works

Vkontakte Shares:
http://vk.com/share.php?act=count&url=%%URL%%
+ works

Vkontakte Likes:
http://suvitruf.ru/2012/06/02/1255/

Odnoklassniki:
http://www.odnoklassniki.ru/dk?st.cmd=extOneClickLike&uid=odklocs0&ref=%%URL%%
+ works

Мой Мир Mail.ru:
http://connect.mail.ru/share_count?url_list=%%URL%%
+ works

Google+ counts are retrieved via a JSON-RPC POST call.
POST URL:
https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ
POST Body:
[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"%%URL%%","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]

or:
https://plusone.google.com/u/0/_/+1/fastbutton?count=true&url=%%URL%%
+ shows counter, you can parse html (div#aggregateCount)

$google_request = file_get_contents('https://plusone.google.com/u/0/_/+1/fastbutton?count=true&url='.$url);
$plusone_count = preg_replace('/(.*)<div id="aggregateCount" class="t1">(([0-9])*)<\/div>(.*)/is','$2',$google_request);

Reading:
http://www.tomanthony.co.uk/blog/google_plus_one_button_seo_count_api/
http://sergunik.name/?p=799
http://suvitruf.ru/2012/06/02/1255/

https://gist.github.com/jonathanmoore/2640302