inst/shiny/pkg_optimizer/global.R

.random_gif <- function() {
  search_raw <- try({
    httr::GET(
      url = "http://api.giphy.com/",
      path = "/v1/gifs/trending",
      query = list(api_key = "GAUeYalixQovJJGRACGEaKRpNunOoH1q")
    )
  })

  res <- ""
  if (!inherits(search_raw, "try-error") && search_raw$status_code == 200) {
    img <- sample(httr::content(search_raw)$data, 1)[[1]]
    res <- paste0(
      '<center><img src="',
      img$images$fixed_height$url,
      '"></center>'
    )
  }
  res
}

Try the rco package in your browser

Any scripts or data that you put into this service are public.

rco documentation built on April 17, 2021, 5:06 p.m.