Json 从“抓取数据”;角度:回调“;网状物

Json 从“抓取数据”;角度:回调“;网状物,json,r,angular,web-crawler,Json,R,Angular,Web Crawler,我想使用R从url(“AlphaGo”&ss=fn&start=0)抓取新闻。这是我的密码: url <- "http://api.foxnews.com/v1/content/search?q=%22AlphaGo%22&fields=date,description,title,url,image,type,taxonomy&section.path=fnc&start=0&callback=angular.callbacks._0&cb=201

我想使用R从url(“AlphaGo”&ss=fn&start=0)抓取新闻。这是我的密码:

url <- "http://api.foxnews.com/v1/content/search?q=%22AlphaGo%22&fields=date,description,title,url,image,type,taxonomy&section.path=fnc&start=0&callback=angular.callbacks._0&cb=2017719162"
html <- str_c(readLines(url,encoding = "UTF-8"),collapse = "")
content_fox <- RJSONIO:: fromJSON(html)

url根据中的答案,我用两个新的代码修改了我的代码,它成功了:

url <- "http://api.foxnews.com/v1/content/search?q=%22AlphaGo%22&fields=date,description,title,url,image,type,taxonomy&section.path=fnc&start=0&callback=angular.callbacks._0&cb=2017719162"
html <- str_c(readLines(url,encoding = "UTF-8"),collapse = "")
html <- sub('[^\\{]*', '', html) # remove function name and opening parenthesis
html <- sub('\\)$', '', html) # remove closing parenthesis
content_fox <- RJSONIO:: fromJSON(html)
url