尝试从instragram中提取信息时出错

时间:2016-06-08 16:53:56

标签: r api instagram instagram-api

我一直致力于一个项目,希望在过去一年中从Instagram帖子中删除Instagram帖子和评论信息。

我现在开始使用简单的代码来从单个用户中提取信息。

以下是代码:

require(httr)
full_url <- oauth_callback()
full_url <- gsub("(.*localhost:[0-9]{1,5}/).*", x=full_url,     replacement="\1")
print(full_url)

app_name <- "Cognitive Model of the Customer"
client_id <- "b03d4a910f0442b9bd1cd79fc06a086f"
client_secret <- "c35f785784fa45cd9eaf786742ae9b3f"
scope = "basic"

instagram <- oauth_endpoint(
  authorize = "https://api.instagram.com/oauth/authorize",
  access = "https://api.instagram.com/oauth/access_token")
myapp <- oauth_app(app_name, client_id, client_secret)

ig_oauth <- oauth2.0_token(instagram, myapp,scope="basic",  type =     "application/x-www-form-urlencoded",cache=FALSE)
tmp <- strsplit(toString(names(ig_oauth$credentials)), '"')
token <- tmp[[1]][4]
library(jsonlite)
library(RCurl)
user_info <- fromJSON(getURL(paste('https://api.instagram.com/v1/users/search?  q=',"newbalance",'&access_token=',token,sep="")),unexpected.escape = "keep")

我收到的错误是

Error in simplify(obj, simplifyVector = simplifyVector, simplifyDataFrame =     simplifyDataFrame,  : 
  unused argument (unexpected.escape = "keep")

我不确定我是否理解这个错误的来源。

1 个答案:

答案 0 :(得分:0)

在运行代码之前,您应该加载必要的软件包 请加载此软件包,然后运行您的代码:
库(rjson)