How to get the longest information from Twitter as of 12/12/2016

Use the official client key as a matter of course.

When you get the longest information contained in one tweet, you have to think about the format of 140 characters or more and voting. There are two ways to get it: REST API and streaming API.

・ Get 140-character tweets by REST / streaming with text alone ・ Quote other people's tweets RT and get 140-character text tweets by REST / Streaming ・ Get tweets with 140 characters of text with multiple photos by REST / streaming ・ Get a 140-character tweet with REST / streaming with one video ・ Get a 140-character tweet with REST / streaming with one gif ・ Get a 140-character tweet by REST / streaming with a vote. However, voting cannot be taken with the streaming api. Verify 11 types. Extract only the items that you think are necessary from json. The pattern when quoting RT of another person's tweet includes the case where the quoted tweet has a video, the case where there is a photo, and the case where grandchild RT is performed, but that is not considered.

For REST API, the parameters [" tweet_mode "=>" extended "," include_cards "=>" true "," cards_platform "=>" iPhone-13 "] are added. At that time, the text key disappears in the return value and becomes full_text, so be careful with the receiving program. Not only does full_text increase, but text disappears.

Also, it seems that you can add the text of "description" to the image. http://qiita.com/riocampos/items/1f92177d359192d22566

Also, if you get a tweet that retweets a tweet with a vote with the REST API, it looks like the parent tweet has a vote, so be careful

Return value of various tweets json

Text only + Streaming


{
 "created_at": "Wed Dec 14 16:24:38 +0000 2016",
 "entities": {
  "hashtags": [],
  "symbols": [],
  "urls": [],
  "user_mentions": []
 },
 "id": 809071610086891520,
 "id_str": "809071610086891520",
 "in_reply_to_screen_name": null,
 "in_reply_to_status_id": null,
 "in_reply_to_status_id_str": null,
 "in_reply_to_user_id": null,
 "in_reply_to_user_id_str": null,
 "is_quote_status": false,
 "source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android<\/a>",
 "text": "--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100-------110-------120-------130-------140",
 "timestamp_ms": "1481732678325",
 "truncated": false,
 "user": { /*Abbreviation*/ }
}

Quote other people's tweets RT + Streaming


{
 "created_at": "Wed Dec 14 16:55:35 +0000 2016",
 "display_text_range":[ 0, 140],
 "entities": {
  "hashtags": [],
  "symbols": [],
  "urls": [{
   "display_url": "twitter.com/i/web/status/8\u2026",
   "expanded_url": "https://twitter.com/i/web/status/809079397864984577",
   "indices": [ 117, 140],
   "url": "https://t.co/qNwhONpfzx"
  }],
  "user_mentions": []
 },
 "extended_tweet": {
  "display_text_range":[ 0, 140],
  "entities": {
   "hashtags": [],
   "symbols": [],
   "urls": [{
    "display_url": "twitter.com/nhk_seikatsu/s\u2026",
    "expanded_url": "https://twitter.com/nhk_seikatsu/status/808993484757569536",
    "indices": [ 141, 164],
    "url": "https://t.co/qg0FpkXtly"
   }],
   "user_mentions": []
  },
  "full_text": "--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100-------110-------120-------130-------140 https://t.co/qg0FpkXtly"
 },
 "id": 809079397864984577,
 "id_str": "809079397864984577",
 "in_reply_to_screen_name": null,
 "in_reply_to_status_id": null,
 "in_reply_to_status_id_str": null,
 "in_reply_to_user_id": null,
 "in_reply_to_user_id_str": null,
 "is_quote_status": true,
 "possibly_sensitive": false,
 "quoted_status": {
  "created_at": "Wed Dec 14 11:14:11 +0000 2016",
  "display_text_range": [ 0, 83],
  "entities": {
   "hashtags": [],
   "media": [{
    "display_url": "pic.twitter.com/x8Ez1P93Dj",
    "expanded_url": "https://twitter.com/nhk_seikatsu/status/808993484757569536/photo/1",
    "id": 808993364360052737,
    "id_str": "808993364360052737",
    "indices": [ 84, 107],
    "media_url": "http://pbs.twimg.com/media/CzofLbxUQAEWEig.jpg ",
    "media_url_https": "https://pbs.twimg.com/media/CzofLbxUQAEWEig.jpg ",
    "sizes": {
     "large": { "h": 490, "resize": "fit", "w": 867 },
     "medium": {"h": 490, "resize": "fit", "w": 867 },
     "small": { "h": 384, "resize": "fit", "w": 680 },
     "thumb": { "h": 150, "resize": "crop","w": 150 }
    },
    "type": "photo",
    "url": "https://t.co/x8Ez1P93Dj"
   }],
   "symbols": [],
   "urls": [],
   "user_mentions": []
  },
  "extended_entities": {"media": [{
   "display_url": "pic.twitter.com/x8Ez1P93Dj",
   "expanded_url": "https://twitter.com/nhk_seikatsu/status/808993484757569536/photo/1",
   "id": 808993364360052737,
   "id_str": "808993364360052737",
   "indices": [ 84, 107],
   "media_url": "http://pbs.twimg.com/media/CzofLbxUQAEWEig.jpg ",
   "media_url_https": "https://pbs.twimg.com/media/CzofLbxUQAEWEig.jpg ",
   "sizes": {
    "large": { "h": 490, "resize": "fit", "w": 867 },
    "medium": {"h": 490, "resize": "fit", "w": 867 },
    "small": { "h": 384, "resize": "fit", "w": 680 },
    "thumb": { "h": 150, "resize": "crop","w": 150 }
   },
   "type": "photo",
   "url": "https://t.co/x8Ez1P93Dj"
  }]},
  "id": 808993484757569536,
  "id_str": "808993484757569536",
  "in_reply_to_screen_name": null,
  "in_reply_to_status_id": null,
  "in_reply_to_status_id_str": null,
  "in_reply_to_user_id": null,
  "in_reply_to_user_id_str": null,
  "is_quote_status": false,
  "possibly_sensitive": false,
  "source": "<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client<\/a>",
  "text": "[N7 Fukuoka Ryoko's tweet] Today, snow piled up in Tottori and Daisen, but after that, there are places where snow piles up along the mountains of western Japan such as Kyushu. From San-in to Kinki, snow may accumulate even on flat ground. https://t.co/x8Ez1P93Dj",
  "truncated": false,
  "user": {  /*Abbreviation*/  }
 },
 "quoted_status_id": 808993484757569536,
 "quoted_status_id_str": "808993484757569536",
 "source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android<\/a>",
 "text": "--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100-------110-----\u2026 https://t.co/qNwhONpfzx",
 "timestamp_ms": "1481734535076",
 "truncated": true,
 "user": {  /*Abbreviation*/  }
}

