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

List statuses request fails #426

Closed
appskitchen opened this Issue Apr 18, 2018 · 10 comments

Comments

Projects
None yet
5 participants
@appskitchen

appskitchen commented Apr 18, 2018

Hi,
I'm trying to get statuses for a custom list that I created. I tried the following codes, but it throws me error -

  let params = {
    list_id: XXXXX,
    slug: 'list1',
    owner_screen_name: 'username',
    count: 5,
    include_entities: true,
    include_rts: false
  };
  let T = new Twit({
    consumer_key : 'APP_CONSUMER_KEY',
    consumer_secret : 'APP_CONSUMER_SECRET',
    access_token : 'APP_ACCESS_TOKEN',
    access_token_secret : 'APP_ACCESS_TOKEN_SECRET',
    timeout_ms: 60*1000
  });

   T.get('lists/statuses', params, function(err, data, response){
      if(!err){
        console.log(data);
      }else{
        return next(err);
      }
  });

The error I get


Error: Sorry, that page does not exist.
    at Object.exports.makeTwitError (/Users/mmusa/Projects/Excercises/myapp/node_modules/twit/lib/helpers.js:74:13)
    at onRequestComplete (/Users/mmusa/Projects/Excercises/myapp/node_modules/twit/lib/twitter.js:328:25)
    at Request.<anonymous> (/Users/mmusa/Projects/Excercises/myapp/node_modules/twit/lib/twitter.js:348:7)
    at emitOne (events.js:121:20)
    at Request.emit (events.js:211:7)
    at Gunzip.<anonymous> (/Users/mmusa/Projects/Excercises/myapp/node_modules/request/request.js:1085:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at Gunzip.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1055:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

btw, Other call works(ex: home timeline). Appreciate your help.
Thanks

@IonBlueDesign

This comment has been minimized.

IonBlueDesign commented Apr 19, 2018

In your T.get method call, where is next() defined, or is it available through a closure to the callback function?

@appskitchen

This comment has been minimized.

appskitchen commented Apr 20, 2018

@IonBlueDesign It sends request to next matching route(I'm using express). More - https://stackoverflow.com/a/10695714

@JimTheMan

This comment has been minimized.

JimTheMan commented Apr 24, 2018

I'm looking at the docs for Twitter api statuses/list, and it seems like that params object should work. Are you sure a list actually exists for the values on that object?

And what does that even mean, "custom list"?

@appskitchen

This comment has been minimized.

appskitchen commented Apr 24, 2018

@JimTheMan I first sent a called to Twitter api lists/list to get the list ID that I've created and used that list ID for the above call. Did you able to get a results from lists/list?

@og24715

This comment has been minimized.

og24715 commented May 1, 2018

I got the same error by using list_id. I use together slug and owner_screen_name both and it works.

@appskitchen

This comment has been minimized.

appskitchen commented May 2, 2018

@og24715 I used list_id, slug, owner_screen_name(as you might see my sample codes above) but it says page doesnt exist. Do I need to enable anything at twitter? My list is public too!

@appskitchen

This comment has been minimized.

appskitchen commented May 3, 2018

@og24715 Could you share sample codes that you used? Appreciate your help.

@og24715

This comment has been minimized.

og24715 commented May 7, 2018

Hi @appskitchen

Im sorry for the late reply because I was visiting my parents.
Here is my codes and I did not do anything at Twitter.
I hope help you 😉

const T = new Twit({
  consumer_key: 'YOUR_CONSUMER_KEY',
  consumer_secret: 'YOUR_CONSUMER_SECRET',
  access_token: 'YOUR_ACCESS_TOKEN',
  access_token_secret: 'YOUR_ACCESS_TOKEN_SECRET',
  timeout_ms: 60 * 1000,
});

(async () => {
  try {
    const lists = await T.get('lists/list', { screen_name: 'og24715' });
    for (list of lists.data) {
      console.log(`\n****** list name: ${list.name}\n`);
      const tweets = await T.get('lists/statuses', {
        slug: list.slug,
        owner_screen_name: list.user.screen_name,
        count: 5,
      });
      for (tweet of tweets.data) {
        console.log(`@${tweet.user.screen_name}\n ${tweet.text}`);
      }
    }
  } catch (e) {
    throw e;
  }
})();
@og24715

This comment has been minimized.

og24715 commented May 7, 2018

@appskitchen

Oops

I guess that no need specify list_id to request lists/statuses if you have specified slug and owner_screen_name. We can check there in Twitter documentation.

You can identify a list by its slug instead of its numerical id(*). If you decide to do so, note that you’ll also have to specify the list owner using the owner_id or owner_screen_name parameters.

https://developer.twitter.com/en/docs/accounts-and-users/create-manage-lists/api-reference
* is the list_id

But, I know that an error as page does not exist will occur, by provide only list_id to T.get() .
I guess this problem caused by using list_id, so this issue title may be more accurate to say "Can not request lists/statuses using list_id".

@appskitchen

This comment has been minimized.

appskitchen commented May 7, 2018

@og24715 Great catch. It does work with slug and owner_screen_name but not with list_id (for me atleast). Thanks Hirakawa

@ttezel ttezel closed this Jun 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment