Is there a way to get the text used as the image description of tweets? I'm using the package, which allows one to get several pieces of information about a tweet (text, links, hashtags etc) but I can't get this info.
{rtweet} allows one to post a tweet with rtweet::post_tweet and add the image descriptio through the parameter media_alt_text but I can't find this information when I download a tweet using the rtweet::get_timeline function.
reprex
library(rtweet)
# parsing the tweet data
last_tweet_parsed <- rtweet::get_timeline(user = 'esquinadobrasil',
n = 1,
parse = T)
head(last_tweet_parsed)
# not parsing the tweet data
last_tweet_unparsed <- rtweet::get_timeline(user = 'esquinadobrasil',
n = 1,
parse = F)
temp_df <- as.data.frame(last_tweet_unparsed)
head(temp_df)
Using v2 API is much more flexible and sync. with documentation.
Demo Tweet. one of tweet from
esquinadobrasilI will shows how to get image alt text.I will get
red boxtext (alt_textof image)Demo
Run & Result
Main Idea
V2 Get Tweet by ID
One of query parameter
media.fieldscan get thealt_textfrom documentation.I tested the same API by Postman.
I can get the same Result