Multiple photos + Streaming


{
 "created_at": "Wed Dec 14 16:27:52 +0000 2016",
 "display_text_range": [ 0, 140],
 "entities": {
  "hashtags": [],
  "symbols": [],
  "urls": [{
   "display_url": "twitter.com/i/web/status/8\u2026",
   "expanded_url": "https://twitter.com/i/web/status/809072425484709888",
   "indices": [ 117, 140],
   "url": "https://t.co/z7hdKdZ0w0"
  }],
  "user_mentions": []
 },
 "extended_tweet": {
  "display_text_range": [ 0, 140],
  "entities": {
   "hashtags": [],
   "media": [
    {
     "display_url": "pic.twitter.com/cHRosMlCC1",
     "expanded_url": "https://twitter.com/FushiharaCheck/status/809072425484709888/photo/1",
     "id": 809072350364717057,
     "id_str": "809072350364717057",
     "indices": [ 141, 164],
     "media_url": "http://pbs.twimg.com/media/CzpnBBkUUAE8H63.jpg ",
     "media_url_https": "https://pbs.twimg.com/media/CzpnBBkUUAE8H63.jpg ",
     "sizes": {
      "large": { "h": 1152, "resize": "fit", "w": 2048 },
      "medium": {"h": 675,  "resize": "fit", "w": 1200 },
      "small": { "h": 383,  "resize": "fit", "w": 680  },
      "thumb": { "h": 150,  "resize": "crop","w": 150   }
     },
     "type": "photo",
     "url": "https://t.co/cHRosMlCC1"
    },
    {
     "display_url": "pic.twitter.com/cHRosMlCC1",
     "expanded_url": "https://twitter.com/FushiharaCheck/status/809072425484709888/photo/1",
     "id": 809072372053479425,
     "id_str": "809072372053479425",
     "indices": [ 141,164],
     "media_url": "http://pbs.twimg.com/media/CzpnCSXUkAEZg6f.jpg ",
     "media_url_https": "https://pbs.twimg.com/media/CzpnCSXUkAEZg6f.jpg ",
     "sizes": {
      "large": { "h": 1152, "resize": "fit", "w": 2048 },
      "medium": {"h": 675,  "resize": "fit", "w": 1200 },
      "small": { "h": 383,  "resize": "fit", "w": 680  },
      "thumb": { "h": 150,  "resize": "crop","w": 150  }
     },
     "type": "photo",
     "url": "https://t.co/cHRosMlCC1"
    },
    {
     "display_url": "pic.twitter.com/cHRosMlCC1",
     "expanded_url": "https://twitter.com/FushiharaCheck/status/809072425484709888/photo/1",
     "id": 809072393515741184,
     "id_str": "809072393515741184",
     "indices": [ 141, 164 ],
     "media_url": "http://pbs.twimg.com/media/CzpnDiUUsAAjR4M.jpg ",
     "media_url_https": "https://pbs.twimg.com/media/CzpnDiUUsAAjR4M.jpg ",
     "sizes": {
      "large": {  "h": 2048, "resize": "fit", "w": 1152 },
      "medium": { "h": 1200, "resize": "fit", "w": 675  },
      "small": {  "h": 680,  "resize": "fit", "w": 383  },
      "thumb": {  "h": 150,  "resize": "crop","w": 150  }
     },
     "type": "photo",
     "url": "https://t.co/cHRosMlCC1"
    },
    {
     "display_url": "pic.twitter.com/cHRosMlCC1",
     "expanded_url": "https://twitter.com/FushiharaCheck/status/809072425484709888/photo/1",
     "id": 809072411005964289,
     "id_str": "809072411005964289",
     "indices": [ 141, 164],
     "media_url": "http://pbs.twimg.com/media/CzpnEjeUUAEhctz.jpg ",
     "media_url_https": "https://pbs.twimg.com/media/CzpnEjeUUAEhctz.jpg ",
     "sizes": {
      "large": { "h": 1920, "resize": "fit", "w": 1080 },
      "medium": {"h": 1200, "resize": "fit", "w": 675  },
      "small": { "h": 680,  "resize": "fit", "w": 383  },
      "thumb": { "h": 150,  "resize": "crop","w": 150  }
     },
     "type": "photo",
     "url": "https://t.co/cHRosMlCC1"
    }
   ],
   "symbols": [],
   "urls": [],
   "user_mentions": []
  },
  "extended_entities": {"media": [
   {
    "display_url": "pic.twitter.com/cHRosMlCC1",
    "expanded_url": "https://twitter.com/FushiharaCheck/status/809072425484709888/photo/1",
    "id": 809072350364717057,
    "id_str": "809072350364717057",
    "indices": [
     141,
     164
    ],
    "media_url": "http://pbs.twimg.com/media/CzpnBBkUUAE8H63.jpg ",
    "media_url_https": "https://pbs.twimg.com/media/CzpnBBkUUAE8H63.jpg ",
    "sizes": {
     "large": { "h": 1152, "resize": "fit", "w": 2048 },
     "medium": {"h": 675,  "resize": "fit", "w": 1200 },
     "small": { "h": 383,  "resize": "fit", "w": 680  },
     "thumb": { "h": 150,  "resize": "crop","w": 150  }
    },
    "type": "photo",
    "url": "https://t.co/cHRosMlCC1"
   },
   {
    "display_url": "pic.twitter.com/cHRosMlCC1",
    "expanded_url": "https://twitter.com/FushiharaCheck/status/809072425484709888/photo/1",
    "id": 809072372053479425,
    "id_str": "809072372053479425",
    "indices": [ 141, 164 ],
    "media_url": "http://pbs.twimg.com/media/CzpnCSXUkAEZg6f.jpg ",
    "media_url_https": "https://pbs.twimg.com/media/CzpnCSXUkAEZg6f.jpg ",
    "sizes": {
     "large": { "h": 1152,"resize": "fit", "w": 2048 },
     "medium": {"h": 675, "resize": "fit", "w": 1200 },
     "small": { "h": 383, "resize": "fit", "w": 680  },
     "thumb": { "h": 150, "resize": "crop","w": 150  }
    },
    "type": "photo",
    "url": "https://t.co/cHRosMlCC1"
   },
   {
    "display_url": "pic.twitter.com/cHRosMlCC1",
    "expanded_url": "https://twitter.com/FushiharaCheck/status/809072425484709888/photo/1",
    "id": 809072393515741184,
    "id_str": "809072393515741184",
    "indices": [ 141, 164],
    "media_url": "http://pbs.twimg.com/media/CzpnDiUUsAAjR4M.jpg ",
    "media_url_https": "https://pbs.twimg.com/media/CzpnDiUUsAAjR4M.jpg ",
    "sizes": {
     "large": {  "h": 2048, "resize": "fit", "w": 1152  },
     "medium": { "h": 1200, "resize": "fit", "w": 675   },
     "small": {  "h": 680,  "resize": "fit", "w": 383   },
     "thumb": {  "h": 150,  "resize": "crop","w": 150   }
    },
    "type": "photo",
    "url": "https://t.co/cHRosMlCC1"
   },
   {
    "display_url": "pic.twitter.com/cHRosMlCC1",
    "expanded_url": "https://twitter.com/FushiharaCheck/status/809072425484709888/photo/1",
    "id": 809072411005964289,
    "id_str": "809072411005964289",
    "indices": [
     141,
     164
    ],
    "media_url": "http://pbs.twimg.com/media/CzpnEjeUUAEhctz.jpg ",
    "media_url_https": "https://pbs.twimg.com/media/CzpnEjeUUAEhctz.jpg ",
    "sizes": {
     "large": { "h": 1920, "resize": "fit", "w": 1080 },
     "medium": {"h": 1200, "resize": "fit", "w": 675  },
     "small": { "h": 680,  "resize": "fit", "w": 383  },
     "thumb": { "h": 150,  "resize": "crop","w": 150  }
    },
    "type": "photo",
    "url": "https://t.co/cHRosMlCC1"
   }
  ]},
  "full_text": "--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100-------110-------120-------130-------140 https://t.co/cHRosMlCC1"
 },
 "id": 809072425484709888,
 "id_str": "809072425484709888",
 "in_reply_to_screen_name": null,
 "in_reply_to_status_id": null,
 "in_reply_to_status_id_str": null,
 "in_reply_to_user_id": null,
 "in_reply_to_user_id_str": null,
 "is_quote_status": false,
 "possibly_sensitive": false,
 "source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android<\/a>",
 "text": "--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100-------110-----\u2026 https://t.co/z7hdKdZ0w0",
 "timestamp_ms": "1481732872731",
 "truncated": true,
 "user": {  /*Abbreviation*/  }
}

