user agent setting

This commit is contained in:
François Briatte 2017-01-02 05:14:42 +01:00
parent db6f343a9a
commit 89b27d4d20

View File

@ -2,6 +2,7 @@ library(httr)
library(stringr) library(stringr)
f <- "check.log" f <- "check.log"
a <- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36"
if (!file.exists(f)) { if (!file.exists(f)) {
@ -59,7 +60,7 @@ sink()
for (i in l) { for (i in l) {
x <- try(GET(i) %>% x <- try(GET(i, user_agent(a)) %>%
status_code, status_code,
silent = TRUE) silent = TRUE)