☆☆ 新着記事 ☆☆

2019年5月10日金曜日

Tweet Status Object Structure


user_timeline( ) で取得されるのは、Status Objectを含む、Tweepy Result set。 このお蔭で

for tweet in tweets:
    tweet.created_at

の形式で、各要素にアクセスできる。
print(tweets) #<class 'tweepy.models.ResultSet'>



<Simple Tweet>
Status(_api=<tweepy.api.API object at 0x0000000003610F60>,
_json={'created_at': 'Fri May 10 11:43:30 +0000 2019', 'id': 1126815018253557760, 'id_str': '1126815018253557760',
'text': '"Don\'tworry about it! It will all work out. You know why? It always does."\n-by President Donald Trump\n\nWhat a powe… https://t.co/SyGjwvItqo',
'truncated': True,
'entities': {'hashtags': [], 'symbols': [], 'user_mentions': [], 'urls': [{'url': 'https://t.co/SyGjwvItqo', 'expanded_url':'https://twitter.com/i/web/status/1126815018253557760', 'display_url': 'twitter.com/i/web/status/1…', 'indices': [117, 140]}]}, 'source': '<a href="http://twitter.com" rel="nofollow">Twitter Web Client</a>', 'in_reply_to_status_id': None, 'in_reply_to_status_id_str': None, 'in_reply_to_user_id': None, 'in_reply_to_user_id_str': None, 'in_reply_to_screen_name': None, 'user': {'
id': 1118188831948230657, 'id_str': '1118188831948230657', 'name': 'kappamobestjp', 'screen_nam
e': 'kappamobestjp', 'location': 'United States', 'description': '', 'url': None, 'entities': {
'description': {'urls': []}}, 'protected': False, 'followers_count': 0, 'friends_count': 4, 'li
sted_count': 0, 'created_at': 'Tue Apr 16 16:26:07 +0000 2019', 'favourites_count': 1, 'utc_off
set': None, 'time_zone': None, 'geo_enabled': False, 'verified': False, 'statuses_count': 7, 'l
ang': 'en', 'contributors_enabled': False, 'is_translator': False, 'is_translation_enabled': Fa
lse, 'profile_background_color': 'F5F8FA', 'profile_background_image_url': None, 'profile_backg
round_image_url_https': None, 'profile_background_tile': False, 'profile_image_url': 'http://ab
s.twimg.com/sticky/default_profile_images/default_profile_normal.png', 'profile_image_url_https
': 'https://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png', 'profile_l
ink_color': '1DA1F2', 'profile_sidebar_border_color': 'C0DEED', 'profile_sidebar_fill_color': '
DDEEF6', 'profile_text_color': '333333', 'profile_use_background_image': True, 'has_extended_pr
ofile': False, 'default_profile': True, 'default_profile_image': True, 'following': False, 'fol
low_request_sent': False, 'notifications': False, 'translator_type': 'none'}, 'geo': None, 'coo
rdinates': None, 'place': None, 'contributors': None, 'is_quote_status': False, 'retweet_count'
: 0, 'favorite_count': 0, 'favorited': False, 'retweeted': False, 'lang': 'en'}, created_at=dat
etime.datetime(2019, 5, 10, 11, 43, 30), id=1126815018253557760, id_str='1126815018253557760',
text='"Don\'t worry about it! It will all work out. You know why? It always does."\n-by Preside
nt Donald Trump\n\nWhat a powe… https://t.co/SyGjwvItqo', truncated=True, entities={'hashtags'
: [], 'symbols': [], 'user_mentions': [], 'urls': [{'url': 'https://t.co/SyGjwvItqo', 'expanded
_url': 'https://twitter.com/i/web/status/1126815018253557760', 'display_url': 'twitter.com/i/we
b/status/1…', 'indices': [117, 140]}]}, source='Twitter Web Client', source_url='http://twitte
r.com', in_reply_to_status_id=None, in_reply_to_status_id_str=None, in_reply_to_user_id=None, i
n_reply_to_user_id_str=None, in_reply_to_screen_name=None, author=User(_api=<tweepy.api.API obj
ect at 0x0000000003610F60>, _json={'id': 1118188831948230657, 'id_str': '1118188831948230657',
'name': 'kappamobestjp', 'screen_name': 'kappamobestjp', 'location': 'United States', 'descript
ion': '', 'url': None, 'entities': {'description': {'urls': []}}, 'protected': False, 'follower
s_count': 0, 'friends_count': 4, 'listed_count': 0, 'created_at': 'Tue Apr 16 16:26:07 +0000 20
19', 'favourites_count': 1, 'utc_offset': None, 'time_zone': None, 'geo_enabled': False, 'verif
ied': False, 'statuses_count': 7, 'lang': 'en', 'contributors_enabled': False, 'is_translator':
 False, 'is_translation_enabled': False, 'profile_background_color': 'F5F8FA', 'profile_backgro
und_image_url': None, 'profile_background_image_url_https': None, 'profile_background_tile': Fa
lse, 'profile_image_url': 'http://abs.twimg.com/sticky/default_profile_images/default_profile_n
ormal.png', 'profile_image_url_https': 'https://abs.twimg.com/sticky/default_profile_images/def
ault_profile_normal.png', 'profile_link_color': '1DA1F2', 'profile_sidebar_border_color': 'C0DE
ED', 'profile_sidebar_fill_color': 'DDEEF6', 'profile_text_color': '333333', 'profile_use_backg
round_image': True, 'has_extended_profile': False, 'default_profile': True, 'default_profile_im
age': True, 'following': False, 'follow_request_sent': False, 'notifications': False, 'translat
or_type': 'none'}, id=1118188831948230657, id_str='1118188831948230657', name='kappamobestjp',
screen_name='kappamobestjp', location='United States', description='', url=None, entities={'des
cription': {'urls': []}}, protected=False, followers_count=0, friends_count=4, listed_count=0,
created_at=datetime.datetime(2019, 4, 16, 16, 26, 7), favourites_count=1, utc_offset=None, time
_zone=None, geo_enabled=False, verified=False, statuses_count=7, lang='en', contributors_enable
d=False, is_translator=False, is_translation_enabled=False, profile_background_color='F5F8FA',
profile_background_image_url=None, profile_background_image_url_https=None, profile_background_
tile=False, profile_image_url='http://abs.twimg.com/sticky/default_profile_images/default_profi
le_normal.png', profile_image_url_https='https://abs.twimg.com/sticky/default_profile_images/de
fault_profile_normal.png', profile_link_color='1DA1F2', profile_sidebar_border_color='C0DEED',
profile_sidebar_fill_color='DDEEF6', profile_text_color='333333', profile_use_background_image=
True, has_extended_profile=False, default_profile=True, default_profile_image=True, following=F
alse, follow_request_sent=False, notifications=False, translator_type='none'), user=User(_api=<
tweepy.api.API object at 0x0000000003610F60>, _json={'id': 1118188831948230657, 'id_str': '1118
188831948230657', 'name': 'kappamobestjp', 'screen_name': 'kappamobestjp', 'location': 'United
States', 'description': '', 'url': None, 'entities': {'description': {'urls': []}}, 'protected'
: False, 'followers_count': 0, 'friends_count': 4, 'listed_count': 0, 'created_at': 'Tue Apr 16
 16:26:07 +0000 2019', 'favourites_count': 1, 'utc_offset': None, 'time_zone': None, 'geo_enabl
ed': False, 'verified': False, 'statuses_count': 7, 'lang': 'en', 'contributors_enabled': False
, 'is_translator': False, 'is_translation_enabled': False, 'profile_background_color': 'F5F8FA'
, 'profile_background_image_url': None, 'profile_background_image_url_https': None, 'profile_ba
ckground_tile': False, 'profile_image_url': 'http://abs.twimg.com/sticky/default_profile_images
/default_profile_normal.png', 'profile_image_url_https': 'https://abs.twimg.com/sticky/default_
profile_images/default_profile_normal.png', 'profile_link_color': '1DA1F2', 'profile_sidebar_bo
rder_color': 'C0DEED', 'profile_sidebar_fill_color': 'DDEEF6', 'profile_text_color': '333333',
'profile_use_background_image': True, 'has_extended_profile': False, 'default_profile': True, '
default_profile_image': True, 'following': False, 'follow_request_sent': False, 'notifications'
: False, 'translator_type': 'none'}, id=1118188831948230657, id_str='1118188831948230657', name
='kappamobestjp', screen_name='kappamobestjp', location='United States', description='', url=No
ne, entities={'description': {'urls': []}}, protected=False, followers_count=0, friends_count=4
, listed_count=0, created_at=datetime.datetime(2019, 4, 16, 16, 26, 7), favourites_count=1, utc
_offset=None, time_zone=None, geo_enabled=False, verified=False, statuses_count=7, lang='en', c
ontributors_enabled=False, is_translator=False, is_translation_enabled=False, profile_backgroun
d_color='F5F8FA', profile_background_image_url=None, profile_background_image_url_https=None, p
rofile_background_tile=False, profile_image_url='http://abs.twimg.com/sticky/default_profile_im
ages/default_profile_normal.png', profile_image_url_https='https://abs.twimg.com/sticky/default
_profile_images/default_profile_normal.png', profile_link_color='1DA1F2', profile_sidebar_borde
r_color='C0DEED', profile_sidebar_fill_color='DDEEF6', profile_text_color='333333', profile_use
_background_image=True, has_extended_profile=False, default_profile=True, default_profile_image
=True, following=False, follow_request_sent=False, notifications=False, translator_type='none')
, geo=None, coordinates=None, place=None, contributors=None, is_quote_status=False, retweet_cou
nt=0, favorite_count=0, favorited=False, retweeted=False, lang='en')

◇連続投稿
(引用した方には、引用元のTweet情報がEncloseされている。
 引用元の 'in_reply_to_status_id': が紐付いている)



Status(_api=<tweepy.api.API object at 0x0000000003612F28>,
_json={'created_at': 'Fri May 10 11:12:55 +0000 2019',
  'id': 1126807322666209281, 'id_str': '1126807322666209281',
  'text': '”何があっても心配することないよ。全部、上手くいくんだから。何故か知ってる?\u3000だって、そういうも
     のだから!”\u3000記者を前に、こんな発言、いろんな意味で凄すぎる!!\n\n
     トランプ大統領のツイート分析始めました。… https://t.co/i36pmW6UHG',
  'truncated': True,
  'entities': {   'hashtags': [],
      'symbols': [],
      'user_mentions': [],
      'urls': [{'url': 'https://t.co/i36pmW6UHG',
      'expanded_url':'https://twitter.com/i/web/status/1126807322666209281',
      'display_url': 'twitter.com/i/web/status/1…',
      'indices': [104, 127]}]},
      'source': '<a href="http://twitter.com" rel="nofollow">Twitter Web Client</a>',
      'in_reply_to_status_id': 1126807319004700672,
      'in_reply_to_status_id_str':'1126807319004700672',
      'in_reply_to_user_id': 1118188831948230657,
      'in_reply_to_user_id_str': '1118188831948230657',
      'in_reply_to_screen_name': 'kappamobestjp',
      'user': {'id': 1118188831948230657,
        'id_str': '1118188831948230657',
        'name': 'kappamobestjp',
        'screen_name': 'kappamobestjp',
        'location': 'United States',
        'description': '',
        'url': None,
     'entities': {'description': {'urls': []}}, 'protected': False, 'followers_count': 0, 'friends_count': 4,
       'listed_count': 0, 'created_at': 'Tue Apr 16 16:26:07 +0000 2019', 'favourites_count': 1,
       'utc_offset': None, 'time_zone': None, 'geo_enabled': False, 'verified': False, 'statuses_count': 6, 'lang': 'en', 'contributors_enabled': False, 'is_translator': False, 'is_translation_enabled': False, 'profile_background_color': 'F5F8FA', 'profile_background_image_url': None, 'profile_background_image_url_https': None, 'profile_background_tile': False, 'profile_image_url': 'http://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png', 'profile_image_url_https': 'https://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png', 'profile_link_color': '1DA1F2', 'profile_sidebar_border_color': 'C0DEED', 'profile_sidebar_fill_color': 'DDEEF6',
       'profile_text_color': '333333', 'profile_use_background_image': True, 'has_extended_profile': False,
       'default_profile': True, 'default_profile_image': True, 'following': False, 'follow_request_sent':False, 'notifications': False, 'translator_type': 'none'}, 'geo': None, 'coordinates': None, 'place': None, 'contributors': None, 'is_quote_status': False, 'retweet_count': 0, 'favorite_count': 0, 'favorited': False, 'retweeted': False, 'possibly_sensitive': False, 'lang': 'ja'}, created_at=datetime.datetime(2019, 5, 10, 11, 12, 55), id=1126807322666209281, id_str='1126807322666209281', text='”何があっても心配することないよ。全部、上手くいくんだから。何故か知ってる?\u3000
       だって、そういうものだから!”\u3000記者を前に、こんな発言、いろんな意味で凄すぎる!!\n\n
       トランプ大統領のツイート分析始めました。… https://t.co/i36pmW6UHG', truncated=True,
       entities={'hashtags': [], 'symbols': [], 'user_mentions': [], 'urls': [{'url': 'https://t.co/i36pmW6UHG', 'expanded_url': 'https://twitter.com/i/web/status/1126807322666209281',
       'display_url': 'twitter.com/i/web/status/1…', 'indices': [104, 127]}]}, source='Twitter Web Client', source_url='http://twitter.com', in_reply_to_status_id=1126807319004700672, in_reply_to_status_id_str='1126807319004700672', in_reply_to_user_id=1118188831948230657, in_reply_to_user_id_str='1118188831948230657', in_reply_to_screen_name='kappamobestjp', author=User(_api=<tweepy.api.API object at 0x0000000003612F28>, _json={'id': 1118188831948230657, 'id_str': '1118188831948230657', 'name': 'kappamobestjp', 'screen_name': 'kappamobestjp', 'location': 'United States', 'description': '', 'url': None, 'entities': {'description': {'urls': []}}, 'protected': False, 'followers_count': 0, 'friends_count': 4, 'listed_count': 0, 'created_at': 'Tue Apr 16 16:26:07 +0000 2019', 'favourites_count': 1, 'utc_offset': None, 'time_zone': None, 'geo_enabled': False, 'verified': False, 'statuses_count': 6, 'lang': 'en', 'contributors_enabled': False, 'is_translator': False, 'is_translation_enabled': False, 'profile_background_color': 'F5F8FA', 'profile_background_image_url': None, 'profile_background_image_url_https': None, 'profile_background_tile': False, 'profile_image_url': 'http://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png',
       'profile_image_url_https': 'https://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png',
       'profile_link_color': '1DA1F2', 'profile_sidebar_border_color': 'C0DEED',
       'profile_sidebar_fill_color': 'DDEEF6', 'profile_text_color': '333333',
       'profile_use_background_image': True, 'has_extended_profile': False, 'default_profile': True, 'default_profile_image': True,'following': False, 'follow_request_sent': False, 'notifications': False, 'translator_type': 'none'}, id=1118188831948230657, id_str='1118188831948230657', name='kappamobestjp', screen_name='kappamobestjp', location='United States', description='', url=None, entities={'description': {'urls': []}}, protected=False, followers_count=0, friends_count=4, listed_count=0, created_at=datetime.datetime(2019, 4, 16, 16, 26, 7), favourites_count=1, utc_offset=None, time_zone=None,geo_enabled=False, verified=False, statuses_count=6, lang='en', contributors_enabled=False, is_translator=False, is_translation_enabled=False, profile_background_color='F5F8FA', profile_background_image_url=None, profile_background_image_url_https=None, profile_background_tile=False,profile_image_url='http://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png', profile_image_url_https='https://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png', profile_link_color='1DA1F2', profile_sidebar_border_color='C0DEED', profile_sidebar_fill_color='DDEEF6', profile_text_color='333333', profile_use_background_image=True, has_extended_profile=False, default_profile=True, default_profile_image=True, following=False,
       follow_request_sent=False, notifications=False, translator_type='none'),
       user=User(_api=<tweepy.api.API object at 0x0000000003612F28>,
       _json={'id': 1118188831948230657, 'id_str': '1118188831948230657', 'name': 'kappamobestjp', 'screen_name': 'kappamobestjp', 'location': 'United States', 'description': '', 'url': None, 'entities': {'description': {'urls': []}}, 'protected': False, 'followers_count': 0, 'friends_count': 4, 'listed_count': 0, 'created_at': 'Tue Apr 16 16:26:07 +0000 2019', 'favourites_count': 1, 'utc_offset': None, 'time_zone': None, 'geo_enabled': False,'verified': False, 'statuses_count': 6, 'lang': 'en', 'contributors_enabled': False, 'is_translator': False, 'is_translation_enabled': False, 'profile_background_color': 'F5F8FA', 'profile_background_image_url': None, 'profile_background_image_url_https': None, 'profile_background_tile': False, 'profile_image_url': 'http://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png', 'profile_image_url_https': 'https://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png', 'profile_link_color': '1DA1F2', 'profile_sidebar_border_color': 'C0DEED', 'profile_sidebar_fill_color': 'DDEEF6', 'profile_text_color': '333333', 'profile_use_background_image': True, 'has_extended_profile': False, 'default_profile': True, 'default_profile_image': True, 'following': False, 'follow_request_sent': False, 'notifications': False, 'translator_type': 'none'}, id=1118188831948230657, id_str='1118188831948230657', name='kappamobestjp', screen_name='kappamobestjp', location='United States', description='', url=None, entities={'description': {'urls': []}}, protected=False, followers_count=0, friends_count=4, listed_count=0, created_at=datetime.datetime(2019, 4, 16, 16, 26, 7), favourites_count=1, utc_offset=None, time_zone=None, geo_enabled=False, verified=False, statuses_count=6, lang='en', contributors_enabled=False, is_translator=False, is_translation_enabled=False, profile_background_color='F5F8FA', profile_background_image_url=None, profile_background_image_url_https=None, profile_background_tile=False, profile_image_url='http://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png', profile_image_url_https='https://abs.twimg.com/sticky/default_profile_images/default_profile_normal.png', profile_link_color='1DA1F2', profile_sidebar_border_color='C0DEED', profile_sidebar_fill_color='DDEEF6', profile_text_color='333333', profile_use_background_image=True, has_extended_profile=False, default_profile=True, default_profile_image=True, following=False, follow_request_sent=False, notifications=False, translator_type='none'), geo=None,coordinates=None, place=None, contributors=None, is_quote_status=False, retweet_count=0, favorite_count=0, favorited=False, retweeted=False, possibly_sensitive=False, lang='ja')

0 件のコメント:

コメントを投稿