One video + Streaming



{
 "created_at": "Wed Dec 14 16:29:55 +0000 2016",
 "display_text_range": [ 0, 140],
 "entities": {
  "hashtags": [],
  "symbols": [],
  "urls": [{
   "display_url": "twitter.com/i/web/status/8\u2026",
   "expanded_url": "https://twitter.com/i/web/status/809072938959794176",
   "indices": [ 117, 140],
   "url": "https://t.co/u1w8px19Tw"
  }],
  "user_mentions": []
 },
 "extended_tweet": {
  "display_text_range": [ 0, 140],
  "entities": {
   "hashtags": [],
   "media": [{
    "display_url": "pic.twitter.com/OL00BBQAxK",
    "expanded_url": "https://twitter.com/FushiharaCheck/status/809072938959794176/video/1",
    "id": 809072899134877697,
    "id_str": "809072899134877697",
    "indices": [ 141, 164 ],
    "media_url": "http://pbs.twimg.com/ext_tw_video_thumb/809072899134877697/pr/img/hbOXeA8CxTMegjmi.jpg ",
    "media_url_https": "https://pbs.twimg.com/ext_tw_video_thumb/809072899134877697/pr/img/hbOXeA8CxTMegjmi.jpg ",
    "sizes": {
     "large": { "h": 720, "resize": "fit", "w": 720 },
     "medium": {"h": 600, "resize": "fit", "w": 600 },
     "small": { "h": 340, "resize": "fit", "w": 340 },
     "thumb": { "h": 150, "resize": "crop","w": 150 }
    },
    "type": "video",
    "url": "https://t.co/OL00BBQAxK",
    "video_info": {
     "aspect_ratio": [ 1, 1],
     "duration_millis": 3174,
     "variants": [
      { "bitrate": 832000, "content_type": "video/mp4"             ,"url": "https://video.twimg.com/ext_tw_video/809072899134877697/pr/vid/480x480/fYLlV2KH52Wso8Dd.mp4" },
      {                    "content_type": "application/x-mpegURL", "url": "https://video.twimg.com/ext_tw_video/809072899134877697/pr/pl/_VNarphgg5T_-huV.m3u8"         },
      { "bitrate": 1280000,"content_type": "video/mp4",             "url": "https://video.twimg.com/ext_tw_video/809072899134877697/pr/vid/720x720/yfRhQYeu5BS8sJUA.mp4" },
      { "bitrate": 320000, "content_type": "video/mp4",             "url": "https://video.twimg.com/ext_tw_video/809072899134877697/pr/vid/240x240/zpjHoSmClXSI3CMl.mp4" },
      {                    "content_type": "application/dash+xml",  "url": "https://video.twimg.com/ext_tw_video/809072899134877697/pr/pl/_VNarphgg5T_-huV.mpd"          }
     ]
    }
   }],
   "symbols": [],
   "urls": [],
   "user_mentions": []
  },
  "extended_entities": {"media": [{
   "display_url": "pic.twitter.com/OL00BBQAxK",
   "expanded_url": "https://twitter.com/FushiharaCheck/status/809072938959794176/video/1",
   "id": 809072899134877697,
   "id_str": "809072899134877697",
   "indices": [ 141, 164 ],
   "media_url": "http://pbs.twimg.com/ext_tw_video_thumb/809072899134877697/pr/img/hbOXeA8CxTMegjmi.jpg ",
   "media_url_https": "https://pbs.twimg.com/ext_tw_video_thumb/809072899134877697/pr/img/hbOXeA8CxTMegjmi.jpg ",
   "sizes": {
    "large": { "h": 720, "resize": "fit", "w": 720 },
    "medium": {"h": 600, "resize": "fit", "w": 600 },
    "small": { "h": 340, "resize": "fit", "w": 340 },
    "thumb": { "h": 150, "resize": "crop","w": 150 }
   },
   "type": "video",
   "url": "https://t.co/OL00BBQAxK",
   "video_info": {
    "aspect_ratio": [ 1, 1 ],
    "duration_millis": 3174,
    "variants": [
     { "bitrate": 832000, "content_type": "video/mp4",             "url": "https://video.twimg.com/ext_tw_video/809072899134877697/pr/vid/480x480/fYLlV2KH52Wso8Dd.mp4" },
     {                    "content_type": "application/x-mpegURL", "url": "https://video.twimg.com/ext_tw_video/809072899134877697/pr/pl/_VNarphgg5T_-huV.m3u8"         },
     { "bitrate": 1280000,"content_type": "video/mp4",             "url": "https://video.twimg.com/ext_tw_video/809072899134877697/pr/vid/720x720/yfRhQYeu5BS8sJUA.mp4" },
     { "bitrate": 320000, "content_type": "video/mp4",             "url": "https://video.twimg.com/ext_tw_video/809072899134877697/pr/vid/240x240/zpjHoSmClXSI3CMl.mp4" },
     {                    "content_type": "application/dash+xml",  "url": "https://video.twimg.com/ext_tw_video/809072899134877697/pr/pl/_VNarphgg5T_-huV.mpd"          }
    ]
   }
  }]},
  "full_text": "--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100-------110-------120-------130-------140 https://t.co/OL00BBQAxK"
 },
 "id": 809072938959794176,
 "id_str": "809072938959794176",
 "in_reply_to_screen_name": null,
 "in_reply_to_status_id": null,
 "in_reply_to_status_id_str": null,
 "in_reply_to_user_id": null,
 "in_reply_to_user_id_str": null,
 "is_quote_status": false,
 "possibly_sensitive": false,
 "source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android<\/a>",
 "text": "--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100-------110-----\u2026 https://t.co/u1w8px19Tw",
 "timestamp_ms": "1481732995153",
 "truncated": true,
 "user": {  /*Abbreviation*/  }
}

