Node.jsからTwitterAPIで取得したツイートのオブジェクト


中身が気になったのでメモです。


ソースは[Node.js + Socket.io + StreamingAPIでツイートを取得してWebサイトにリアルタイム描画する](http://qiita.com/n0bisuke/items/327e10da3eac09dd6985) のtwstream.jsです。

```twstream.js
/*省略*/
twit.stream('statuses/filter', option, function(stream) {
  stream.on('data', function (data){
      console.log(data); //←ここの値を↓に展開してます。
  });
});
```

##オブジェクトとよく使いそうな値

↑の`data`の中身

###よく使いそうなもの

個人的にはツイート関連とユーザー関連とで以下のものがよく使いそうだなぁという印象です。

####ツイート関連
* `data.created_at` : 投稿日時
* `data.id` : tweetのid
* `data.text` : tweet内容
* `data.source` : シェアしたURL

####ユーザー関連
* `data.user.id` : ユーザーの論理id
* `data.user.name` : ユーザー名
* `data.user.screen_name` : ユーザーID
* `data.user.location` : ユーザーがプロフィールに掲載している現在地
* `data.user.url` : ユーザーがプロフィールに掲載しているURL
* `data.user.description` : ユーザーのプロフィール詳細

###全てのデータ

```
{ created_at: 'Thu Nov 27 09:46:09 +0000 2014',
  id: 537905205841362940,
  id_str: '537905205841362944',
  text: '勉強になる / 他1コメント http://t.co/LJSQlYG8v6 “業務で安心して使える厳選AngularJSモジュール8選＋α | 株式会社LIG” http://t.co/OJLcft8TCW',
  source: '<a href="http://www.hatena.ne.jp/guide/twitter" rel="nofollow">Hatena</a>',
  truncated: false,
  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,
  in_reply_to_screen_name: null,
  user: 
   { id: 59417367,
     id_str: '59417367',
     name: 'のびすけ/S.Ryousuke',
     screen_name: 'n0bisuke',
     location: 'I\'m at 岩手県立大学',
     url: 'http://liginc.co.jp/life/useful-info/116563',
     description: 'のびすけです。LIG inc.\nhttp://qiita.com/n0bisuke',
     protected: false,
     verified: false,
     followers_count: 1962,
     friends_count: 1781,
     listed_count: 219,
     favourites_count: 648,
     statuses_count: 64174,
     created_at: 'Thu Jul 23 10:09:04 +0000 2009',
     utc_offset: 32400,
     time_zone: 'Tokyo',
     geo_enabled: true,
     lang: 'ja',
     contributors_enabled: false,
     is_translator: false,
     profile_background_color: 'FFFFFF',
     profile_background_image_url: 'http://pbs.twimg.com/profile_background_images/537369653526687744/Jlw9IsUE.jpeg',
     profile_background_image_url_https: 'https://pbs.twimg.com/profile_background_images/537369653526687744/Jlw9IsUE.jpeg',
     profile_background_tile: false,
     profile_link_color: 'BF1238',
     profile_sidebar_border_color: 'FFFFFF',
     profile_sidebar_fill_color: 'EFEFEF',
     profile_text_color: '333333',
     profile_use_background_image: true,
     profile_image_url: 'http://pbs.twimg.com/profile_images/1182958704/9a09649f-0b54-4c57-8c91-60d76cbcabfa_normal.jpg',
     profile_image_url_https: 'https://pbs.twimg.com/profile_images/1182958704/9a09649f-0b54-4c57-8c91-60d76cbcabfa_normal.jpg',
     profile_banner_url: 'https://pbs.twimg.com/profile_banners/59417367/1411699347',
     default_profile: false,
     default_profile_image: false,
     following: null,
     follow_request_sent: null,
     notifications: null },
  geo: null,
  coordinates: null,
  place: null,
  contributors: null,
  retweet_count: 0,
  favorite_count: 0,
  entities: 
   { hashtags: [],
     trends: [],
     urls: [ [Object], [Object] ],
     user_mentions: [],
     symbols: [] },
  favorited: false,
  retweeted: false,
  possibly_sensitive: false,
  filter_level: 'medium',
  lang: 'ja',
  timestamp_ms: '1417081569525' }
emit: 1
{ created_at: 'Thu Nov 27 09:46:10 +0000 2014',
  id: 537905208500969500,
  id_str: '537905208500969473',
  text: 'RT @n0bisuke: 勉強になる / 他1コメント http://t.co/LJSQlYG8v6 “業務で安心して使える厳選AngularJSモジュール8選＋α | 株式会社LIG” http://t.co/OJLcft8TCW',
  source: '<a href="http://ameanmagazine.blogspot.com" rel="nofollow">A Mean Magazine Bot</a>',
  truncated: false,
  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,
  in_reply_to_screen_name: null,
  user: 
   { id: 2585287004,
     id_str: '2585287004',
     name: 'Mean Magazine Bot',
     screen_name: 'ameanmbot',
     location: '',
     url: 'http://www.ameanmagazine.com',
     description: 'Non curated list of relevant tweets about the MEAN stack. For a curated one visit @ameanmagazine',
     protected: false,
     verified: false,
     followers_count: 931,
     friends_count: 1,
     listed_count: 88,
     favourites_count: 93,
     statuses_count: 90849,
     created_at: 'Tue Jun 24 07:14:01 +0000 2014',
     utc_offset: null,
     time_zone: null,
     geo_enabled: false,
     lang: 'en',
     contributors_enabled: false,
     is_translator: false,
     profile_background_color: 'C0DEED',
     profile_background_image_url: 'http://abs.twimg.com/images/themes/theme1/bg.png',
     profile_background_image_url_https: 'https://abs.twimg.com/images/themes/theme1/bg.png',
     profile_background_tile: false,
     profile_link_color: '0084B4',
     profile_sidebar_border_color: 'C0DEED',
     profile_sidebar_fill_color: 'DDEEF6',
     profile_text_color: '333333',
     profile_use_background_image: true,
     profile_image_url: 'http://pbs.twimg.com/profile_images/481334978161029120/iu3zZFEk_normal.png',
     profile_image_url_https: 'https://pbs.twimg.com/profile_images/481334978161029120/iu3zZFEk_normal.png',
     profile_banner_url: 'https://pbs.twimg.com/profile_banners/2585287004/1403594236',
     default_profile: true,
     default_profile_image: false,
     following: null,
     follow_request_sent: null,
     notifications: null },
  geo: null,
  coordinates: null,
  place: null,
  contributors: null,
  retweeted_status: 
   { created_at: 'Thu Nov 27 09:46:09 +0000 2014',
     id: 537905205841362940,
     id_str: '537905205841362944',
     text: '勉強になる / 他1コメント http://t.co/LJSQlYG8v6 “業務で安心して使える厳選AngularJSモジュール8選＋α | 株式会社LIG” http://t.co/OJLcft8TCW',
     source: '<a href="http://www.hatena.ne.jp/guide/twitter" rel="nofollow">Hatena</a>',
     truncated: false,
     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,
     in_reply_to_screen_name: null,
     user: 
      { id: 59417367,
        id_str: '59417367',
        name: 'のびすけ/S.Ryousuke',
        screen_name: 'n0bisuke',
        location: 'I\'m at 岩手県立大学',
        url: 'http://liginc.co.jp/life/useful-info/116563',
        description: 'のびすけです。LIG inc.\nhttp://qiita.com/n0bisuke',
        protected: false,
        verified: false,
        followers_count: 1962,
        friends_count: 1781,
        listed_count: 219,
        favourites_count: 648,
        statuses_count: 64211,
        created_at: 'Thu Jul 23 10:09:04 +0000 2009',
        utc_offset: 32400,
        time_zone: 'Tokyo',
        geo_enabled: true,
        lang: 'ja',
        contributors_enabled: false,
        is_translator: false,
        profile_background_color: 'FFFFFF',
        profile_background_image_url: 'http://pbs.twimg.com/profile_background_images/537369653526687744/Jlw9IsUE.jpeg',
        profile_background_image_url_https: 'https://pbs.twimg.com/profile_background_images/537369653526687744/Jlw9IsUE.jpeg',
        profile_background_tile: false,
        profile_link_color: 'BF1238',
        profile_sidebar_border_color: 'FFFFFF',
        profile_sidebar_fill_color: 'EFEFEF',
        profile_text_color: '333333',
        profile_use_background_image: true,
        profile_image_url: 'http://pbs.twimg.com/profile_images/1182958704/9a09649f-0b54-4c57-8c91-60d76cbcabfa_normal.jpg',
        profile_image_url_https: 'https://pbs.twimg.com/profile_images/1182958704/9a09649f-0b54-4c57-8c91-60d76cbcabfa_normal.jpg',
        profile_banner_url: 'https://pbs.twimg.com/profile_banners/59417367/1411699347',
        default_profile: false,
        default_profile_image: false,
        following: null,
        follow_request_sent: null,
        notifications: null },
     geo: null,
     coordinates: null,
     place: null,
     contributors: null,
     retweet_count: 1,
     favorite_count: 0,
     entities: 
      { hashtags: [],
        trends: [],
        urls: [Object],
        user_mentions: [],
        symbols: [] },
     favorited: false,
     retweeted: false,
     possibly_sensitive: false,
     filter_level: 'low',
     lang: 'ja' },
  retweet_count: 0,
  favorite_count: 0,
  entities: 
   { hashtags: [],
     trends: [],
     urls: [ [Object], [Object] ],
     user_mentions: [ [Object] ],
     symbols: [] },
  favorited: false,
  retweeted: false,
  possibly_sensitive: false,
  filter_level: 'medium',
  lang: 'ja',
  timestamp_ms: '1417081570159' }
```

###ちなみにもとのツイートは
これです。 https://twitter.com/n0bisuke/status/537905205841362944

![](http://i.gyazo.com/7de8c4c155d8151b90334354941ff550.png)