我正在从 NBA.com API 中抓取一些投篮数据。我使用的网址是
url = "stats.nba.com/stats/shotchartdetail?CFID=33&CFPARAMS=2017-18&ContextFilter=&ContextMeasure=FGA&DateFrom=&DateTo=&GameID=&GameSegment=&LastNGames=0&LeagueID=00&Location=&MeasureType=Base&Month=0&OpponentTeamID=0&Outcome=&PaceAdjust=N&PerMode=PerGame&Period=0&PlayerID=101107&PlusMinus=N&PlayerPosition=&Rank=N&RookieYear=&Season=2017-18&SeasonSegment=&SeasonType=Regular%20Season&TeamID=0&VsConference=&VsDivision="
通过复制并粘贴到您的浏览器中,可以轻松验证该网站是否存在。但是,当我进入该行
data = rjson::fromJSON(file = url)
我收到错误:文件中的错误(con,“r”):无法打开连接... HTTP 状态为“403 Forbidden”。
我尝试将 http 和 https 添加到 url 但无济于事。为什么 R 不读取这个明显存在的 url?