gif+Streaming


{"delete": {
 "status": {
  "id": 809072938959794176,
  "id_str": "809072938959794176",
  "user_id": 212836820,
  "user_id_str": "212836820"
 },
 "timestamp_ms": "1481733061516"
}}
{
 "created_at": "Wed Dec 14 16:31:18 +0000 2016",
 "display_text_range": [ 0, 140],
 "entities": {
  "hashtags": [],
  "symbols": [],
  "urls": [{
   "display_url": "twitter.com/i/web/status/8\u2026",
   "expanded_url": "https://twitter.com/i/web/status/809073288987033601",
   "indices": [ 117, 140 ],
   "url": "https://t.co/esRM3ZatZn"
  }],
  "user_mentions": []
 },
 "extended_tweet": {
  "display_text_range": [ 0, 140],
  "entities": {
   "hashtags": [],
   "media": [{
    "display_url": "pic.twitter.com/69vpnJi0Tg",
    "expanded_url": "https://twitter.com/FushiharaCheck/status/809073288987033601/photo/1",
    "id": 809073269244448770,
    "id_str": "809073269244448770",
    "indices": [ 141, 164 ],
    "media_url": "http://pbs.twimg.com/tweet_video_thumb/Czpn2gqUUAIkqSP.jpg ",
    "media_url_https": "https://pbs.twimg.com/tweet_video_thumb/Czpn2gqUUAIkqSP.jpg ",
    "sizes": {
     "large": {  "h": 348, "resize": "fit", "w": 498 },
     "medium": { "h": 348, "resize": "fit", "w": 498 },
     "small": {  "h": 238, "resize": "fit", "w": 340 },
     "thumb": {  "h": 150, "resize": "crop","w": 150 }
    },
    "type": "animated_gif",
    "url": "https://t.co/69vpnJi0Tg",
    "video_info": {
     "aspect_ratio": [ 83, 58 ],
     "variants": [{ "bitrate": 0, "content_type": "video/mp4", "url": "https://video.twimg.com/tweet_video/Czpn2gqUUAIkqSP.mp4" }]
    }
   }],
   "symbols": [],
   "urls": [],
   "user_mentions": []
  },
  "extended_entities": {"media": [{
   "display_url": "pic.twitter.com/69vpnJi0Tg",
   "expanded_url": "https://twitter.com/FushiharaCheck/status/809073288987033601/photo/1",
   "id": 809073269244448770,
   "id_str": "809073269244448770",
   "indices": [ 141, 164 ],
   "media_url": "http://pbs.twimg.com/tweet_video_thumb/Czpn2gqUUAIkqSP.jpg ",
   "media_url_https": "https://pbs.twimg.com/tweet_video_thumb/Czpn2gqUUAIkqSP.jpg ",
   "sizes": {
    "large": { "h": 348,"resize": "fit", "w": 498 },
    "medium": {"h": 348,"resize": "fit", "w": 498 },
    "small": { "h": 238,"resize": "fit", "w": 340 },
    "thumb": { "h": 150,"resize": "crop","w": 150 }
   },
   "type": "animated_gif",
   "url": "https://t.co/69vpnJi0Tg",
   "video_info": {
    "aspect_ratio": [ 83, 58],
    "variants": [{ "bitrate": 0,"content_type": "video/mp4","url": "https://video.twimg.com/tweet_video/Czpn2gqUUAIkqSP.mp4"}]
   }
  }]},
  "full_text": "--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100-------110-------120-------130-------140 https://t.co/69vpnJi0Tg"
 },
 "id": 809073288987033601,
 "id_str": "809073288987033601",
 "in_reply_to_screen_name": null,
 "in_reply_to_status_id": null,
 "in_reply_to_status_id_str": null,
 "in_reply_to_user_id": null,
 "in_reply_to_user_id_str": null,
 "is_quote_status": false,
 "possibly_sensitive": false,
 "source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android<\/a>",
 "text": "--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100-------110-----\u2026 https://t.co/esRM3ZatZn",
 "timestamp_ms": "1481733078606",
 "truncated": true,
 "user": {  /*Abbreviation*/  }
}

