So I have made code below in R for webscraping in given site - while in other sites this code works (after of course selecting the needed nodes), here it does not return anything. It seems that site itself when opening it at first does not allow to select such things even with mouse pointer. So I am wondering how to bypass this (as it happens in some other sites too).
install.packages('rvest')
install.packages('stringr')
install.packages('magrittr')
install.packages('tidyverse')
library(rvest)
library(stringr)
library(magrittr)
library(tidyverse)
#Pirmais
url_base <- "https://alkoutlet.lv/dzerieni/stiprie/rums.html?page="
l_out <- 2
urls <- paste0(url_base, seq(1, by = 1, length.out = l_out))
urls
# Helper function for parsing overview
parse_overview <- function(x){
tibble(
title = html_text(html_nodes(x, '.ProductCard-Name_isLoaded'), TRUE),
price = html_text(html_nodes(x, '.ProductCard-PriceWrapper'), TRUE),
description = html_text(html_nodes(x, '.ProductCard-ShortSpecification'), TRUE),
link = str_trim(html_attr(html_nodes(x, '.ProductCard-Name_isLoaded'), 'href'))%>%paste("https://alkoutlet.lv",.,sep=""))
}
# Scrape overview
Result <- urls %>%
map(read_html) %>%
map_df(parse_overview)
View(Result)
This is for first 2 pages from the section in the site about rum - I'm trying to scrape prices, description and name (and also link, but I am not sure if I have chosen the correct node).
Does anyone has any ideas how to make it work? It seems the site does not offer nodes to select when you open it at first, so it might be some type of prevention for this - so how can it be bypassed?