Reputation: 13
Example link: http://www.espncricinfo.com/inline/content/image/252437.html?alt=1
I tried download.file() and getURL() methods, but it didn't work.
Upvotes: 1
Views: 74
Reputation: 160437
One option:
library(httr)
img <- httr::GET("http://www.espncricinfo.com/inline/content/image/252437.html?alt=1")\
writeBin(img$content, "localfile.jpg")
You can extract the redirected filename with img$url
. In this case, you can also find mirrors for it under img$all_headers
, though that isn't necessarily always the case. Try str(img)
to see more of the response
type that GET
returns.
Upvotes: 1