How to determine if a given tweet is a video?

93 views Asked by At

Let’s say I have two tweets:

  1. https://twitter.com/BuzzFeed/status/917922958307295233
  2. https://twitter.com/BuzzFeed/status/876083996026916865

I want to be able to quickly determine if the tweet contains a video. What is the best way to do that?

I’ve tried using oEmbed API, but it doesn’t give me the information I need. https://dev.twitter.com/web/embedded-timelines/oembed

2

There are 2 answers

0
byInduction On

Posting a temporary answer I have an access to the embedded html of the tweet. Thus, the first tweet example will have the embedded html of:

<blockquote class=\"twitter-tweet\" data-lang=\"en\"><a href=\"https://twitter.com/BuzzFeed/status/917922958307295233?ref_src=twsrc%5Etfw\" /></blockquote>

and second tweet example will have the embedded html of:

<blockquote class=\"twitter-video\" data-lang=\"en\"><a href=\"https://twitter.com/BuzzFeed/status/876083996026916865?ref_src=twsrc%5Etfw\" /></blockquote>

I can simply look at the blockquote class name to determine if the twitter is a video or a simple tweet.

This solution, however, will not work if you do not have access to the embedded html of the tweet, thus leaving this question still open for answers.

0
Elad Ratson On

You can use the filter:videos advanced search operator in Twitter search to filter out only tweets containing videos like from:BuzzFeed filter:videos for example. Such filter can be coupled with other filters and/or Boolean arguments to make sure you narrow the search to only the tweets you wish to verify.