在 Ruby 中使用 Google 搜索 REST API [英] Using Google Search REST API in Ruby

查看:52
本文介绍了在 Ruby 中使用 Google 搜索 REST API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Ruby 进行谷歌搜索,并打印前 3 个结果.

I'm trying to do a google search using Ruby, and print the 1st 3 results.

谁能指点我一个示例代码?我找不到.

Could anyone point me to a sample code? I'm unable to find it.

推荐答案

The gem googleajax 是为了这个:

The gem googleajax is there for that:

require 'googleajax'
GoogleAjax.referer = "your_domain_name_here.com"
GoogleAjax::Search.web("Hello world")[:results][0...3]

这篇关于在 Ruby 中使用 Google 搜索 REST API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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