R/get_form_questions.R

Defines functions get_form_questions

Documented in get_form_questions

#' 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 30, 2017, 2:38 a.m.