Text only + REST


{
  "conversation_id": 809093023757783040,
  "created_at": "Wed Dec 14 17:49:43 +0000 2016",
  "display_text_range": [ 0, 140],
  "entities": {
    "hashtags": [],
    "symbols": [],
    "urls": [],
    "user_mentions": []
  },
  "full_text": "--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100-------110-------120-------130-------140",
  "id": 809093023757783040,
  "id_str": "809093023757783040",
  "in_reply_to_screen_name": null,
  "in_reply_to_status_id": null,
  "in_reply_to_status_id_str": null,
  "in_reply_to_user_id": null,
  "in_reply_to_user_id_str": null,
  "is_quote_status": false,
  "source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android<\/a>",
  "supplemental_language": null,
  "truncated": false,
  "user": {  /*Abbreviation*/  }
}

Quote other people's tweets RT + REST


{
  "conversation_id": 809093896495955968,
  "created_at": "Wed Dec 14 17:53:11 +0000 2016",
  "display_text_range": [ 0, 140],
  "entities": {
    "hashtags": [],
    "symbols": [],
    "urls": [{
      "display_url": "twitter.com/nhk_news/statu\u2026",
      "expanded_url": "https://twitter.com/nhk_news/status/809012067206213632",
      "indices": [ 141, 164 ],
      "url": "https://t.co/DAyvRZ62hq"
    }],
    "user_mentions": []
  },
  "full_text": "--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100-------110-------120-------130-------140 https://t.co/DAyvRZ62hq",
  "id": 809093896495955968,
  "id_str": "809093896495955968",
  "in_reply_to_screen_name": null,
  "in_reply_to_status_id": null,
  "in_reply_to_status_id_str": null,
  "in_reply_to_user_id": null,
  "in_reply_to_user_id_str": null,
  "is_quote_status": true,
  "possibly_sensitive": false,
  "possibly_sensitive_appealable": false,
  "quoted_status": {
    "conversation_id": 809012067206213632,
    "created_at": "Wed Dec 14 12:28:02 +0000 2016",
    "display_text_range": [ 0, 70],
    "entities": {
      "hashtags": [{
        "indices": [ 37, 46 ],
        "text": "nhk_news"
      }],
      "symbols": [],
      "urls": [{
        "display_url": "www3.nhk.or.jp/news/html/2016\u2026",
        "expanded_url": "http://www3.nhk.or.jp/news/html/20161214/k10010807111000.html",
        "indices": [ 47, 70 ],
        "url": "https://t.co/Qh2cL8CRIp"
      }],
      "user_mentions": []
    },
    "full_text": "[Breaking news JUST IN] Soccer club World Cup Kashima advances to the finals for the first time in Asia#nhk_news https://t.co/Qh2cL8CRIp",
    "id": 809012067206213632,
    "id_str": "809012067206213632",
    "in_reply_to_screen_name": null,
    "in_reply_to_status_id": null,
    "in_reply_to_status_id_str": null,
    "in_reply_to_user_id": null,
    "in_reply_to_user_id_str": null,
    "is_quote_status": false,
    "possibly_sensitive": false,
    "possibly_sensitive_appealable": false,
    "source": "<a href=\"http://www.nhk.or.jp/\" rel=\"nofollow\">NHK<\/a>",
    "supplemental_language": null,
    "truncated": false,
    "user": {  /*Abbreviation*/  }
  },
  "quoted_status_id": 809012067206213632,
  "quoted_status_id_str": "809012067206213632",
  "source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android<\/a>",
  "supplemental_language": null,
  "truncated": false,
  "user": { /*Abbreviation*/ }
}

Multiple photos + REST


