I have a Twitter API for Academic Research and would like to retrieve the media urls (images and videos) from tweets in R using the academictwitteR package. This is possible using the rtweet package. See an example below:
Using rtweet:
tweets_war_noir <- search_tweets("war_noir", n=10, parse = FALSE, include_rts=TRUE, retryonratelimit = TRUE)
twee_war_noir_picture_url <- tweets_war_noir$extended_entities$media %>% sapply(function(x) ifelse(nrow(as.data.frame(x))>0, x$media_url %>% str_subset("ext_tw_video_thumb", negate=T) %>% paste(collapse=" | "), NA))
Using academictwitteR, not quite:
tweets_war_noir <– get_all_tweets(users = "war_noir",start_tweets = "2021-01-01T00:00:00Z", end_tweets = Sys.Date() %>% paste0("T00:00:00Z"),bearer_token = get_bearer(), n = 10)
It is only possible to retrieve the media_id attribute, which I could not relate to any url. Any any suggestion on how to proceed?