R/webscrap_artists.R

Defines functions webscrap_artists

#' webscrap_artists
#'
#' @description Funcao para montagem da tabela de artistas
#'
#' @return Um dataframe com todos os artistas, do genero gospel, encontrados no
#' portal do vagalume.
#' 
#'
#' @noRd
webscrap_artists <- function() {
  
  u <- "https://www.vagalume.com.br/browse/style/gospel.html"
  
  nodeset_artists <- rvest::read_html(u) |>
    rvest::html_elements(xpath = "//div[contains(@class, 'moreNamesContainer')]//a")
  
  names_artists <- nodeset_artists |>
    rvest::html_text()
  
  hrefs_artists <- nodeset_artists |>
    rvest::html_attr(name = "href")
  
  tibble::tibble(
    name = names_artists, href = hrefs_artists
  )
}
damarals/gospel.slides documentation built on March 19, 2022, 10:50 a.m.