2017-10-12 66 views
0

当某人发布只包含网址的推文时,Twitter会在抓取网页中的某些文本和图片的位置进行一些修改。Twitter API - 有没有办法从推文中检索文本和图片?

下例:

enter image description here

有来自Twitter的API获取这些数据的方法吗?我无法在返回的任何内容中找到这些数据。我需要提供一些特殊的参数吗?或者这只是不可能的事情?

回答

3

不可以。您无法从Twitter API获取该数据。

您正在查看的数据是Twitter Card

这是它的工作原理。

的Web开发人员提出了一些meta标签在他们的网页 - 看看源为https://www.nytimes.com/2017/10/04/well/move/for-your-brains-sake-keep-moving.html,你会看到:

<meta name="twitter:site" value="@nytimes" /> 
<meta property="twitter:url" content="https://www.nytimes.com/2017/10/04/well/move/for-your-brains-sake-keep-moving.html" /> 
<meta property="twitter:title" content="For Your Brain’s Sake, Keep Moving" /> 
<meta property="twitter:description" content="Exercise changes the workings of new brain cells in ways that may protect against dementia, a study in mice suggests." /> 
<meta property="twitter:image" content="https://static01.nyt.com/images/2017/10/10/well/04physed-brain-photo/04physed-brain-photo-videoSixteenByNineJumbo1600.jpg" /> 
<meta name="twitter:card" value="summary_large_image" /> 

当Twitter的看到一个URL,它提取它,并寻找那些标签。如果发现它们,它会在Twitter网站上显示一张照片和标题。

如果要检索该数据,则需要访问URL并查找OpenGraph标记。

相关问题