fork download
  1. library(rvest)
  2. library(dplyr)
  3. library(stringr)
  4.  
  5. url <-
  6. "https://w...content-available-to-author-only...t.nu/kategori.php?k=s426874315&catId=353&sort=price_include_shipping&direction=asc"
  7. price_watch_html <-
  8. read_html(url, encoding = "UTF-8") %>%
  9. html_nodes(".kGpEgQ")
  10. dt <-
  11. data.frame(item_name =
  12. price_watch_html %>%
  13. html_attr("aria-label"))
  14. dt$item_full_url <-
  15. paste0("https://w...content-available-to-author-only...t.nu", item_url)
  16. dt$item_price <-
  17. price_watch_html %>%
  18. html_nodes(".bhjqZq") %>%
  19. html_text() %>%
  20. gsub("kr", "", .) %>%
  21. gsub("\u00A0", "", .) %>%
  22. as.numeric
  23. for (i in 1:length(item_full_url)) {
  24. dt[i, 3:8] <-
  25. read_html(item_full_url[i], encoding = "UTF-8") %>%
  26. html_nodes(".iyOoKG") %>%
  27. html_text()
  28. }
  29. names(dt)[3:8] <-
  30. c("CPU", "Display", "RAM", "GPU", "Resolution", "Weight")
  31.  
  32. dt
  33.  
Success #stdin #stdout #stderr 0.23s 39220KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error in library(rvest) : there is no package called ‘rvest’
Execution halted