Open4

Twitter APIで特定ユーザーの過去ツイートを取得する

カニさん(そららいど)カニさん(そららいど)

前提としてTwitter APIのv2のみを対象として調査。

公式Docだとこの辺かな
https://developer.twitter.com/en/docs/twitter-api/tweets/timelines/introduction

あるユーザーIDの最近のツイートやリツイート、リプライ、引用ツイートなどを取得できる。

This endpoint gives you access to a single Twitter account's most recent Tweets, Retweets, replies, and Quote Tweets, similar to what may be seen on a user's profile timeline.

最近の3200件が取得できるとのこと。
逆にいうと、それ以上過去のツイート等は取得できなさそう。

The endpoint can return the 3,200 most recent Tweets, Retweets, replies and Quote Tweets posted by the user.

1回のリクエストで100件取得できる。

Results are paginated up to 100 Tweets per page.

カニさん(そららいど)カニさん(そららいど)

Tweetタイムラインのレート制限は、
15分間に1Appで1500リクエストまで。
また、15分間に1対象ユーザーあたり900リクエストまで。

つまり、1つのAppで発行したアクセストークンを使って1人のユーザーをターゲットとしてツイートを取得する場合、15分間に900回までリクエストが投げれる。
1回のリクエストで100件のツイートが取得できるので、特定ユーザーの最近のツイート上限である3200件にはレート制限を気にすることなく簡単に到達できそう。

https://developer.twitter.com/en/portal/products