Webscraping, read_html() - Error in open.connection(x, "rb") : SSL certificate problem: certificate has expired

Viewed 2160

I am currently trying to build a small webscraper.

I am using the following code to scrape a website:

webpage <- "https://www.whisky.de/shop/Schottland/Single-Malt/Macallan-Triple-Cask-15-Jahre.html"
content <- read_html(webpage)

However, when I run the second line with the read_html command, I get the following error message:

Error in open.connection(x, "rb") : SSL certificate problem: certificate has expired

Does anyone of you know where this is coming from? When I used it a few days ago, I did not have any trouble with it.

I am using Mac OS X 10.15.5, RStudio (1.2.5033) I also installed the library "rvest"

Many thanks for your help in advance!

2 Answers

I was getting the same problem for another website, but the other answer did not solve it for me. I'm posting what worked for me in case it is useful to someone else.

library(tidyverse)
library(rvest)
webpage <- "https://www.whisky.de/shop/Schottland/Single-Malt/Macallan-Triple-Cask-15-Jahre.html"
content <- webpage %>% 
  httr::GET(config = httr::config(ssl_verifypeer = FALSE)) %>% 
  read_html()  

See here for a discussion about this solution.

Try using the GET function.

webpage <- "https://www.whisky.de/shop/Schottland/Single-Malt/Macallan-Triple-Cask-15-Jahre.html"
content <- read_html(GET(webpage))

I should have mentioned the GET function is part of the httr R package. Make sure you use GET and not get.

Related