I would like to save all XL png files in a website via rvest. However the image can not be opened.
library(tidyverse)
s <- html_session("https://www.countryflags.com/en/china-flag-image.html")
imgsrc <- s %>%
read_html() %>%
html_nodes(xpath = "//*/a[@href='//cdn.countryflags.com/download/china/flag-png-xl.png']") %>%
html_attr('href')
img <- jump_to(s, imgsrc)
writeBin(img$response$content, basename(imgsrc))