Search code examples
pythontwittertweepy

Twitter status with image, but tweepy.API.get_status return no media


I get a weird problem with a tweet, https://twitter.com/thesebosscats/status/1277170500729356288

When I run api.get_status(1277170500729356288) on it, it returns no media. I tried using status_lookup([277170500729356288], include_entities=True) on it too, but is the same. No media

Here t is the above tweet

In [34]: t.entities                                                                                                                          
Out[34]: 
{'hashtags': [],
 'symbols': [],
 'user_mentions': [],
 'urls': [{'url': 'XXXXXX', # I remove because SO won't let me submit the question
   'expanded_url': 'https://twitter.com/i/web/status/1277170500729356288',
   'display_url': 'twitter.com/i/web/status/1…',
   'indices': [117, 140]}]}

Here is the full ._json

{'created_at': 'Sun Jun 28 09:22:30 +0000 2020',
 'id': 1277170500729356288,
 'id_str': '1277170500729356288',
 'text': "let's make a thread of black cats. i'll start by dropping my fav black cat. don't forget to drop your fav black cat… XXXXXXXX",
 'truncated': True,
 'entities': {'hashtags': [],
  'symbols': [],
  'user_mentions': [],
  'urls': [{'url': 'XXXXXX', # <- I removed because SO wont let me submit the question
    'expanded_url': 'https://twitter.com/i/web/status/1277170500729356288',
    'display_url': 'twitter.com/i/web/status/1…',
    'indices': [117, 140]}]},
 'source': '<a href="http://twitter.com/download/android" rel="nofollow">Twitter for Android</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': 1263301653953941504,
  'id_str': '1263301653953941504',
  'name': '🐈',
  'screen_name': 'thesebosscats',
  'location': '',
  'description': 'these cats will brighten up your day!',
  'url': None,
  'entities': {'description': {'urls': []}},
  'protected': False,
  'followers_count': 12808,
  'friends_count': 2,
  'listed_count': 57,
  'created_at': 'Thu May 21 02:53:00 +0000 2020',
  'favourites_count': 4,
  'utc_offset': None,
  'time_zone': None,
  'geo_enabled': False,
  'verified': False,
  'statuses_count': 606,
  'lang': None,
  '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://pbs.twimg.com/profile_images/1275120028476555264/FkixEbdt_normal.jpg',
  'profile_image_url_https': 'https://pbs.twimg.com/profile_images/1275120028476555264/FkixEbdt_normal.jpg',
  'profile_banner_url': 'https://pbs.twimg.com/profile_banners/1263301653953941504/1592847280',
  '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': False,
  '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': 496,
 'favorite_count': 1709,
 'favorited': False,
 'retweeted': False,
 'possibly_sensitive': False,
 'lang': 'en'}

Any ideas on how to get the images in this cases?

Regards,


Solution

  • The Tweet data says truncated: true. This means you need to pass tweet_mode=extended on the API call to retrieve the whole data.