ttezel / twit

Twitter API Client for node (REST & Streaming API)
4.31k stars 568 forks source link

Liking Post Always Resolves With { errors: [ { message: 'Sorry, that page does not exist', code: 34 } ] } #393

Closed JimLynchCodes closed 6 years ago

JimLynchCodes commented 7 years ago

Hi, I'm trying to write a script that searches for tweets and then likes the first tweet.

Here is my code:

const Twit = require('twit');
const config = require('./config');

const T = new Twit(config);

T.get('search/tweets', { q: 'clojure since:2011-11-11 lang:en', count: 100 }, function(err, data, response) {

    console.log('first tweet: ' +  data.statuses[0].id);

    T.post('favorites/create/:id', { "id": data.statuses[0].id }, function (err, data, response) {
        console.log(data);
    })
});

I tried with id and id_str, but neither are working. :(

JimLynchCodes commented 7 years ago

Always returns an error like this:

first tweet: 929405335584026600
{ errors: [ { message: 'Sorry, that page does not exist', code: 34 } ] }
m1n0s commented 6 years ago

@JimTheMan due to https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-favorites-create you don't need to add /:id in 'favorites/create/:id.

musa-pro commented 6 years ago

Hi @m1n0s Any idea about the issue I face? https://github.com/ttezel/twit/issues/426 Appreciate any help.

ttezel commented 6 years ago

@JimTheMan can you try T.post('favorites/create', ...)? You're getting that error message because the URL you're requesting doesn't exist. Feel free to reopen this issue if fixing the URL doesn't solve the problem.

JimLynchCodes commented 6 years ago

It works, thanks guys!