{
  "conversation_id": 809094174695788544,
  "created_at": "Wed Dec 14 17:54:18 +0000 2016",
  "display_text_range": [ 0, 140],
  "entities": {
    "hashtags": [],
    "media": [{
      "display_url": "pic.twitter.com/tGEKIb7ii8",
      "expanded_url": "https://twitter.com/FushiharaCheck/status/809094174695788544/photo/1",
      "features": {
        "large": {"faces": []},
        "medium": {"faces": []},
        "orig": {"faces": []},
        "small": {"faces": []}
      },
      "id": 809094094773309440,
      "id_str": "809094094773309440",
      "indices": [ 141, 164 ],
      "media_url": "http://pbs.twimg.com/media/Czp6ytzUUAAj4w6.jpg ",
      "media_url_https": "https://pbs.twimg.com/media/Czp6ytzUUAAj4w6.jpg ",
      "sizes": {
        "large": { "h": 1920, "resize": "fit", "w": 1080 },
        "medium": {"h": 1200, "resize": "fit", "w": 675  },
        "small": { "h": 680,  "resize": "fit", "w": 383  },
        "thumb": { "h": 150,  "resize": "crop","w": 150  }
      },
      "type": "photo",
      "url": "https://t.co/tGEKIb7ii8"
    }],
    "symbols": [],
    "urls": [],
    "user_mentions": []
  },
  "extended_entities": {"media": [
    {
      "display_url": "pic.twitter.com/tGEKIb7ii8",
      "expanded_url": "https://twitter.com/FushiharaCheck/status/809094174695788544/photo/1",
      "ext_alt_text": null,
      "features": {
        "large": {"faces": []},
        "medium": {"faces": []},
        "orig": {"faces": []},
        "small": {"faces": []}
      },
      "id": 809094094773309440,
      "id_str": "809094094773309440",
      "indices": [ 141,164],
      "media_url": "http://pbs.twimg.com/media/Czp6ytzUUAAj4w6.jpg ",
      "media_url_https": "https://pbs.twimg.com/media/Czp6ytzUUAAj4w6.jpg ",
      "sizes": {
        "large": { "h": 1920, "resize": "fit", "w": 1080 },
        "medium": {"h": 1200, "resize": "fit", "w": 675  },
        "small": { "h": 680,  "resize": "fit", "w": 383  },
        "thumb": { "h": 150,  "resize": "crop","w": 150   }
      },
      "type": "photo",
      "url": "https://t.co/tGEKIb7ii8"
    },
    {
      "display_url": "pic.twitter.com/tGEKIb7ii8",
      "expanded_url": "https://twitter.com/FushiharaCheck/status/809094174695788544/photo/1",
      "ext_alt_text": null,
      "features": {
        "large": {"faces": [{ "h": 272, "w": 272, "x": 126, "y": 236 }]},
        "medium": {"faces": [{"h": 159, "w": 159, "x": 73,  "y": 138 }]},
        "orig": {"faces": [{  "h": 272, "w": 272, "x": 126, "y": 236 }]},
        "small": {"faces": [{ "h": 90,  "w": 90,  "x": 41,  "y": 78  }]}
      },
      "id": 809094112401969152,
      "id_str": "809094112401969152",
      "indices": [ 141, 164 ],
      "media_url": "http://pbs.twimg.com/media/Czp6zveUUAAYi3W.jpg ",
      "media_url_https": "https://pbs.twimg.com/media/Czp6zveUUAAYi3W.jpg ",
      "sizes": {
        "large": { "h": 1152, "resize": "fit", "w": 2048  },
        "medium": {"h": 675,  "resize": "fit", "w": 1200  },
        "small": { "h": 383,  "resize": "fit", "w": 680   },
        "thumb": { "h": 150,  "resize": "crop","w": 150   }
      },
      "type": "photo",
      "url": "https://t.co/tGEKIb7ii8"
    },
    {
      "display_url": "pic.twitter.com/tGEKIb7ii8",
      "expanded_url": "https://twitter.com/FushiharaCheck/status/809094174695788544/photo/1",
      "ext_alt_text": null,
      "features": {
        "large": {"faces": []},
        "medium": {"faces": []},
        "orig": {"faces": []},
        "small": {"faces": []}
      },
      "id": 809094133721632768,
      "id_str": "809094133721632768",
      "indices": [ 141, 164],
      "media_url": "http://pbs.twimg.com/media/Czp60-5UkAAcg3A.jpg ",
      "media_url_https": "https://pbs.twimg.com/media/Czp60-5UkAAcg3A.jpg ",
      "sizes": {
        "large": {  "h": 1152, "resize": "fit", "w": 2048 },
        "medium": { "h": 675,  "resize": "fit", "w": 1200 },
        "small": {  "h": 383,  "resize": "fit", "w": 680  },
        "thumb": {  "h": 150,  "resize": "crop","w": 150  }
      },
      "type": "photo",
      "url": "https://t.co/tGEKIb7ii8"
    },
    {
      "display_url": "pic.twitter.com/tGEKIb7ii8",
      "expanded_url": "https://twitter.com/FushiharaCheck/status/809094174695788544/photo/1",
      "ext_alt_text": null,
      "features": {
        "large": {"faces": []},
        "medium": {"faces": []},
        "orig": {"faces": []},
        "small": {"faces": []}
      },
      "id": 809094156005953536,
      "id_str": "809094156005953536",
      "indices": [ 141, 164],
      "media_url": "http://pbs.twimg.com/media/Czp62R6UUAAMDCb.jpg ",
      "media_url_https": "https://pbs.twimg.com/media/Czp62R6UUAAMDCb.jpg ",
      "sizes": {
        "large": {  "h": 2048, "resize": "fit",  "w": 1152 },
        "medium": { "h": 1200, "resize": "fit",  "w": 675  },
        "small": {  "h": 680,  "resize": "fit",  "w": 383  },
        "thumb": {  "h": 150,  "resize": "crop", "w": 150  }
      },
      "type": "photo",
      "url": "https://t.co/tGEKIb7ii8"
    }
  ]},
  "full_text": "--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100-------110-------120-------130-------140 https://t.co/tGEKIb7ii8",
  "id": 809094174695788544,
  "id_str": "809094174695788544",
  "in_reply_to_screen_name": null,
  "in_reply_to_status_id": null,
  "in_reply_to_status_id_str": null,
  "in_reply_to_user_id": null,
  "in_reply_to_user_id_str": null,
  "is_quote_status": false,
  "possibly_sensitive": false,
  "possibly_sensitive_appealable": false,
  "source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android<\/a>",
  "supplemental_language": null,
  "truncated": false,
  "user": {  /*Abbreviation*/ }
}

One video + REST


