Code Monkey home page Code Monkey logo

node-twitter-api's People

Contributors

boodoo avatar cenau avatar clinch avatar colinscape avatar elisee avatar hori-ryota avatar jsha avatar jtarasovic avatar kolarski avatar nathanoehlman avatar netoabel avatar princesonittn avatar reggi avatar reneraab avatar tilap avatar wircho avatar zephrax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-twitter-api's Issues

Uncaught TypeError: undefined is not a function mime.js

I am requiring the node app at the top of my js file. I get the following error Uncaught TypeError: undefined is not a function on this line:

  this._loading = file;
  // Read file and split into lines
  var map = {},
      content = fs.readFileSync(file, 'ascii'),

How I am importing the file is like so:

var twitterAPI = require('node-twitter-api');

Interested in an overhaul?

Hi there, wondering if the maintainer(s) of this repo are interested in an overhaul PR. I recently forked this project and converted it from OO/callbacks to functional/promises.

Seeing as this repo is no longer maintained, just wanted to ask if you're open to breathing in some new life. Otherwise I'll just fork it and put my updates there. Let me know!

Bad Authentication Data when trying to get request token

var twitterAPI = require('node-twitter-api');
var twitter = new twitterAPI({
  consumer_key: "removed",
  consumer_secret: "removed",
  callback: 'http://52.43.53.156:3000'
});

response:

Error getting OAuth request token : [object Object]
statusCode=400
data={"errors":[{"code":215,"message":"Bad Authentication data."}]}

My callback in this code is the same as what i entered in the twitter web interface.

Close Stream

I've been looking at the documentation or the code but I can't see a way to close a streem. Is there any?

Question: Is it possible to make requests using application-only auth with this library?

In my application, I need to make some requests using application-only auth instead of user-specific auth. Is that possible using this library, or are things only wired up for the user-specific version? I see that there's an OAuth endpoint method, but it appears to want an accessToken and accessTokenSecret, so it doesn't seem like the type of thing one would use to bootstrap a bearer token for the app to use for app-only auth...

How to get the value for oauth_verifier in Step 3 (Getting an Access Token)?

Unable to get the value for oaut_verifier .As a result of this not able to run the below function which needs the oauth_verifier as a parameter.

Twitter.prototype.getAccessToken = function(requestToken, requestTokenSecret, oauth_verifier, callback) {
this.oa.getOAuthAccessToken(requestToken, requestTokenSecret, oauth_verifier, function(error, oauthAccessToken, oauthAccessTokenSecret, results) {
if (error) {
callback(error);
} else {
console.log("HIIIIII");
callback(null, oauthAccessToken, oauthAccessTokenSecret, results);
}
});
};

Now in the begining of step 3 it is written that he url from step 2 will redirect and provide us with the value for oauth_verifier ,but when we are trying to get the rediret url it is returning us html content and we are not getting a oauth_verifier in that.

how to get oauth_verifier

hi, I completed the step 2, But the step 3 use the oauth_verifier and i don't know where to get the oauth_verifier value, could you please tell me how to get the oauth_verifier value ?
thank you .

Invalide Token

Hello,

I am coding an API that interact with Twitter API but I could not find a way to invalidate token, here's my code :

var accessToken = '...';
var accessSecretToken = '...';

twitter.oauth('invalidate_token', {access_token: accessToken}, accessToken, accessSecretToken, function(err, data, response){
  if (err) {
    // some codes
    cb(err);
  } else {
    // some codes
    cb();
  }
});

But it returns :

{statusCode:404, data: '{"errors":[{"message":"Sorry, that page does not exist","code":34}]}'} 

How can I invalidate the token plz ?

Thanks for your help.

Add method `oauthUrl(requestToken)`

Hey, can we add the method which returns https://twitter.com/oauth/authenticate?oauth_token=[requestToken] instead of building the URL manually (Step 3: Getting an Access Token)?

Any support for x_auth_access_type for getRequestToken function?

The optional x_auth_access_type parameter allows an application request to be downgraded from write access to read only access.
https://dev.twitter.com/oauth/reference/post/oauth/request_token

I tried adding the parameter to the 'var Twitter' constructor something like this in twitter.js

this.callback = options.callback;
this.x_auth_access_type = options.x_auth_access_type;
this.oa = new oauth.OAuth("https://twitter.com/oauth/request_token", "https://twitter.com/oauth/access_token", this.consumerKey, this.consumerSecret, "1.0A", this.callback, "HMAC-SHA1", this.x_auth_access_type);

and then making a request with

readAccess = new twitterAPI({
consumerKey: key,
consumerSecret: secret,
callback: url,
x_auth_access_type: 'read'});

but I'm unsure how to encode it and due to the lack of documentation from Twitter it might even be due to not being part of the oauth npm package.

error on trying to get request token

