LoginSignup
48
31

More than 5 years have passed since last update.

140文字以上のツイートを取得する

Last updated at Posted at 2016-09-21

画像とか GIF の URL が140文字のカウントに含まれなくなって,今までの取得方法だと

example
hogehoge(140文字)... https://t.co/fuga

みたいになってしまう.どうやって REST API で全文取得するのか調べたら
https://dev.twitter.com/overview/api/upcoming-changes-to-tweets
ここに書いてあった.

リクエストするエンドポイントにtweet_mode=extendedを追加するといいらしい.
例えば
https://api.twitter.com/1.1/statuses/user_timeline.json?tweet_mode=extended
のような感じ?

ちなみに返ってくる JSON がちょっと変わっててその例は
https://github.com/twitterdev/tweet-updates/blob/master/samples/initial/extended_extended_14001.json
ここで見れる.

とりあえず Extended Tweet の本文は,取得した JSON ではfull_textが key になっているみたい.
今までだとtextが key だったので注意します.

48
31
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
48
31