From 7d4e95b303dab94f0af907b41b918ba5969a701f Mon Sep 17 00:00:00 2001 From: Fred Morstatter Date: Wed, 12 Jun 2013 15:15:38 -0700 Subject: [PATCH] FGM - Fixed trends error. --- lib/twitter.js | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/lib/twitter.js b/lib/twitter.js index edc52464..9641161d 100644 --- a/lib/twitter.js +++ b/lib/twitter.js @@ -5,9 +5,9 @@ var VERSION = '0.2.8', Cookies = require('cookies'), Keygrip = require('keygrip'), streamparser = require('./parser'), - util = require('util'), - utils = require('./utils'); - keys = require('./keys'); + util = require('util'), + utils = require('./utils'); + keys = require('./keys'); function Twitter(options) { if (!(this instanceof Twitter)) return new Twitter(options); @@ -113,9 +113,9 @@ Twitter.prototype.post = function(url, content, content_type, callback) { // Workaround: oauth + booleans == broken signatures if (content && typeof content === 'object') { Object.keys(content).forEach(function(e) { - if ( typeof content[e] === 'boolean' ) - content[e] = content[e].toString(); - }); + if ( typeof content[e] === 'boolean' ) + content[e] = content[e].toString(); + }); } this.oauth.post(url, @@ -181,11 +181,11 @@ Twitter.prototype.stream = function(method, params, callback) { // Iterate on params properties, if any property is an array, convert it to comma-delimited string if (params) { - Object.keys(params).forEach(function(item) { - if (util.isArray(params[item])) { - params[item] = params[item].join(','); - } - }); + Object.keys(params).forEach(function(item) { + if (util.isArray(params[item])) { + params[item] = params[item].join(','); + } + }); } var stream_base = this.options.stream_base, @@ -292,9 +292,9 @@ Twitter.prototype.stream = function(method, params, callback) { Twitter.prototype.cookie = function(req) { var keys = null; - //this make no sense !this.options.cookie_secret return always true or false + //this make no sense !this.options.cookie_secret return always true or false //if ( !this.options.cookie_secret !== null ) - if(this.options.cookie_secret) + if(this.options.cookie_secret) keys = new Keygrip(this.options.cookie_secret); var cookies = new Cookies( req, null, keys ) var getState = this.options.getState || function (req, key) { @@ -322,9 +322,9 @@ Twitter.prototype.login = function(mount, success) { this.options.cookie_options.secure = true; // Set up the cookie encryption secret if we've been given one var keys = null; - //the same issue than above + //the same issue than above //if ( !this.options.cookie_secret !== null ) - if(this.options.cookie_secret) + if(this.options.cookie_secret) keys = new Keygrip(this.options.cookie_secret); // FIXME: ^ so configs that don't use login() won't work? @@ -663,7 +663,11 @@ Twitter.prototype.getCurrentTrends = function(params, callback) { Twitter.prototype.getTrendsWithId = function(woeid, params, callback) { if (!woeid) woeid = '1'; - var url = '/trends/' + woeid + '.json'; + var url = '/trends/place.json'; + if(!params){ + params = {}; + } + params['id'] = woeid; this.get(url, params, callback); return this; } @@ -1232,9 +1236,9 @@ Twitter.prototype.geoGetPlace = function(place_id, callback) { // #newtwitter Twitter.prototype.getRelatedResults = function(id, params, callback) { - var url = '/related_results/show/' + escape(id) + '.json'; - this.get(url, params, callback); - return this; + var url = '/related_results/show/' + escape(id) + '.json'; + this.get(url, params, callback); + return this; } /* @@ -1273,4 +1277,4 @@ Twitter.prototype._getUsingCursor = function(url, params, callback) { } return this; -} +} \ No newline at end of file