ropensci / jstor

Import journal data from DfR (JSTOR)
https://docs.ropensci.org/jstor
47 stars 9 forks source link

fix CRAN errors #70

Closed tklebel closed 6 years ago

tklebel commented 6 years ago

JSTOR blocks requests made without a user agent.

Solution: set a proper user agent.

This could be a string like "jstor R package (https://ropensci.github.io/jstor/)" or a string for a browser.

The implementation is simple:

link <- "https://www.jstor.org/titlelists/journals/archive?fileFormat=xls"

journal_list <- tempfile()

handle <- curl::new_handle()
handle <- curl::handle_setheaders(handle, "User-Agent" = "Mozilla/1.22")

curl::curl_download(link, journal_list, handle = handle)

I sent a mail to the JSTOR support, waiting for their response.

tklebel commented 6 years ago

Setting the user agent as above seems to work on UNIX but not on Windows...