darkufo

Google Plus One

Jul 13th, 2011
338
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getPlusones(url)
  2. {
  3. var options =
  4. {
  5. "method" : "post",
  6. "contentType" : "application/json",
  7. "payload" : '{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"'+url+'","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}'
  8. };
  9.  
  10. var response = UrlFetchApp.fetch("https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ", options);
  11.  
  12. var results = JSON.parse(response.getContentText());
  13.  
  14. return results.result.metadata.globalCounts.count;
  15. }
RAW Paste Data Copied