{
  "conversation_id": 809094395622371328,
  "created_at": "Wed Dec 14 17:55:10 +0000 2016",
  "display_text_range": [ 0, 140],
  "entities": {
    "hashtags": [],
    "media": [{
      "display_url": "pic.twitter.com/TdiqeB4hJN",
      "expanded_url": "https://twitter.com/FushiharaCheck/status/809094395622371328/video/1",
      "features": {},
      "id": 809094362193797121,
      "id_str": "809094362193797121",
      "indices": [ 141, 164 ],
      "media_url": "http://pbs.twimg.com/ext_tw_video_thumb/809094362193797121/pr/img/RE4jeOMrvF9tfivG.jpg ",
      "media_url_https": "https://pbs.twimg.com/ext_tw_video_thumb/809094362193797121/pr/img/RE4jeOMrvF9tfivG.jpg ",
      "sizes": {
        "large": {  "h": 720, "resize": "fit",  "w": 720 },
        "medium": { "h": 600, "resize": "fit",  "w": 600 },
        "small": {  "h": 340, "resize": "fit",  "w": 340 },
        "thumb": {  "h": 150, "resize": "crop", "w": 150 }
      },
      "type": "photo",
      "url": "https://t.co/TdiqeB4hJN"
    }],
    "symbols": [],
    "urls": [],
    "user_mentions": []
  },
  "extended_entities": {"media": [{
    "additional_media_info": {"monetizable": false},
    "display_url": "pic.twitter.com/TdiqeB4hJN",
    "expanded_url": "https://twitter.com/FushiharaCheck/status/809094395622371328/video/1",
    "ext_alt_text": null,
    "features": {},
    "id": 809094362193797121,
    "id_str": "809094362193797121",
    "indices": [ 141, 164],
    "media_url": "http://pbs.twimg.com/ext_tw_video_thumb/809094362193797121/pr/img/RE4jeOMrvF9tfivG.jpg ",
    "media_url_https": "https://pbs.twimg.com/ext_tw_video_thumb/809094362193797121/pr/img/RE4jeOMrvF9tfivG.jpg ",
    "sizes": {
      "large": {  "h": 720, "resize": "fit", "w": 720 },
      "medium": { "h": 600, "resize": "fit", "w": 600 },
      "small": {  "h": 340, "resize": "fit", "w": 340 },
      "thumb": {  "h": 150, "resize": "crop","w": 150 }
    },
    "type": "video",
    "url": "https://t.co/TdiqeB4hJN",
    "video_info": {
      "aspect_ratio": [ 1, 1 ],
      "duration_millis": 1637,
      "variants": [
        {                     "content_type": "application/dash+xml",  "url": "https://video.twimg.com/ext_tw_video/809094362193797121/pr/pl/bm1hLXjugyI-O3mZ.mpd"          },
        { "bitrate": 320000,  "content_type": "video/mp4",             "url": "https://video.twimg.com/ext_tw_video/809094362193797121/pr/vid/240x240/NEsdVjVOJvgaTrPv.mp4" },
        {                     "content_type": "application/x-mpegURL", "url": "https://video.twimg.com/ext_tw_video/809094362193797121/pr/pl/bm1hLXjugyI-O3mZ.m3u8"         },
        { "bitrate": 1280000, "content_type": "video/mp4",             "url": "https://video.twimg.com/ext_tw_video/809094362193797121/pr/vid/720x720/OCdBA2I6I2kJufXM.mp4" },
        { "bitrate": 832000,  "content_type": "video/mp4",             "url": "https://video.twimg.com/ext_tw_video/809094362193797121/pr/vid/480x480/aOHEF01xZorfioP_.mp4" }
      ]
    }
  }]},
  "full_text": "--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100-------110-------120-------130-------140 https://t.co/TdiqeB4hJN",
  "id": 809094395622371328,
  "id_str": "809094395622371328",
  "in_reply_to_screen_name": null,
  "in_reply_to_status_id": null,
  "in_reply_to_status_id_str": null,
  "in_reply_to_user_id": null,
  "in_reply_to_user_id_str": null,
  "is_quote_status": false,
  "possibly_sensitive": false,
  "possibly_sensitive_appealable": false,
  "source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android<\/a>",
  "supplemental_language": null,
  "truncated": false,
  "user": {  /*Abbreviation*/ }
}

gif+REST


{
  "card": {
    "binding_values": {
      "card_url": {
        "scribe_key": "card_url",
        "string_value": "https://t.co/Ih01hHncQs",
        "type": "STRING"
      },
      "player_height": {
        "string_value": "200",
        "type": "STRING"
      },
      "player_image": {
        "image_value": {
          "alt": null,
          "height": 200,
          "url": "https://pbs.twimg.com/tweet_video_thumb/Czp7K5YVIAAgGs7.jpg ",
          "width": 272
        },
        "type": "IMAGE"
      },
      "player_image_large": {
        "image_value": {
          "alt": null,
          "height": 200,
          "url": "https://pbs.twimg.com/tweet_video_thumb/Czp7K5YVIAAgGs7.jpg ",
          "width": 272
        },
        "type": "IMAGE"
      },
      "player_stream_content_type": {
        "string_value": "video/mp4 codecs=avc1.42E0",
        "type": "STRING"
      },
      "player_stream_url": {
        "string_value": "https://video.twimg.com/tweet_video/Czp7K5YVIAAgGs7.mp4",
        "type": "STRING"
      },
      "player_url": {
        "string_value": "https://video.twimg.com/tweet_video/Czp7K5YVIAAgGs7.mp4",
        "type": "STRING"
      },
      "player_width": {
        "string_value": "272",
        "type": "STRING"
      }
    },
    "card_platform": {"platform": {
      "audience": {
        "bucket": null,
        "name": "production"
      },
      "device": {
        "name": "iPhone",
        "version": "13"
      }
    }},
    "card_type_url": "http://card-type-url-is-deprecated.invalid",
    "name": "animated_gif",
    "url": "https://t.co/Ih01hHncQs"
  },
  "conversation_id": 809094519673090048,
  "created_at": "Wed Dec 14 17:55:40 +0000 2016",
  "display_text_range": [ 0, 140],
  "entities": {
    "hashtags": [],
    "symbols": [],
    "urls": [{
      "display_url": "pic.twitter.com/Ih01hHncQs",
      "expanded_url": "https://twitter.com/FushiharaCheck/status/809094519673090048/photo/1",
      "indices": [ 141, 164 ],
      "url": "https://t.co/Ih01hHncQs"
    }],
    "user_mentions": []
  },
  "full_text": "--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100-------110-------120-------130-------140 https://t.co/Ih01hHncQs",
  "id": 809094519673090048,
  "id_str": "809094519673090048",
  "in_reply_to_screen_name": null,
  "in_reply_to_status_id": null,
  "in_reply_to_status_id_str": null,
  "in_reply_to_user_id": null,
  "in_reply_to_user_id_str": null,
  "is_quote_status": false,
  "possibly_sensitive": false,
  "possibly_sensitive_appealable": false,
  "source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android<\/a>",
  "supplemental_language": null,
  "truncated": false,
  "user": { /*Abbreviation*/ }
}

