I Have a problem with a request in Rvest.
I acces to this link from my browser and the elements appear while scrolling:
https://www.disco.com.ar/Comprar/Home.aspx#_atCategory=false&_atGrilla=true&_id=446223
Looking the details,I found this request:
enter image description here
(link2 = "https://www.disco.com.ar/Comprar/HomeService.aspx/ObtenerArticulosPorDescripcionMarcaFamiliaLevex")
Never use a "POST" as a request before. I tried these codes but was unsuccessful.
library(rvest)
library(httr)
library(jsonlite)
url_2<-"https://www.disco.com.ar/Comprar/HomeService.aspx/ObtenerArticulosPorDescripcionMarcaFamiliaLevex"
cuerpo <- list(
IdMenu="446223",textoBusqueda="", producto="", marca="", pager="", ordenamiento=0, precioDesde="", precioHasta=""
)
page <- httr::POST(url_2,body=cuerpo,encode="form")
pagina <- content(page) %>%
html_attr("value")
r <- POST("https://www.disco.com.ar/Geolocalizacion/Geolocalizacion.aspx/GuardarLocalizacion",
content_type("application/json"),
body = toJSON(
list(
latitud = NA,
longitud = NA,
noLocalizar = TRUE
), auto_unbox = TRUE
),encode = "json")
cookieList <- cookies(r)
cookies <- cookieList$value %>% setNames(cookieList$name)
url <- "https://www.disco.com.ar/Comprar/Home.aspx#_atCategory=false&_atGrilla=true&_id=446223"
main_page <- html_session(url,set_cookies(cookies))
How can I access the following data (response) (within the link2 above)?
"{"d":"{"Tipo":[{"Filtro":"Importada","IdMenu":"0","Cantidad":"17"},{"Filtro":"Otros","IdMenu"..."
Any help is welcome. Thank you so much!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…