I am trying to download a file from a URL using the polite
package in R. Here is the code I am using:
library(polite)
# URL of the file to download
eprice_xml_products_1 <- "https://www.eprice.it/sitemap/https/Sitemap_Elettrodomestici_1.xml.gz"
# Create a polite session
session <- bow(eprice_xml_products_1)
# Download the file using rip function
file_path <- rip(session, destfile = "xml_1.gz")
print(file_path)
I have also tried with this function:
bow(eprice_xml_products_1) %>%
nod("https://www.eprice.it/sitemap/https/Sitemap_Elettrodomestici_1.xml.gz") %>%
rip()
But I get this error:
trying URL 'https://www.eprice.it/sitemap/https/Sitemap_Elettrodomestici_1.xml.gz'
Error in fun(url = "https://www.eprice.it/sitemap/https/Sitemap_Elettrodomestici_1.xml.gz", :
cannot open URL 'https://www.eprice.it/sitemap/https/Sitemap_Elettrodomestici_1.xml.gz'
In addition: Warning messages:
1: In fun(url = "https://www.eprice.it/sitemap/https/Sitemap_Elettrodomestici_1.xml.gz", :
downloaded length 0 != reported length 334
2: In fun(url = "https://www.eprice.it/sitemap/https/Sitemap_Elettrodomestici_1.xml.gz", :
cannot open URL 'https://www.eprice.it/sitemap/https/Sitemap_Elettrodomestici_1.xml.gz': HTTP status was '403 Forbidden'
If I just open the link with my browser the download of the file starts immediately
What am I missing?