Our use case is that we can’t play videos and so we don’t want to show them. We have two HTML templates that we use to show tweets - one that shows media when the tweet doesn’t contain video and then a second that uses data-cards=“hidden” to not show any media with tweets that include video.

We’re streaming tweets in and using the tweets “media” to determine if there is a video or not. We’ve found some odd cases where the mediaType = “photo” but the “expandedUrl” contains “video” and so we know those tweets have videos too. We decide at this phase of the process which template to use. The expectation at the end of the day is that media that isn’t video should show but that any tweets that include video will show no media.

But still we have some slip through. A specific example would be tweet with id: 958094354916233219

I’d love some way while streaming the tweets in to determine that the tweet actually references a video. But somehow the above tweet ‘shadow-references’ a video. Does anyone know how I could reliably determine whether a tweet actually contains a video?

FYI, the the JSON I get from requesting details about this tweet reads:

The Tweet you’ve got here has come in via the streaming API. If I pull the same Tweet ID via the statuses/show endpoint with tweet_mode=extended, I see a slightly different set of metadata. I’m surprised to see

This is a SnappyTV / Amplify video. The video itself is not embedded in the Tweet, but it will be displayed directly as part of the Tweet. I’m fairly sure this is the only other way that a video would be served to the embedded Tweet beyond a Tweet having video or GIF directly attached, or (for example) a YouTube or other player card.

At the moment there’s no single piece of metadata or field that says “there’s a video to be displayed here”, but that’s an interesting thought that would help to clean up the situation you’re describing.

We are using the Tweetinvi library and the JSON I posted resulted from simply serializing the Tweet object provided by the library after making a GetTweet(id) request. In short, I’m not positive whether there is some post-processing going on within the library itself. We are using the latest version, 2.1.

That was from one of the REST endpoints for the simple reason that the situation occurs only rarely and I’m not aware how to get a tweet via streaming API once it has already been retrieved in that manner (and we’re not saving the raw serialized stream data).