Bien entendu, utilisez la clé client officielle.
Lorsque vous obtenez les informations les plus longues contenues dans un tweet, vous devez penser au format et au vote de 140 caractères ou plus. Il existe deux façons de l'obtenir: l'API REST et l'API de streaming.
・ Obtenez des tweets de 140 caractères par REST / streaming avec du texte seul ・ Obtenez un tweet texte de 140 caractères par REST / Streaming en citant le tweet RT d'une autre personne ・ Recevez des tweets avec 140 caractères de texte avec plusieurs photos par REST / streaming ・ Obtenez un tweet de 140 caractères avec REST / streaming avec une vidéo ・ Obtenez un tweet de 140 caractères avec REST / streaming avec un gif ・ Obtenez un tweet de 140 caractères par REST / streaming avec un vote. Cependant, le vote ne peut pas être pris avec l'API de streaming. Vérifiez 11 types. Extrayez uniquement les éléments que vous jugez nécessaires de json. Le modèle lorsque vous citez RT à partir du tweet d'une autre personne comprend le cas où le tweet cité contient une vidéo, le cas où il y a une photo et le cas où le petit-enfant RT est terminé, mais cela n'est pas pris en compte.
Pour REST Api, les paramètres [" tweet_mode "=>" extended "," include_cards "=>" true "," cards_platform "=>" iPhone-13 "]
sont ajoutés. À ce moment-là, la clé de texte disparaît dans la valeur de retour et devient full_text, soyez donc prudent avec le programme récepteur. Non seulement le texte complet augmente, mais le texte disparaît.
De plus, il semble que vous puissiez ajouter du texte de "description" à l'image. http://qiita.com/riocampos/items/1f92177d359192d22566
De plus, si vous recevez un tweet qui retweete un tweet avec un vote avec l'API REST, il semble que le tweet parent a un vote, alors soyez prudent
Texte seulement + 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": { /*Abréviation*/ }
}
Citer les tweets d'autres personnes 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": "[Le tweet de N7 Fukuoka Yoshiko] Aujourd'hui, la neige s'est accumulée à Tottori et Oyama, mais après cela, il y a des endroits où la neige s'accumule le long des montagnes de l'ouest du Japon comme Kyushu. De Sanin à Kinki, la neige peut s'accumuler même sur un sol plat. https://t.co/x8Ez1P93Dj",
"truncated": false,
"user": { /*Abréviation*/ }
},
"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": { /*Abréviation*/ }
}
Plusieurs 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": { /*Abréviation*/ }
}
Une vidéo + 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": { /*Abréviation*/ }
}
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": { /*Abréviation*/ }
}
Texte seulement + 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": { /*Abréviation*/ }
}
Citer les tweets d'autres personnes 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": "[Dernières nouvelles JUST IN] Coupe du monde de club de football Kashima accède à la finale pour la première fois en Asie#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": { /*Abréviation*/ }
},
"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": { /*Abréviation*/ }
}
Plusieurs 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": { /*Abréviation*/ }
}
Une vidéo + 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": { /*Abréviation*/ }
}
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": { /*Abréviation*/ }
}
Vote+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": { /*Abréviation*/ }
}
C'est le cas avec Streaming Api
if(extended_Il y a un tweet){
text = extended_tweet.full_text
videoOrPhoto = extended_tweet.extended_entities.media
}else{
text = text
}
C'est le cas avec REST Api
if(extended_Il y a des entités){
text = extended_entities.full_text;
videoOrPhoto = extended_entities.entities.media
}else{
text = full_text
}
Je pense que c'est comme ça.
Dans l'API REST, spécifiez tweet_mode = extended
. Étant donné que le nom de la clé augmente dans l'API de streaming, il n'est pas nécessaire de modifier la demande.
Exemple d'API lié à l'enquête Twitter a été très utile.
C'est la clé client officielle, avec les paramètres " include_cards "=> true," cards_platform "=>" iPhone-13 "
, et est une API REST. Des informations sur les tweets peuvent être obtenues si toutes les conditions sont remplies avec et.
En d'autres termes, il ne peut pas être pris avec l'API de streaming. confirmé.