从 API 获取 Twitter 卡片 [英] Get Twitter card from API

查看:31
本文介绍了从 API 获取 Twitter 卡片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将能够检索存储在 Twitter Card 中的 HTML 标记 (https://dev.twitter.com/docs/卡片).

I would be able to retrieve HTML markup of what is stored in Twitter Card (https://dev.twitter.com/docs/cards).

到目前为止,我使用 TweetSharp 库从某个用户的时间轴中检索推文.但是,这并不奇怪,因为卡片是新事物,因此不包括在内.

Up until now I used TweetSharp library to retrieve tweets from some user's timeline. But, what is not surprising, because cards are new thing, it is not included.

有谁知道,是否可以通过 API 访问卡片(Twitter 爬虫缓存的数据)?

Does anyone know, if it is possible to access card (data cached by Twitter crawler) with API?

推荐答案

Twitter 卡片本身不会通过 Twitter API 公开.

The Twitter cards themselves are not exposed through the Twitter API.

您需要做的是向提到的 URL 发出请求并检查 <head> 元素以查看其中是否包含 Twitter Card 信息.

What you'll need to do is make a request to the URL mentioned and examine the <head> element to see if they have the Twitter Card info in there.

这篇关于从 API 获取 Twitter 卡片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