如何从转发中获取图像?

时间:2022-04-09 00:30:06

Hey guys I can get the images from a original tweet but from a retweet all I get is the text but not the images. Is there a way to get this?

嘿伙计们,我可以从原始推文中获取图像,但是从转发中获得的只是文本而不是图像。有没有办法得到这个?

var tweet = twt[i] //here I get the twitter posts 
console.log(tweet.text) //return the tweet text
console.log(tweet.entities.media[0].media_url) //return tweet image but only if the image is part of the original post

1 个解决方案

#1


0  

As you will see from the documentation on retweeting, the structure for retweets is slightly different from regular tweets.

正如您将在转发文档中看到的那样,转推的结构与常规推文略有不同。

The look something like:

看起来像:

tweet |_ retweeted_status |_ entities

推特| _转推_status | _实体

In your case, you will want to use something like...

在你的情况下,你会想要使用像......

console.log(tweet.retweeted_status.entities.media[0].media_url)

的console.log(tweet.retweeted_status.entities.media [0] .media_url)

#1


0  

As you will see from the documentation on retweeting, the structure for retweets is slightly different from regular tweets.

正如您将在转发文档中看到的那样,转推的结构与常规推文略有不同。

The look something like:

看起来像:

tweet |_ retweeted_status |_ entities

推特| _转推_status | _实体

In your case, you will want to use something like...

在你的情况下,你会想要使用像......

console.log(tweet.retweeted_status.entities.media[0].media_url)

的console.log(tweet.retweeted_status.entities.media [0] .media_url)