Voting+REST


{
  "card": {
    "binding_values": {
      "api": {
        "string_value": "capi://passthrough/1",
        "type": "STRING"
      },
      "card_url": {
        "scribe_key": "card_url",
        "string_value": "https://twitter.com",
        "type": "STRING"
      },
      "choice1_label": {
        "string_value": "1111",
        "type": "STRING"
      },
      "choice2_label": {
        "string_value": "22",
        "type": "STRING"
      },
      "choice3_label": {
        "string_value": "33",
        "type": "STRING"
      },
      "choice4_label": {
        "string_value": "4444",
        "type": "STRING"
      },
      "counts_are_final": {
        "boolean_value": false,
        "type": "BOOLEAN"
      },
      "duration_minutes": {
        "string_value": "10080",
        "type": "STRING"
      },
      "end_datetime_utc": {
        "string_value": "2016-12-21T17:56:23Z",
        "type": "STRING"
      }
    },
    "card_platform": {"platform": {
      "audience": {
        "bucket": null,
        "name": "production"
      },
      "device": {
        "name": "iPhone",
        "version": "13"
      }
    }},
    "card_type_url": "http://card-type-url-is-deprecated.invalid",
    "name": "poll4choice_text_only",
    "url": "card://809094699923292160"
  },
  "conversation_id": 809094701185781760,
  "created_at": "Wed Dec 14 17:56:23 +0000 2016",
  "display_text_range": [ 0, 140],
  "entities": {
    "hashtags": [],
    "symbols": [],
    "urls": [],
    "user_mentions": []
  },
  "full_text": "--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100-------110-------120-------130-------140",
  "id": 809094701185781760,
  "id_str": "809094701185781760",
  "in_reply_to_screen_name": null,
  "in_reply_to_status_id": null,
  "in_reply_to_status_id_str": null,
  "in_reply_to_user_id": null,
  "in_reply_to_user_id_str": null,
  "is_quote_status": false,
  "possibly_sensitive": false,
  "possibly_sensitive_appealable": false,
  "source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android<\/a>",
  "supplemental_language": null,
  "truncated": false,
  "user": { /*Abbreviation*/ }
}

To get all the data

This is the case with Streaming Api

if(extended_There is a tweet){
	text = extended_tweet.full_text
	videoOrPhoto = extended_tweet.extended_entities.media
}else{
	text = text
}

This is the case with REST API

if(extended_There are entities){
	text = extended_entities.full_text;
	videoOrPhoto = extended_entities.entities.media
}else{
	text = full_text
}

I think it's like that.

Tweet after 140 characters relaxation

Specify tweet_mode = extended in REST API. Since the key name increases in streaming api, there is no need to change the request.

About getting tweets with votes

Sample API related to Twitter survey was very helpful. It is a REST API with the official client key, "include_cards "=> true," cards_platform "=>" iPhone-13 " parameters. If all the conditions are passed with and, tweet information can be obtained. In other words, it cannot be taken with the streaming api. confirmed.

Reference URL

Recommended Posts

How to get the longest information from Twitter as of 12/12/2016
How to get today's day of the week
[Java] How to get the authority of the folder
[Java] How to get the URL of the transition source
How to write Scala from the perspective of Java
[Java] How to get the maximum value of HashMap
As of April 2018 How to get Java 8 on Mac
[Android] How to get the setting language of the terminal
[Rails] How to get the contents of strong parameters
[Swift] How to get the document ID of Firebase
[Java] How to easily get the longest character string of ArrayList using stream
Get to the abbreviations from 5 examples of iterating Java lists
[IOS] How to get the table name from AWS DynamoDB
[jsoup] How to get the full amount of a document
[Rails] How to get the URL of the transition source and redirect
[Swift5] How to get an array and the complement of arrays
[Swift UI] How to get the startup status of the application [iOS]
How to get the contents of Map using for statement Memorandum
How to get the id of PRIMAY KEY auto_incremented in MyBatis
[Java] How to convert from String to Path type and get the path
How to get the length of an audio file in java
How to determine the number of parallels
[Java] How to get the current directory
How to sort the List of SelectItem
How to get the date in java
How to get the current date as a string in yyyyMMdd format
[Rails] How to get the user information currently logged in with devise
[Java] How to get to the front of a specific string using the String class
How to get the setting value (property value) from the database in Spring Framework
How to get the absolute path of a directory running in Java
How to find the cause of the Ruby error
Customize how to divide the contents of Recyclerview
How to get a heapdump from a Docker container
[swift5] How to implement the Twitter share function
How to get Class from Element in Java
Output of how to use the slice method
How to display the result of form input
How to get SIMD optimization from HotSpot JavaVM
[Java] How to get the redirected final URL
[Swift] How to get the number of elements in an array (super basic)
graphql-ruby: How to get the name of query or mutation in controller Note
How to get an arbitrary digit from a number of 2 or more digits! !!
How to get the date from the JavaScript Date type that C # developers are addicted to
From the introduction of devise to the creation of the users table
How to delete / update the list field of OneToMany
How to run the SpringBoot app as a service
[Java] How to extract the file name from the path
How to get information about associated tables in many-to-many tables
[Ruby] How to find the sum of each digit
The story of migrating from Paperclip to Active Storage
How to install the root certificate of Centos7 (Cybertrust)
[Rails] How to change the column name of the table
[SwiftUI] How to specify the abbreviated position of Text
How to determine the look-ahead request (Prefetch) from the browser
How to prevent editTextPreference of android PreferenceFragmentCompat from breaking
How to judge the click of any area of the image
How to pass image pixel information natively from Unity
How to download the old version of Apache Tomcat
[Ruby] How to get the tens place and the ones place
How to get jdk etc from oracle with cli
[Ruby] Summary of how to get values from standard input [Paiza skill check measures]