整合谷歌搜索

时间:2016-12-07 05:47:37

标签: ruby ruby-on-rails-4 ruby-on-rails-5 google-search-api

我正在尝试将google搜索结果与我的rails应用程序集成,但无法获得正确的响应。我正在关注此链接

https://github.com/wiseleyb/google_custom_search_api

这是我的代码

class UsersController < ApplicationController


  def index
      results = GoogleCustomSearchApi.search("restaurant near sector 2 noida")

        results["items"].each do |item|
            puts item["title"], item["link"]
        end
  end
end

我得到的回应是这个

Youth Thrash Restaurant Owner In Noida | Full Video - YouTube
https://www.youtube.com/watch?v=4PSKUacsmnY
Karim's Hotel Restaurant - Delhi - YouTube
https://www.youtube.com/watch?v=AKqOlthRO2w
Bikanervala Bliss Fine Dine Restaurant at Noida Sec-18 - YouTube
https://www.youtube.com/watch?v=s9J4R-sC3-w
Top 5 | Fine Dining Restaurants In Noida - YouTube
https://www.youtube.com/watch?v=DLXno_bYhRY
Dev's Bar & Restaurant, Sector-62, Noida - YouTube
https://www.youtube.com/watch?v=4KZ2pz_azFA
Noida Kids- Sector 38 McDonalds - YouTube
https://www.youtube.com/watch?v=L-JCZF1FkCc
Review of Theos, Noida | Bakery & Cake Shops Restaurants- Italian ...
https://www.youtube.com/watch?v=G1LFabXPeks
Bistro 37, Noida | Coffee Shops/Cafes /Restaurants- Continental ...
https://www.youtube.com/watch?v=7pVstxQ0EvQ
Review of Desi Vibes, Noida | Restaurants- North Indian ...
https://www.youtube.com/watch?v=ZRwJPuv8vC4
sector 62 noida
https://www.google.com/mymaps/viewer?mid=1Y_e1x5df5tCuGjKOCRzx3bXBv9w&hl=en

这给了我错误的结果。所以我有任何方式可以整合谷歌搜索,这可以给我正确的答案

我应该在google google results

中显示这些结果

0 个答案:

没有答案