inst/shiny_apps/tweet_dashboard/global.R

embed_tweet <- function(id) {
  url <- paste0("https://publish.twitter.com/oembed?url=https://twitter.com/Interior/status/", id)
  tweet <- htmltools::HTML(jsonlite::fromJSON(url)$html)

  class(tweet) <- c("tweet", class(tweet))
  tweet
}

print.tweet <- function(x, ...) {
  htmltools::html_print(x)
  invisible(x)
}
SERTwitter/ser documentation built on June 27, 2022, 7:37 p.m.