1

I can copy every topic in this page, but when I tried to do that with a "hide content" on an expand-button this doesn't work..

Because I need to put a click button function but I don't know how to do that.

And the other question is: if I could copy that after my data.frame will become an error, because this line will be one more information..

library(rvest)
library(dplyr)

concat <- data.frame()

n_paginas <- 2

for(i in 1:n_paginas) {
url_number <- 2 - i
url1 <- paste0('https://www.qconcursos.com/questoes-de-concursos/questoes?')
p1 <- read_html(url1)

an1 = p1 %>% html_nodes(".q-question-info") %>% html_text()
di1 = p1 %>% html_nodes(".q-question-enunciation") %>% html_text()
concat <- rbind(concat, data.frame(an1,di1))

print(paste("Página:",i))
Sys.sleep(3)
}
Dave2e
  • 22,192
  • 18
  • 42
  • 50

1 Answers1

0

To my knowledge, R doesn't have any way to "click" a button on a webpage before scraping. There are more sophisticated web scraping strategies that might be able to help. See this related post: R - How to make a click on webpage using rvest or rcurl

Thomas Rosa
  • 630
  • 10
  • 21