R/gist_url_to_raw.R

Defines functions gist_url_to_raw

Documented in gist_url_to_raw

#' Convert github gist url into equilvalent url for raw code
#'
#'
#' @name gist_url_to_raw
#'
#' @usage gist_url_to_raw(url)
#'
#' @param url Link to a github gist
#'
#' @return A character vector of length 1 containing url for the raw version of the github gist
#'
#' @import dplyr jsonlite xml2 stringr
#' @importFrom rvest html_nodes html_text html_attr
#'
#' @export
#'
#' @examples
#'
#' gist_url_to_raw("https://gist.github.com/korkridake/ea96f6569f5a4f9a1a552145e6151235")
#'


gist_url_to_raw <- function(url) {
    url %>% str_replace("gist.github.com", "gist.githubusercontent.com") %>% paste0(., "/raw/")
  }

Try the rawr package in your browser

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

rawr documentation built on May 17, 2021, 5:07 p.m.