Download file using R

I am trying to download a file using download.file

download.file("https://cdn.countryflags.com/download/china/flag-png-xl.png", "x.png")

But it is not working.
The file is located in https://www.countryflags.com/en/china-flag-image.html
Thanks

But when I put

https://cdn.countryflags.com/download/china/flag-png-xl.png

As a url for my webrowser, I dont get a single image, I get redirected to a page full of flags, I would guess that download.file() experiences the same

Try to open the url


and try to copy url of any flage in png or jpg and paste in the browser... it won't work

I think you are saying that you agree with me.

Yes ..... totally agree.
I am wondering if rvest package can help me... since I want to download all flags

maybe try a different service

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.