需要通过R访问谷歌自定义搜索api
如何使用R进行谷歌自定义搜索?我有自定义搜索引擎id和api密钥。我目前正在尝试这样做:需要通过R访问谷歌自定义搜索api,r,api,ssl,google-custom-search,R,Api,Ssl,Google Custom Search,如何使用R进行谷歌自定义搜索?我有自定义搜索引擎id和api密钥。我目前正在尝试这样做: getURL("https://www.googleapis.com/customsearch/v1?key=API_KEY&cx=ENGINE_ID&q=searchterm") 我得到以下错误: 函数中出现错误(类型,msg,asError=TRUE):SSL证书 问题:无法获取本地颁发者证书 虽然在浏览器中执行get请求时,我能够以json格式获取结果。有什么线索吗?在getURL中
getURL("https://www.googleapis.com/customsearch/v1?key=API_KEY&cx=ENGINE_ID&q=searchterm")
我得到以下错误:
函数中出现错误(类型,msg,asError=TRUE):SSL证书
问题:无法获取本地颁发者证书
虽然在浏览器中执行get请求时,我能够以json格式获取结果。有什么线索吗?在
getURL
中设置ssl.verifypeer=TRUE
getURL("https://www.googleapis.com/customsearch/v1?key=API_KEY&cx=ENGINE_ID&q=searchterm", ssl.verifypeer=TRUE)
httr包工作
library(httr)
query="https://www.googleapis.com/customsearch/v1?key=API_KEY&cx=ENGINE_ID&q=SEARCH_TERM"
content(GET(query))
当我设置ssl.verifypeer=FALSE时,它对我起了作用,这似乎更符合逻辑。帮助中没有提到该参数。