At work I’m working on a project in which we need to track the share count of a URL. Below are my quick notes. In all examples I’m getting the share count of https://www.facebook.com/. Note that I’m using the jq notation to extract the actual result from the response.
Just GET it
Facebook
Request:
curl --silent -X GET http://graph.facebook.com/?id=https://www.facebook.com/
UPDATE August 23, 2016
As of August 7, 2016 version 2.0 of the Graph API has been disabled. Version 2.1 is now the default one. In between 2.0 and 2.1 the response format has been changed. Thanks go out to Nabil Souk for pointing this out. This post has been updated to reflect this change. For archival purposes both responses (both the old, and new) are still included on this page.
In the past it was possible to send a GET request to https://cdn.syndication.twitter.com/widgets/tweetbutton/count.json?url={URL}. However, the “Count Endpoint” has been shut down and now returns a 410 Gone
Before getting involved, it’s important to know that the Search API is focused on relevance and not completeness. This means that some Tweets and users may be missing from search results.
var TwitterStream = require('twitter-stream-api'),
fs = require('fs');
// Create your keys at https://apps.twitter.com/
var keys = {
consumer_key : "consumer-key",
consumer_secret : "consumer-secret",
token : "your-token",
token_secret : "your-token-secret"
};
var Twitter = new TwitterStream(keys, false);
Twitter.stream('statuses/filter', {
track: 'npmjs.com/package/defer'
});
Twitter.on('connection success', function (uri) {
console.log('connection success', uri);
});
Twitter.on('connection aborted', function () {
console.log('connection aborted');
});
Twitter.on('connection error network', function (error) {
console.log('connection error network', error);
});
Twitter.on('connection error stall', function () {
console.log('connection error stall');
});
Twitter.on('connection error http', function (httpStatusCode) {
console.log('connection error http', httpStatusCode);
});
Twitter.on('connection rate limit', function (httpStatusCode) {
console.log('connection rate limit', httpStatusCode);
});
Twitter.on('connection error unknown', function (error) {
console.log('connection error unknown', error);
Twitter.close();
});
Twitter.on('data', function (obj) {
console.log('data', obj.toString());
});
Twitter.on('data keep-alive', function () {
console.log('data keep-alive');
});
Twitter.on('data error', function (error) {
console.log('data error', error);
});
Twitter.pipe(fs.createWriteStream('tweets.json'));
Note: Protected Streams won’t show up in here, of course.
Note: If the script is not running you’ll, as this is a “live” API, miss counts! Filling the gaps with a normal REST API request won’t be 100% accurate (see above).
Social share scripts are convenient and easy to copy & paste but rely on JavaScript and add additional overhead to your site, which means more HTTP requests and slower load times. Instead, use share links that don’t require you to load scripts for each social site.
Back to the basics: URLs and plain HTML (with a tad of VanillaJS on top to enhance the experience).
‘Look Up’ is a lesson taught to us through a love story, in a world where we continue to find ways to make it easier for us to connect with one another, but always results in us spending more time alone.
Or why I find it funny when I see people “checking in” at a location, something I used to myself a few years ago.
Noah, a short film that debuted at the Toronto International FIlm Festival, illustrates the flitting attention span and lack of true connection in digital culture more clearly than anything else in recent memory.
Every time someone visits News Feed there are on average 1,500 potential stories from friends, people they follow and Pages for them to see, and most people don’t have enough time to see them all. These stories include everything from wedding photos posted by a best friend, to an acquaintance checking in to a restaurant.
Let’s say the average Facebook user is awake for 17 hours a day. To consume all that stuff, they would take in 88 new items per hour, or 1.5 things per minute. That’s just not possible.
The Facebook interface is filled with numbers. These numbers, or metrics, measure and present our social value and activity, enumerating friends, likes, comments, and more. Facebook Demetricator is a web browser addon that hides these metrics. No longer is the focus on how many friends you have or on how much they like your status, but on who they are and what they said.