#現在の問題
現在、tweepyを利用してTwitterから画像を取得するプログラムを組んでいます。
しかし、api.user_timelineで取得すると複数の画像が添付されている場合画像の情報が入っていないように思われます。
画像の情報はextended_entitiesに入っているものと思いますが、extended_entities自体が存在しないようです。
プログラムと取得の例は以下のとおりです。
#プログラム(一部)と出力
Python
1api = tweepy.API(auth) 2 3name='GirlsFrontline' #(仮) 4 5getlist = api.user_timeline(screen_name=name,count=5,include_rts=True,tweet_mode='extended') 6 7for twt in getlist: 8 try: 9 pprint(twt.extended_entities['media'][0]) 10 print(twt.full_text) 11 except: 12 pprint(dir(twt)) 13 print(twt.full_text)
と入力しますと画像が1枚のツイートは
{'display_url': 'pic.twitter.com/Ofgfy87bXu', 'expanded_url': 'https://twitter.com/fuzichoco/status/1156891274458226689/photo/1', 'id': 1156891258473684994, 'id_str': '1156891258473684994', 'indices': [75, 98], 'media_url': 'http://pbs.twimg.com/media/EA4aeFkUIAIb1WX.jpg', 'media_url_https': 'https://pbs.twimg.com/media/EA4aeFkUIAIb1WX.jpg', 'sizes': {'large': {'h': 1500, 'resize': 'fit', 'w': 1062}, 'medium': {'h': 1200, 'resize': 'fit', 'w': 850}, 'small': {'h': 680, 'resize': 'fit', 'w': 481}, 'thumb': {'h': 150, 'resize': 'crop', 'w': 150}}, 'source_status_id': 1156891274458226689, 'source_status_id_str': '1156891274458226689', 'source_user_id': 129744642, 'source_user_id_str': '129744642', 'type': 'photo', 'url': 'https://t.co/Ofgfy87bXu'} RT @fuzichoco: ドールズフロントライン一周年おめでとうございます!応援イラストとして一〇〇式さん描かせていただきましたー! #ドルフロ https://t.co/Ofgfy87bXu
のようにちゃんと取得できます。
しかし、画像が複数枚のツイートは
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_api', '_json', 'author', 'contributors', 'coordinates', 'created_at', 'destroy', 'display_text_range', 'entities', 'favorite', 'favorite_count', 'favorited', 'full_text', 'geo', 'id', 'id_str', 'in_reply_to_screen_name', 'in_reply_to_status_id', 'in_reply_to_status_id_str', 'in_reply_to_user_id', 'in_reply_to_user_id_str', 'is_quote_status', 'lang', 'parse', 'parse_list', 'place', 'possibly_sensitive', 'retweet', 'retweet_count', 'retweeted', 'retweeted_status', 'retweets', 'source', 'source_url', 'truncated', 'user'] RT @gsc_kahotan: / 指揮官、 この私にできることがあれば、 どうぞご命令を \ 【ねんどろいど スプリングフィールド】#祝ドルフロ1周年 #ドルフロ #ドールズフロントライン #goodsmile https://t.co/5Z93K0zSlT 2019年9…
のように表示されます。
自分なりに調べてはみたのですがどうしてもわかりません。
どなたかご助言いただければと思います。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。