LoginSignup
0
0

More than 3 years have passed since last update.

Twitterのリスト内ツイートを取得する際の`slug`の確認方法

Last updated at Posted at 2020-11-28

TwitterのリストをAPIで使用する際、例えばninomiytアカウントのsampleリストを取得する際、以前は素直に以下のようなコードを書けば取得できました。

node.jsのtwitterライブラリで書いていますが、他の言語でも概ね似たコードになると思います。

const response = await client.get("lists/statuses", {
    "owner_screen_name": "ninomiyt",
    "slug": "sample",
    "count": 100,
});

スクリーンキャプチャ

しかし、現在は新規作成したリストは、slugが作成した名前そのものではなく、名前-数値という値がセットされるようです。以下のようなコードで、lists/listを使って取得して確かめてください。

const result = await client.get("lists/list", {
    "screen_name": "ninomiyt" // あなたのアカウント名に書き換えてね!
});
console.log(result);
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0