I'm using this package to get request token and access token.
but when I call for request token , I get the error below

Error getting OAuth request token : { statusCode: 401,
data: '\n\n Desktop applications only support the oauth_callback v
alue 'oob'\n /oauth/request_token\n\n' }

and here is code:

twitterAPI = require('node-twitter-api');
 function setSettingForTwitter(request, response, sessionManager) {
        var twitter = new twitterAPI({
            consumerKey: '1YTLohgHVA9L2Mri0bM2692Rl',
            consumerSecret: 'sGlYSxrs1uhS7v8qGY5fb2S8xLeNT2nACmchpONcjHO0bMfmzo',
            callback: 'http://localhost.com/app/socialNetworkSetting/respondFromTwitter'
        });


    twitter.getRequestToken(function(error, requestToken, requestTokenSecret, results){
        if (error) {
            console.log("Error getting OAuth request token : " , error);
        } else {
            //store token and tokenSecret somewhere, you'll need them later; redirect user
        }
    }); }

Upload with Media deprecated

I am using this for my latest work. But its not working for media attachments as updateWithMedia is deprecated. Can you rewrite this for uploading media and attach it to a tweet update.
Thanks.

How to stop streaming

I need to stop the current stream and start a new one.. i can start a new stream but i cant stop current running streaming

Read/Write ?

How do I set up the application for read AND write permissions? In my dashboard I already have my app set to read and write but when a user asks for permission its only asking for read.

I've tried changing my API initializing as well but it's not working.

const twitter = new twitterAPI({
    consumerKey: 'y7zrtwertwretPZjguuz7P',
    consumerSecret: 'DGjjetyytejwrtT',
    callback: "http://localhost:8080/api/authenticate",
    x_auth_access_type: 'read and write'
});

Chunked upload method for gifs

I've recently started uploading gifs to twitter, and I noticed that it fails randomly (like 1/10 attempts), even with small gifs. I looked into it, and Twitter recommends using the chunked upload endpoint for gifs.

https://dev.twitter.com/rest/media/uploading-media > Animated GIF recommendations

A GIF may fail during Tweet creation even if it is within the filesize limit. Adhere to the following constraints to improve success rates.

Resolution should be <= 1280x1080 (width x height)
Number of frames <= 350
Number of pixels (width * height * num_frames) <= 300 million
In order to get better support for larger GIFs, use the chunked upload endpoint with the media_category parameter. This allows the server to process the GIF file asynchronously, which is a requirement for processing larger files. Pass media_category=tweet_gif to enable async upload behavior for Tweets with an animated GIF.

What do you think about adding a method to support this behavior? It seems like we might be able to refactor Twitter.prototype.uploadVideo into a more generic method (like Twitter.prototype.chunkedMediaUpload) that accepts a media_type argument.

getStream doesn't properly handle chunked responses

In twitter.js:

req.addListener('response', function (res) {
        res.setEncoding('utf-8');
        res.addListener('data', function (chunk) {
            try {
                if (chunk == "\n") {
                    dataCallback(null, {}, chunk, res);
                } else {
                    dataCallback(null, JSON.parse(chunk), chunk, res);
                }
            } catch (e) {
                dataCallback({ message: "Error while parsing Twitter-Response.", error: e }, null, chunk, res);
            }
        });
        res.addListener('end', function() {
            endCallback();
        });
    });

According to the Twitter API:

The body of a streaming API response consists of a series of newline-delimited messages, where "newline" is considered to be \r\n (in hex, 0x0D 0x0A) and "message" is a JSON encoded data structure or a blank line.

It seems like there are two problems with the listener:

  1. The Twitter API returns '\r\n' in between responses and not '\n'. So if (chunk == "\n") doesn't properly capture those and we get a lot of errors.
  2. The response may be returned in more than one chunk and we try to JSON.parse() a single chunk instead of the whole response as we don't wait for the '\r\n'.

Escape twitter commands from status update

    twitter.statuses("update", {
            status: tweet
        },

If tweet starts with the charachter d or m, the api tries to direct message someone. Is there a quick and easy way to disable all of that functionality with the update function and only have it post status updates. Ie, how can I post updates that starts with d or m, that doesn't tries to send direct messages.

This package should not write to the console.

Most applications wouldn't want your errors displayed to their user's consoles... in my case the application we're using needs to monitor the "error" level logs in order to notify people of serious errors. Your use of "console.error" is very problematic for that.

Maybe provide some error event that the user can hook into to log the errors themselves if they really want it?

SyntaxError: Unexpected token

Hi guys thanks for the amazing job, now i have this problem at parsing twitter response

I get this error
captura de pantalla 2014-09-04 a la s 20 56 34

My first guess is that JSON.parse(data) is not parsing as expected,

I get like 150 responses ok but then it fails

is there a work around?

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.