R/get_form_questions.R

#' Extracts Google Form Question Text
#'
#' Extracts Google Form Question Text From Scrape
#'
#' @param scrape HTML Output from Scraping Google Form
#' @export
#' @examples
#' \dontrun{
#' url %>% get_form() %>% get_form_questions() -> questions
#' }
get_form_questions <- function (scrape) {
    qt <- gsub("\n", ""
               , rvest::html_text(
                 rvest::html_nodes(scrape
                                   , ".ss-q-title") ) )
    if (length(qt) != 0) {
        qt
    } else {
      rvest::html_text(rvest::html_nodes(scrape, ".freebirdFormviewerViewItemsItemItemTitle"))
    }
}

Try the googleformr package in your browser

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

googleformr documentation built on May 2, 2019, 11:10 a.m.