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:
{
"id": 958094354916233219,
"id_str": "958094354916233219",
"text": "\"GOP Rep. Matt Gaetz says there is a \"mosaic of evidence\" that should stop special counsel Robert Mueller's investig. https://t.co/nPF96so1cX\"",
"full_text": null,
"display_text_range": null,
"extended_tweet": null,
"favorited": false,
"favorite_count": 345,
"user": {
"name": "CNN Politics",
"status": null,
"description": "Political news, campaign stories and Washington coverage from CNN's political team.",
"created_at": "2008-02-22T19:12:49-08:00",
"location": "Washington, D.C.",
"geo_enabled": false,
"url": "https://t.co/KWFMkrEjdY",
"lang": 42,
"email": null,
"statuses_count": 111009,
"followers_count": 2584816,
"friends_count": 329,
"following": true,
"protected": false,
"verified": true,
"entities": {
"url": {
"urls": [
{
"url": "https://t.co/KWFMkrEjdY",
"display_url": "cnn.com/politics",
"expanded_url": "http://cnn.com/politics",
"indices": [ 0, 23 ]
}
]
},
"description": { "urls": [] }
},
"notifications": false,
"profile_image_url": "http://pbs.twimg.com/profile_images/918899077168934912/NrRRE0_b_normal.jpg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/918899077168934912/NrRRE0_b_normal.jpg",
"follow_request_sent": false,
"default_profile": false,
"default_profile_image": false,
"favourites_count": 10,
"listed_count": 14123,
"profile_sidebar_fill_color": "F1F5E7",
"profile_sidebar_border_color": "FFFFFF",
"profile_background_tile": true,
"profile_background_color": "100F14",
"profile_background_image_url": "http://pbs.twimg.com/profile_background_images/591311847145406464/NVCpyjyz.png",
"profile_background_image_url_https": "https://pbs.twimg.com/profile_background_images/591311847145406464/NVCpyjyz.png",
"profile_banner_url": "https://pbs.twimg.com/profile_banners/13850422/1503504077",
"profile_text_color": "000000",
"profile_link_color": "0000FF",
"profile_use_background_image": true,
"is_translator": false,
"contributors_enabled": false,
"utc_offset": -18000,
"time_zone": "Eastern Time (US & Canada)",
"withheld_in_countries": null,
"withheld_scope": null,
"Id": 13850422,
"id_str": "13850422",
"screen_name": "CNNPolitics"
},
"current_user_retweet": null,
"coordinates": null,
"entities": {
"media": null,
"urls": [
{
"url": "https://t.co/nPF96so1cX",
"display_url": "twitter.com/i/web/status/9.",
"expanded_url": "https://twitter.com/i/web/status/958094354916233219",
"indices": [ 117, 140 ]
}
],
"user_mentions": [],
"hashtags": [],
"symbols": []
},
"extended_entities": null,
"created_at": "2018-01-29T13:47:49-08:00",
"truncated": true,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"quoted_status_id": null,
"quoted_status_id_str": null,
"quoted_status": null,
"retweet_count": 198,
"retweeted": false,
"retweeted_status": null,
"possibly_sensitive": false,
"lang": 42,
"contributorsIds": null,
"contributors": null,
"source": "<a href=\"https://about.twitter.com/products/tweetdeck\" rel=\"nofollow\">TweetDeck</a>",
"place": null,
"scopes": null,
"filter_level": null,
"withheld_copyright": false,
"withheld_in_countries": null,
"withheld_scope": null
}