找出导致R中503错误的原因

时间:2015-11-15 15:26:43

标签: r api rvest

我创建了一个脚本,用于收集SteamOS游戏的应用代码,然后使用API​​将这些游戏(w / info)收集到数据帧中。似乎其中一个代码导致503错误,但我怎么能找出哪一个?

library(rvest)
library(magrittr)
library(jsonlite)

#Pull steamOS games and clean it up
steam.game.urls <- fromJSON("https://raw.githubusercontent.com/SteamDatabase/SteamLinux/master/GAMES.json") %>%
            names() 

#Create a function that will download game info
steamgames <- function(gamecode){
  require(RJSONIO)
  link <- paste("http://www.steamspy.com/api.php?request=appdetails&appid=", gamecode, sep = "")
  jsonData <- fromJSON(link)
  return(jsonData)
}
vsteamgames <- Vectorize(steamgames, "gamecode", SIMPLIFY = F)

#Grab all of the info and put it into a dataframe
steamos.games <- lapply(vsteamgames(steam.game.urls), function(x) as.data.frame(t(x), stringsAsFactors = FALSE))
steamos.games.df <- rbindlist(steamos.games,fill = TRUE)

0 个答案:

没有答案