R/rt_get_comments.R

Defines functions rt_get_comments

Documented in rt_get_comments

#' extracting comments from robots.txt
#' @param txt content of the robots.txt file
#' @keywords internal
rt_get_comments <- function(txt){
  txt      <- unlist(stringr::str_split(txt, "\n"))
  clines   <- grep("#", txt)
  ccontent <- stringr::str_extract(txt[clines], "#.*")
  data.frame(line=clines, comment=ccontent, stringsAsFactors = FALSE)
}
ropenscilabs/robotstxt documentation built on Jan. 21, 2023, 7:19 p.m.