Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FGM - Fixed trends error. #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 24 additions & 20 deletions lib/twitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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?

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

/*
Expand Down Expand Up @@ -1273,4 +1277,4 @@ Twitter.prototype._getUsingCursor = function(url, params, callback) {
}

return this;
}
}