Permalink
Browse files

fixed issue #1

  • Loading branch information...
1 parent b0c2d59 commit cfd50a614eb50980d9f3ae24580266ad17da7094 @coleGillespie coleGillespie committed Jul 25, 2012
Showing with 9 additions and 2 deletions.
  1. +8 −1 app.js
  2. +1 −1 package.json
View
9 app.js
@@ -42,13 +42,20 @@ http.createServer(function (req, res) {
};
getTwitterShares = function(url, shareObj){
-
+ console.log('GET Twitter share for http://urls.api.twitter.com/1/urls/count.json?url='+url)
request('http://urls.api.twitter.com/1/urls/count.json?url='+url, function (err, res, body){
if(!err && res.statusCode === 200){
+ if(body === 'twttr.receiveCount({"errors":[{"code":48,"message":"Unable to access URL counting services"}]})'){
+ getTwitterShares(url, shareObj)
+ return
+ }
+
+ console.log('RESPONSE = %o', body);
var tweet = JSON.parse(body),
tweetCount = {
count: tweet.count
};
+
shareObj.twitter = tweetCount;
getFacebookShares(url, shareObj);
}
View
@@ -4,7 +4,7 @@
"scripts": {
"start": "app.js"
},
- "version": "0.1.0-8",
+ "version": "0.1.0-9",
"engines": {
"node": "0.6.x"
},

0 comments on commit cfd50a6

Please sign in to comment.