需要通过R访问Google自定义搜索API [英] Need to access Google Custom search api through R

查看:97
本文介绍了需要通过R访问Google自定义搜索API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用R进行Google自定义搜索?我有自定义搜索引擎ID和api键.我目前正在尝试这样做:

How do I use R to do a Google Custom search? I have the custom search engine id and the api key. I currently try to do this:

getURL("https://www.googleapis.com/customsearch/v1?key=API_KEY&cx=ENGINE_ID&q=searchterm")

,我收到以下错误消息:

and I get the following error:

函数错误(类型,msg,asError = TRUE):SSL证书 问题:无法获得本地发行者证书

Error in function (type, msg, asError = TRUE) : SSL certificate problem: unable to get local issuer certificate

尽管当我在浏览器中执行获取请求时,我能够在json中获取结果.有什么线索吗?

Though I am able to get the results in json when I do a get request in the browser. Any clue on whats happening?

推荐答案

httr包成功了!

library(httr)
query="https://www.googleapis.com/customsearch/v1?key=API_KEY&cx=ENGINE_ID&q=SEARCH_TERM"
content(GET(query))

这篇关于需要通过R访问Google自定义搜索API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