Original Tweet ID: 1516920635535945729 (Direct link to Twitter API v2 Playground)

Retweeted Tweet ID of Original Tweet: 1528988424505630720 (Direct link to Twitter API v2 Playground)

The original tweet contains this part:

  "includes": {
    "media": [
      {
        "type": "photo",
        "url": "https://pbs.twimg.com/media/FQ0u9sJVcAASr_R.jpg",
        "width": 1200,
        "media_key": "3_1516920286850936832",
        "height": 675
      }
    ],

But the retweeted version does not. Do I need to make an extra call to the Twitter API v2 for every (quoted) retweeted tweet to get the included media? It’s seem like a lot of extra (unnecessary?) calls to the Twitter API v2 servers.

2 Likes

I forgot I just have to make one extra call to the Twitter AP to receive the media info of max. 100 retweeted/quoted tweets. V2 Playground example. Still, it would be nice if that info was available in the first query.

And when making that one extra call for the media info, I don’t need the “data → text” field anymore, but I’m getting that field anyway.

{
  "data": [
    {
      "attachments": {
        "media_keys": [
          "3_1528708946982227973"
        ]
      },
      "id": "1528709347706011648",
      "text": "When flying is in the family! ✈️​\nAmanda and her brother Rein both work as KLM pilots and even share the same flight occasionally!​\nAnd what makes it even more special... Their father was also a KLM pilot! 👨‍✈️ 👩🏻‍✈️ #KLM #pilots #siblings https://t.co/SUcvquyTiQ"
    }
  ],
  "includes": {
    "media": [
      {
        "type": "photo",
        "url": "https://pbs.twimg.com/media/FTcQsBXWUAUclO2.jpg",
        "media_key": "3_1528708946982227973",
        "height": 1350,
        "width": 1080
      }
    ]
  }
}

It’s just one extra call when I try to retrieve the user’s (x amount of) tweets for the first time. But If I want to update their TL (of their own tweets) every x seconds I have to make an extra call to the Twitter API for every retweeted and quoted tweet they post.

And then there’s this I don’t understand:

If you look at JSON response of the original tweet this is a part of it:

        "urls": [
          {
            "start": 184,
            "end": 207,
            "url": "https://t.co/05NmwYQebg",
            "expanded_url": "https://twitterdev.bevylabs.com/events/details/twitter-london-twitter-developer-community-presents-twitterdev-connect-london-meetup/?ref=os-tw-twitter-dev-community-events&utm_source=tw&utm_medium=os&utm_campaign=twitter-dev-community-events",
            "display_url": "twitterdev.bevylabs.com/events/details…",
            "images": [
              {
                "url": "https://pbs.twimg.com/news_img/1516920660726935552/gTN7XW_v?format=jpg&name=orig",
                "width": 2160,
                "height": 2160
              },
              {
                "url": "https://pbs.twimg.com/news_img/1516920660726935552/gTN7XW_v?format=jpg&name=150x150",
                "width": 150,
                "height": 150
              }
            ],
            "status": 200,
            "title": "#TwitterDev Connect - London Meetup | Twitter",
            "description": "I'm attending Twitter London Twitter Developer Community w/ #TwitterDev Connect - London Meetup on Apr 27, 2022.",
            "unwound_url": "https://twitterdev.bevylabs.com/events/details/twitter-london-twitter-developer-community-presents-twitterdev-connect-london-meetup/?ref=os-tw-twitter-dev-community-events&utm_source=tw&utm_medium=os&utm_campaign=twitter-dev-community-events"
          },

Those links to the images (urls → image → url) don’t work.

And then there’s this too (very strange)

3 Twitter API Playground Links:

  1. CNN News Tweet
  2. MSNBC News Tweet
  3. NRC News Tweet (Dutch)

I expect in every tweet the "entities": { "urls": [ { "images": information. Twitter Web & Tweetdeck display those images. (See screenshot as example)

Now I’ve tested this a lot of times in the Twitter API Playground (GET /2/tweets), sometimes the images info isn’t in the JSON response but sometimes it is, how’s that for ‘strange’. Using the same Tweet ID.

1 Like

Those are part of the “card” which is defined on the html meta tags, and the image is in the twitter:image meta tag, those urls that don’t work are only accessible when loading a tweet when embedding it for example - they’re cached from the original site as far as i can tell. I’ve also noticed this strange behavior with that thing being there or missing sporadically. This is a separate thing to the original media question though.

It does seem like you do need that extra call:

Because the media includes are not present for the referenced tweets. I think this is something the API should change too. I think the best way to get someone from twitter to look into it is to post it as a request in GitHub - twitterdev/open-evolution: Open evolution proposals for the Twitter API

1 Like

Here they do work, as they should (imho) Twitter API Playground with this JSON response

"images": [
              {
                "url": "https://pbs.twimg.com/news_img/1529384015295299585/SocbCrYH?format=jpg&name=orig",
                "width": 1200,
                "height": 627
              },
              {
                "url": "https://pbs.twimg.com/news_img/1529384015295299585/SocbCrYH?format=jpg&name=150x150",
                "width": 150,
                "height": 150
              }
            ],

Image 1: https://pbs.twimg.com/news_img/1529384015295299585/SocbCrYH?format=jpg&name=orig

Image 2: https://pbs.twimg.com/news_img/1529384015295299585/SocbCrYH?format=jpg&name=150x150

1 Like

I hope Twitter Dev Support here finds the time to take a look at my findings before I create a GitHub issue. I can do something wrong too, I’m pretty good at that.

1 Like

For Twitter Dev Support:

In this one post I describe 1 observation:

  1. (v2) Retweeted & Quoted Tweet don’t include “includes → media” info? - Link

And two ‘bugs’ (?, at least I think they are)

  1. Urls pointing to non existing images - Link
  2. Getting different API results by just hitting F5 - Link

If you want me to split them up into separate topics, of course I’ll do that.

1 Like

UPDATE / NOTE

I’ve made a new topic about the missing properties (see ‘3.’ in previous reply) in the retweeted/quoted JSON response

1 Like

Please disregard this whole topic. It’s just too much, and I’ve made a mess of it.

I’ve created new topic for the most important issue.

1 Like