Skip to content

Instantly share code, notes, and snippets.

@bricemaurin
Forked from tomcritchlow/Google Docs Script
Last active December 25, 2015 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bricemaurin/7009313 to your computer and use it in GitHub Desktop.
Save bricemaurin/7009313 to your computer and use it in GitHub Desktop.
function FBshares(url) {
var jsondata = UrlFetchApp.fetch("http://graph.facebook.com/"+url);
var object = Utilities.jsonParse(jsondata.getContentText());
return object.shares;
}
function Tweets(url) {
var jsondata = UrlFetchApp.fetch("http://urls.api.twitter.com/1/urls/count.json?url="+url);
var object = Utilities.jsonParse(jsondata.getContentText());
return object.count;
}
function Linkedin(url) {
var jsondata = UrlFetchApp.fetch("http://www.linkedin.com/countserv/count/share?url="+url);
return jsondata.getContentText();
}
function SU(url) {
var jsondata = UrlFetchApp.fetch("http://www.stumbleupon.com/services/1.01/badge.getinfo?url="+url);
var object = Utilities.jsonParse(jsondata.getContentText());
return object.result.views;
}
function Gbuzz(url) {
var jsondata = UrlFetchApp.fetch("https://www.googleapis.com/buzz/v1/activities/count?alt=json&url="+url);
var object = Utilities.jsonParse(jsondata.getContentText());
return jsondata.getContentText();
}
function delicious(url) {
var jsondata = UrlFetchApp.fetch("http://feeds.delicious.com/v2/json/urlinfo/data?url="+url);
return jsondata.getContentText();
}
function reddit(url) {
var jsondata = UrlFetchApp.fetch("http://www.reddit.com/api/info.json?url="+url);
var object = Utilities.jsonParse(jsondata.getContentText());
var count = 0;
var forloop = 0;
for (var i in object.data.children) {
count = count + object.data.children[forloop].data.score;
forloop = forloop + 1;
}
return count;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment