TwitterAPIの仕様
user_TL取得のレスポンス
公式リファレンス: GET statuses/home_timeline
JSONの内容
?がたくさんついててあやふやですが、レスポンスの中身の意味をメモしていきます。
よかったら使ってください…
| Key | Describe | Type | Ex. |
|---|---|---|---|
| created_at | ツイート時刻 | String | 'Sun Oct 01 01:16:11 +0000 2017' |
| id | ユーザーID | Number | 915297861584421400 |
| id_str | idのtoString | String | '914297861583421440' |
| text | ツイート内容 | String | 'かぜぐすり(?) https://t.co/UfTGVbbvVQ' |
| truncated | Boolean | false | |
| entities | Object | - | |
| - hashtags | Array | [] | |
| - symbols | Array | [] | |
| - user_mentions | リプ先のユーザー名・IDなど ( 全部ではない ) | Array | [ Object, Object, ... ] |
| - urls | ツイートに含まれるURLのいろいろ | Array | [ Object, Object, ... ] |
| - media | 画像のURLとかかなあ… | Array | [Array] |
| extended_entities | Object | ||
| - media | Array | [Array] | |
| source | ツイートしたデバイス? | String ( HTMLtag ) | '<a href="http://twitter.com/download/iphone" rel="nofollow">Twitter for iPhone</a>' |
| in_reply_to_status_id | Number | null | |
| in_reply_to_status_id_str | String | null | |
| in_reply_to_user_id | Number | null | |
| in_reply_to_user_id_str | String | null | |
| in_reply_to_screen_name | String | null | |
| user | Object | - | |
| - id | 内部で管理されているID | Number | 4445069657 |
| - id_str | idのtoString | String | '4445069657' |
| - name | ユーザー名 | String | 'にーの' |
| - screen_name | 一般に言うtwitterID ( user_idではない ) | String | 'tomon9086' |
| - location | プロフィールの場所 | String | 'レポート徹夜' |
| - description | プロフィールの自己紹介 | String | 'YDKDYK' |
| - url | null | ||
| - entities | Object | [Object] | |
| - protected | 鍵垢かどうか? | Boolean | false |
| - followers_count | フォロワー数 | Number | 281 |
| - friends_count | フォロー数 | Number | 307 |
| - listed_count | 公開リストの数? | Number | 0 |
| - created_at | アカウントの作成時刻 | String | 'Fri Dec 11 05:16:53 +0000 2015' |
| - favourites_count | ユーザーのふぁぼ数 | Number | 40760 |
| - utc_offset | Number | 32400 | |
| - time_zone | ユーザーのタイムゾーン | String | 'Tokyo' |
| - geo_enabled | Boolean | true | |
| - verified | 確認済アカウントかどうか | Boolean | false |
| - statuses_count | ツイート数 | Number | 21699 |
| - lang | ユーザーの設定言語? | String | 'ja' |
| - contributors_enabled | Boolean | false | |
| - is_translator | Boolean | false | |
| - is_translation_enabled | Boolean | false | |
| - profile_background_color | String | 'F5F8FA' | |
| - profile_background_image_url | null | ||
| - profile_background_image_url_https | null | ||
| - profile_background_tile | Boolean | false | |
| - profile_image_url | String | 'http://pbs.twimg.com/profile\_images/○○○.jpg' | |
| - profile_image_url_https | String | 'https://pbs.twimg.com/profile\_images/○○○.jpg' | |
| - profile_link_color | String | '1DA1F2' | |
| - profile_sidebar_border_color | String | 'C0DEED' | |
| - profile_sidebar_fill_color | String | 'DDEEF6' | |
| - profile_text_color | String | '333333' | |
| - profile_use_background_image | Boolean | true | |
| - has_extended_profile | Boolean | false | |
| - default_profile | Boolean | true | |
| - default_profile_image | Boolean | false | |
| - following | フォローしているか ( 自分の場合はtrue ) | Boolean | true |
| - follow_request_sent | Boolean | false | |
| - notifications | Boolean | false | |
| - translator_type | String | 'none' | |
| geo | 位置情報のなにか…? | null | |
| coordinates | 位置情報の座標? | null | |
| place | 地名? | null | |
| contributors | null | ||
| is_quote_status | Boolean | false | |
| retweet_count | ツイートのRT数 | Number | 0 |
| favorite_count | ツイートのふぁぼ数 | Number | 1 |
| favorited | 自分がふぁぼしたか | Boolean | false |
| retweeted | 自分がRTしたか | Boolean | false |
| possibly_sensitive | 不適切かどうか? | Boolean | false |
| lang | ツイートの言語 | String | 'ja' |
RTの場合は、「retweeted_status」っていうオブジェクトが「contributors」と「is_quote_status」の間に増える。
retweeted_statusの中身はおそらくRT元のツイートのデータそのもの。
各種判定方法
独り言
- user_mentions.length === 0であれば独り言
リプ
- user_mentions.length > 0であればリプ
RT
- retweeted_status !== undefinedであればRT