2017-07-16 129 views
0

可以使用ID显示推文吗?使用ID显示推文

例如: 从编号876126300649525249我想在我的网站上显示真实的推文。

可能吗?

+0

你想显示推文,或者你想创建一个tweet的链接? –

+0

我希望用户在我的网站上看到推文。但我想使用推文的ID向他展示推文。 –

回答

1

可以显示鸣叫,为了使用这些属性

obj.text, for the text of tweet 
obj.created_at, for the date the tweet was made 
obj.id_str , for the id of the tweet 

创建一个链接到鸣叫它的自我,你需要使用str_id属性这样 https://twitter.com/statuses/ + str_id

例如 https://twitter.com/statuses//876126300649525249

这里是解析JSON

for(var i=0; i<4; i++){ 
     var tweet_text = obj[i].text; 
     var tweet_date = obj[i].user.created_at; 
     var tweet_link = "https://twitter.com/statuses/" + obj[i].id_str;  
       } 
0

可以使用oEmbed API来检索嵌入HTML格式的鸣叫。

0

我做到了! 要打印推文,您需要屏幕名称和推文的ID。

<blockquote class="twitter-tweet" data-lang="en"> 
<a href="https://twitter.com/put the screen name here/status/put the tweet's id 
here"></a></blockquote> 
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script> 

Thaynk你都为你的回应。