Open databasedude opened 11 years ago
To make "search" working again, I did the following:
in "keys.js", line 8, I corrected the search base to:
search_base: 'https://api.twitter.com/1.1/search', // old was 'http://search.twitter.com'
in "twitter.js", in line 166, I also corrected the search-URL
var url = this.options.search_base + '/tweets.json'; // old was 'search.json';
now it seems to work.
... see updated fork at https://github.com/sebhildebrandt/ntwitter
This is my new search function that used the new API.
Twitter.prototype.search = function(q, params, callback) {
if (typeof params === 'function') {
callback = params;
params = {};
}
if ( typeof callback !== 'function' ) {
throw new Error('FAIL: INVALID CALLBACK.');
return this;
}
var url = this.options.rest_base + '/search/tweets.json?q=' + q.replace('#', '%23') + '&' + querystring.stringify(params);
var request = this.oauth.get(url, this.options.access_token_key, this.options.access_token_secret, function(error, data, response) {
if ( error && error.statusCode ) {
var err = new Error('HTTP Error ' + error.statusCode + ': ' + http.STATUS_CODES[error.statusCode]);
err.statusCode = error.statusCode;
err.data = error.data;
callback(err);
}
else if (error) {
callback(error);
}
else {
try {
var json = JSON.parse(data);
}
catch(err) {
return callback(err);
}
callback(null, json);
}
});
return this;
}
@sebhildebrandt could you send out a pull request with those changes?
Doesn't work for me, even when changing lines 8 and 166.
This was working fine until yesterday around noon when Twitter shut off v.1. It now returns the following error: "The Twitter REST API v1 will soon stop functioning. Please migrate to API v1.1."