简体   繁体   English

如何确定给定的推文是否为视频?

[英]How to determine if a given tweet is a video?

Let's say I have two tweets: 假设我有两条推文:

  1. https://twitter.com/BuzzFeed/status/917922958307295233 https://twitter.com/BuzzFeed/status/917922958307295233
  2. https://twitter.com/BuzzFeed/status/876083996026916865 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. 我已经尝试过使用oEmbed API,但是它没有提供我所需的信息。 https://dev.twitter.com/web/embedded-timelines/oembed https://dev.twitter.com/web/embedded-timelines/oembed

Posting a temporary answer I have an access to the embedded html of the tweet. 发布临时答案,我可以访问该推文的嵌入式html。 Thus, the first tweet example will have the embedded html of: 因此,第一个tweet示例将具有以下内容的嵌入式html:

<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: 第二个tweet示例将嵌入以下内容的html:

<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. 我可以简单地查看blockquote类的名称来确定twitter是视频还是简单的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. 但是,如果您无权访问该推文的嵌入式html,则此解决方案将不起作用,因此,此问题仍未解决。

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 . 您可以使用filter:videos高级搜索运营商在Twitter搜索过滤出含有像视频鸣叫from:BuzzFeed filter:videos 例如 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. 此类过滤器可以与其他过滤器和/或布尔参数结合使用,以确保将搜索范围缩小到仅要验证的推文。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM