google_search_results 1.3.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/google_search_results.rb +11 -39
- data/lib/search/baidu_search.rb +33 -0
- data/lib/{bing_search_results.rb → search/bing_search.rb} +7 -7
- data/lib/search/duckduckgo_search.rb +29 -0
- data/lib/{ebay_search_results.rb → search/ebay_search.rb} +8 -8
- data/lib/search/google_search.rb +39 -0
- data/lib/search/homedepot_search.rb +33 -0
- data/lib/{serp_api_client.rb → search/serp_api_search.rb} +26 -17
- data/lib/search/walmart_search.rb +33 -0
- data/lib/{yahoo_search_results.rb → search/yahoo_search.rb} +8 -8
- data/lib/{yandex_search_results.rb → search/yandex_search.rb} +8 -8
- data/lib/search/youtube_search.rb +29 -0
- metadata +16 -11
- data/lib/baidu_search_results.rb +0 -33
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c9850029f90956175395320f506e034bf6373397954c31452cef7e4fbe56d46d
|
|
4
|
+
data.tar.gz: '082c1dc59ab2526df21009b2bf127378c76039c828a7bee459b8efd1f8e9c58b'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 810293f9210d09d120d50123cf593d42c958204beb7154922f839ca217dd8d093518401fd59a1842f06e6e67b5e18b9cc16984b2df6bdd0d43a4f98508304cfa
|
|
7
|
+
data.tar.gz: e2aedc34c37f8b4779651e475c3b21011680d783686557bb562bdb546b98bf074f31256933aad066e21ce78988696bade30630e4690290e494e0d3dc291d2634
|
|
@@ -1,39 +1,11 @@
|
|
|
1
|
-
require_relative '
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
# device: device,
|
|
13
|
-
# hl: "Google UI Language",
|
|
14
|
-
# gl: "Google Country",
|
|
15
|
-
# safe: "Safe Search Flag",
|
|
16
|
-
# num: "Number of Results",
|
|
17
|
-
# start: "Pagination Offset",
|
|
18
|
-
# tbm: "to be matched field",
|
|
19
|
-
# tbs: "to be searched field",
|
|
20
|
-
# api_key: "Your SERP API Key"
|
|
21
|
-
# }
|
|
22
|
-
#
|
|
23
|
-
# client = GoogleSearchResults.new(parameter)
|
|
24
|
-
# client.params[:location] = "Portland"
|
|
25
|
-
#
|
|
26
|
-
# html_results = client.get_html
|
|
27
|
-
# hash_results = client.get_hash
|
|
28
|
-
# json_results = client.get_json
|
|
29
|
-
# ```
|
|
30
|
-
#
|
|
31
|
-
# doc: https://serpapi.com/search-api
|
|
32
|
-
class GoogleSearchResults < SerpApiClient
|
|
33
|
-
|
|
34
|
-
def initialize(params = {})
|
|
35
|
-
super(params, GOOGLE_ENGINE)
|
|
36
|
-
check_params([:q, :engine])
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
end
|
|
1
|
+
require_relative 'search/serp_api_search.rb'
|
|
2
|
+
require_relative 'search/baidu_search.rb'
|
|
3
|
+
require_relative 'search/bing_search.rb'
|
|
4
|
+
require_relative 'search/ebay_search.rb'
|
|
5
|
+
require_relative 'search/google_search.rb'
|
|
6
|
+
require_relative 'search/yahoo_search.rb'
|
|
7
|
+
require_relative 'search/yandex_search.rb'
|
|
8
|
+
require_relative 'search/youtube_search.rb'
|
|
9
|
+
require_relative 'search/walmart_search.rb'
|
|
10
|
+
require_relative 'search/duckduckgo_search.rb'
|
|
11
|
+
require_relative 'search/homedepot_search.rb'
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require_relative 'serp_api_search'
|
|
2
|
+
|
|
3
|
+
# Baidu Search Result for Ruby powered by SerpApi
|
|
4
|
+
#
|
|
5
|
+
# Search API Usage
|
|
6
|
+
#
|
|
7
|
+
# ```ruby
|
|
8
|
+
# parameter = {
|
|
9
|
+
# q: "query",
|
|
10
|
+
# api_key: "Serp API Key"
|
|
11
|
+
# }
|
|
12
|
+
#
|
|
13
|
+
# search = BaiduSearch.new(parameter)
|
|
14
|
+
#
|
|
15
|
+
# html_results = search.get_html
|
|
16
|
+
# hash_results = search.get_hash
|
|
17
|
+
# json_results = search.get_json
|
|
18
|
+
#
|
|
19
|
+
# ```
|
|
20
|
+
# doc: https://serpapi.com/baidu-search-api
|
|
21
|
+
|
|
22
|
+
class BaiduSearch < SerpApiSearch
|
|
23
|
+
|
|
24
|
+
def initialize(params = {})
|
|
25
|
+
super(params, BAIDU_ENGINE)
|
|
26
|
+
check_params([:q, :engine])
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def get_location
|
|
30
|
+
raise SerpApiException.new('location is not supported by Baidu')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require_relative '
|
|
1
|
+
require_relative 'serp_api_search'
|
|
2
2
|
|
|
3
3
|
# Bing Search Result for Ruby powered by SerpApi
|
|
4
4
|
#
|
|
@@ -11,18 +11,18 @@ require_relative '../lib/bing_search_results'
|
|
|
11
11
|
# api_key: "Your SERP API Key"
|
|
12
12
|
# }
|
|
13
13
|
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
14
|
+
# search = BingSearch.new(parameter)
|
|
15
|
+
# search.params[:location] = "Portland"
|
|
16
16
|
#
|
|
17
|
-
# html_results =
|
|
18
|
-
# hash_results =
|
|
19
|
-
# json_results =
|
|
17
|
+
# html_results = search.get_html
|
|
18
|
+
# hash_results = search.get_hash
|
|
19
|
+
# json_results = search.get_json
|
|
20
20
|
#
|
|
21
21
|
# ```
|
|
22
22
|
#
|
|
23
23
|
# doc: https://serpapi.com/bing-search-api
|
|
24
24
|
|
|
25
|
-
class
|
|
25
|
+
class BingSearch < SerpApiSearch
|
|
26
26
|
|
|
27
27
|
def initialize(params = {})
|
|
28
28
|
super(params, BING_ENGINE)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require_relative 'serp_api_search'
|
|
2
|
+
|
|
3
|
+
# Duckduckgo Search Result for Ruby powered by SerpApi
|
|
4
|
+
#
|
|
5
|
+
# Search API Usage
|
|
6
|
+
#
|
|
7
|
+
# ```ruby
|
|
8
|
+
# parameter = {
|
|
9
|
+
# search_query: "query",
|
|
10
|
+
# api_key: "Serp API Key"
|
|
11
|
+
# }
|
|
12
|
+
#
|
|
13
|
+
# search = DuckduckgoSearch.new(parameter)
|
|
14
|
+
#
|
|
15
|
+
# html_results = search.get_html
|
|
16
|
+
# hash_results = search.get_hash
|
|
17
|
+
# json_results = search.get_json
|
|
18
|
+
#
|
|
19
|
+
# ```
|
|
20
|
+
# doc: https://serpapi.com/Duckduckgo-search-api
|
|
21
|
+
|
|
22
|
+
class DuckduckgoSearch < SerpApiSearch
|
|
23
|
+
|
|
24
|
+
def initialize(params = {})
|
|
25
|
+
super(params, DUCKDUCKGO_ENGINE)
|
|
26
|
+
check_params([:q, :engine])
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require_relative '
|
|
1
|
+
require_relative 'serp_api_search'
|
|
2
2
|
|
|
3
3
|
# Ebay Search Result for Ruby powered by SerpApi
|
|
4
4
|
#
|
|
@@ -10,18 +10,18 @@ require_relative 'serp_api_client'
|
|
|
10
10
|
# api_key: "Your SERP API Key"
|
|
11
11
|
# }
|
|
12
12
|
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
13
|
+
# search = EbaySearch.new(parameter)
|
|
14
|
+
# search.params[:ebay_domain] = "ebay.com"
|
|
15
15
|
#
|
|
16
|
-
# html_results =
|
|
17
|
-
# hash_results =
|
|
18
|
-
# json_results =
|
|
16
|
+
# html_results = search.get_html
|
|
17
|
+
# hash_results = search.get_hash
|
|
18
|
+
# json_results = search.get_json
|
|
19
19
|
#
|
|
20
20
|
# ```
|
|
21
21
|
#
|
|
22
22
|
# doc: https://serpapi.com/ebay-search-api
|
|
23
23
|
|
|
24
|
-
class
|
|
24
|
+
class EbaySearch < SerpApiSearch
|
|
25
25
|
|
|
26
26
|
def initialize(params = {})
|
|
27
27
|
super(params, EBAY_ENGINE)
|
|
@@ -29,7 +29,7 @@ class EbaySearchResults < SerpApiClient
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def get_location
|
|
32
|
-
raise 'location is not supported by ' + EBAY_ENGINE
|
|
32
|
+
raise SerpApiException.new('location is not supported by ' + EBAY_ENGINE)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require_relative 'serp_api_search'
|
|
2
|
+
|
|
3
|
+
# Google Search Result for Ruby powered by SerpApi
|
|
4
|
+
#
|
|
5
|
+
# Search API Usage
|
|
6
|
+
#
|
|
7
|
+
# ```ruby
|
|
8
|
+
# parameter = {
|
|
9
|
+
# q: "query",
|
|
10
|
+
# google_domain: "Google Domain",
|
|
11
|
+
# location: "Location Requested",
|
|
12
|
+
# device: device,
|
|
13
|
+
# hl: "Google UI Language",
|
|
14
|
+
# gl: "Google Country",
|
|
15
|
+
# safe: "Safe Search Flag",
|
|
16
|
+
# num: "Number of Results",
|
|
17
|
+
# start: "Pagination Offset",
|
|
18
|
+
# tbm: "to be matched field",
|
|
19
|
+
# tbs: "to be searched field",
|
|
20
|
+
# api_key: "Your SERP API Key"
|
|
21
|
+
# }
|
|
22
|
+
#
|
|
23
|
+
# search = GoogleSearch.new(parameter)
|
|
24
|
+
# search.params[:location] = "Portland"
|
|
25
|
+
#
|
|
26
|
+
# html_results = search.get_html
|
|
27
|
+
# hash_results = search.get_hash
|
|
28
|
+
# json_results = search.get_json
|
|
29
|
+
# ```
|
|
30
|
+
#
|
|
31
|
+
# doc: https://serpapi.com/search-api
|
|
32
|
+
class GoogleSearch < SerpApiSearch
|
|
33
|
+
|
|
34
|
+
def initialize(params = {})
|
|
35
|
+
super(params, GOOGLE_ENGINE)
|
|
36
|
+
check_params([:q, :engine])
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require_relative 'serp_api_search'
|
|
2
|
+
|
|
3
|
+
# Homedepot Search Result for Ruby powered by SerpApi
|
|
4
|
+
#
|
|
5
|
+
# Search API Usage
|
|
6
|
+
#
|
|
7
|
+
# ```ruby
|
|
8
|
+
# parameter = {
|
|
9
|
+
# search_query: "query",
|
|
10
|
+
# api_key: "Serp API Key"
|
|
11
|
+
# }
|
|
12
|
+
#
|
|
13
|
+
# search = HomedepotSearch.new(parameter)
|
|
14
|
+
#
|
|
15
|
+
# html_results = search.get_html
|
|
16
|
+
# hash_results = search.get_hash
|
|
17
|
+
# json_results = search.get_json
|
|
18
|
+
#
|
|
19
|
+
# ```
|
|
20
|
+
# doc: https://serpapi.com/Homedepot-search-api
|
|
21
|
+
|
|
22
|
+
class HomedepotSearch < SerpApiSearch
|
|
23
|
+
|
|
24
|
+
def initialize(params = {})
|
|
25
|
+
super(params, HOMEDEPOT_ENGINE)
|
|
26
|
+
check_params([:q, :engine])
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def get_location
|
|
30
|
+
raise SerpApiException.new('location is not supported by Homedepot')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
@@ -7,14 +7,16 @@ BING_ENGINE = 'bing'
|
|
|
7
7
|
YAHOO_ENGINE = 'yahoo'
|
|
8
8
|
YANDEX_ENGINE = 'yandex'
|
|
9
9
|
EBAY_ENGINE = 'ebay'
|
|
10
|
+
YOUTUBE_ENGINE = 'youtube'
|
|
11
|
+
DUCKDUCKGO_ENGINE = 'duckduckgo'
|
|
12
|
+
WALMART_ENGINE = 'walmart'
|
|
13
|
+
HOMEDEPOT_ENGINE = 'home_depot'
|
|
10
14
|
|
|
15
|
+
# Generic HTTP client for serpapi.com
|
|
16
|
+
#
|
|
17
|
+
class SerpApiSearch
|
|
11
18
|
|
|
12
|
-
|
|
13
|
-
# which allow to custom cutting edge search service
|
|
14
|
-
# by setting the engine paremeter.
|
|
15
|
-
class SerpApiClient
|
|
16
|
-
|
|
17
|
-
VERSION = "1.3.0"
|
|
19
|
+
VERSION = "2.1.0"
|
|
18
20
|
BACKEND = "serpapi.com"
|
|
19
21
|
|
|
20
22
|
attr_accessor :params
|
|
@@ -25,16 +27,17 @@ class SerpApiClient
|
|
|
25
27
|
# ---
|
|
26
28
|
#
|
|
27
29
|
# ```ruby
|
|
28
|
-
# require '
|
|
29
|
-
#
|
|
30
|
-
# result =
|
|
30
|
+
# require 'google_search'
|
|
31
|
+
# search = SerpApiSearch.new({q: "coffee", api_key: "secure API key", engine: "google"})
|
|
32
|
+
# result = search.get_json
|
|
31
33
|
# ```
|
|
32
34
|
#
|
|
33
35
|
# @param [Hash] params contains requested parameter
|
|
34
|
-
# @param [String] engine google|baidu|google|bing|ebay|yandex
|
|
35
|
-
def initialize(params, engine)
|
|
36
|
+
# @param [String] engine google|baidu|google|bing|ebay|yandex (optional or can be set in params)
|
|
37
|
+
def initialize(params, engine = nil)
|
|
36
38
|
@params = params
|
|
37
39
|
@params[:engine] ||= engine
|
|
40
|
+
raise SerpApiException.new('engine must be defined in params or a second argument') if @params[:engine].nil?
|
|
38
41
|
end
|
|
39
42
|
|
|
40
43
|
# get_json
|
|
@@ -78,7 +81,7 @@ class SerpApiClient
|
|
|
78
81
|
|
|
79
82
|
# Retrieve search result from the Search Archive API
|
|
80
83
|
def get_search_archive(search_id, format = 'json')
|
|
81
|
-
raise 'format must be json or html' if format !~ /^(html|json)$/
|
|
84
|
+
raise SerpApiException.new('format must be json or html') if format !~ /^(html|json)$/
|
|
82
85
|
as_json(get_results("/searches/#{search_id}.#{format}"))
|
|
83
86
|
end
|
|
84
87
|
|
|
@@ -117,7 +120,7 @@ class SerpApiClient
|
|
|
117
120
|
$serp_api_key = api_key
|
|
118
121
|
end
|
|
119
122
|
|
|
120
|
-
# @return [String] api_key for this
|
|
123
|
+
# @return [String] api_key for this search
|
|
121
124
|
def api_key
|
|
122
125
|
@params[:api_key] || @params[:serp_api_key] || $serp_api_key
|
|
123
126
|
end
|
|
@@ -131,7 +134,7 @@ class SerpApiClient
|
|
|
131
134
|
def get_results(path)
|
|
132
135
|
begin
|
|
133
136
|
url = construct_url(path)
|
|
134
|
-
URI
|
|
137
|
+
URI(url).open(read_timeout: 600).read
|
|
135
138
|
rescue OpenURI::HTTPError => e
|
|
136
139
|
if error = JSON.load(e.io.read)["error"]
|
|
137
140
|
puts "server returns error for url: #{url}"
|
|
@@ -149,7 +152,7 @@ class SerpApiClient
|
|
|
149
152
|
def check_params(keys = [])
|
|
150
153
|
return if @params.keys == [:engine]
|
|
151
154
|
|
|
152
|
-
raise 'keys must be a list of String or Symbol' unless keys.class == Array
|
|
155
|
+
raise SerpApiException.new('keys must be a list of String or Symbol') unless keys.class == Array
|
|
153
156
|
missing = []
|
|
154
157
|
keys.each do |key|
|
|
155
158
|
case key.class.to_s
|
|
@@ -166,13 +169,19 @@ class SerpApiClient
|
|
|
166
169
|
end
|
|
167
170
|
end
|
|
168
171
|
else
|
|
169
|
-
raise 'keys must contains Symbol or String'
|
|
172
|
+
raise SerpApiException.new('keys must contains Symbol or String')
|
|
170
173
|
end
|
|
171
174
|
end
|
|
172
175
|
if !missing.empty?
|
|
173
|
-
raise "missing required keys in params.\n #{missing.join(',')}"
|
|
176
|
+
raise SerpApiException.new("missing required keys in params.\n #{missing.join(',')}")
|
|
174
177
|
end
|
|
175
178
|
end
|
|
176
179
|
|
|
177
180
|
end
|
|
178
181
|
|
|
182
|
+
# Standard SerpApiException for anything related to the client
|
|
183
|
+
class SerpApiException < StandardError
|
|
184
|
+
def initialize(message)
|
|
185
|
+
super(message)
|
|
186
|
+
end
|
|
187
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require_relative 'serp_api_search'
|
|
2
|
+
|
|
3
|
+
# Walmart Search Result for Ruby powered by SerpApi
|
|
4
|
+
#
|
|
5
|
+
# Search API Usage
|
|
6
|
+
#
|
|
7
|
+
# ```ruby
|
|
8
|
+
# parameter = {
|
|
9
|
+
# query: "search keywords",
|
|
10
|
+
# api_key: "Serp API Key"
|
|
11
|
+
# }
|
|
12
|
+
#
|
|
13
|
+
# search = WalmartSearch.new(parameter)
|
|
14
|
+
#
|
|
15
|
+
# html_results = search.get_html
|
|
16
|
+
# hash_results = search.get_hash
|
|
17
|
+
# json_results = search.get_json
|
|
18
|
+
#
|
|
19
|
+
# ```
|
|
20
|
+
# doc: https://serpapi.com/youtube-search-api
|
|
21
|
+
|
|
22
|
+
class WalmartSearch < SerpApiSearch
|
|
23
|
+
|
|
24
|
+
def initialize(params = {})
|
|
25
|
+
super(params, WALMART_ENGINE)
|
|
26
|
+
check_params([:query, :engine])
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def get_location
|
|
30
|
+
raise SerpApiException.new('location is not supported by Walmart')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require_relative '
|
|
1
|
+
require_relative 'serp_api_search'
|
|
2
2
|
|
|
3
3
|
# Yahoo Search Result for Ruby powered by SerpApi
|
|
4
4
|
#
|
|
@@ -10,18 +10,18 @@ require_relative 'serp_api_client'
|
|
|
10
10
|
# api_key: "Your SERP API Key"
|
|
11
11
|
# }
|
|
12
12
|
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
13
|
+
# search = YahooSearch.new(parameter)
|
|
14
|
+
# search.params[:yahoo_domain] = "fr"
|
|
15
15
|
#
|
|
16
|
-
# html_results =
|
|
17
|
-
# hash_results =
|
|
18
|
-
# json_results =
|
|
16
|
+
# html_results = search.get_html
|
|
17
|
+
# hash_results = search.get_hash
|
|
18
|
+
# json_results = search.get_json
|
|
19
19
|
#
|
|
20
20
|
# ```
|
|
21
21
|
#
|
|
22
22
|
# doc: https://serpapi.com/yahoo-search-api
|
|
23
23
|
|
|
24
|
-
class
|
|
24
|
+
class YahooSearch < SerpApiSearch
|
|
25
25
|
|
|
26
26
|
def initialize(params = {})
|
|
27
27
|
super(params, YAHOO_ENGINE)
|
|
@@ -29,7 +29,7 @@ class YahooSearchResults < SerpApiClient
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def get_location
|
|
32
|
-
raise 'location is not supported by ' + YAHOO_ENGINE
|
|
32
|
+
raise SerpApiException.new('location is not supported by ' + YAHOO_ENGINE)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require_relative '
|
|
1
|
+
require_relative 'serp_api_search'
|
|
2
2
|
|
|
3
3
|
# Yandex Search Result for Ruby powered by SerpApi
|
|
4
4
|
#
|
|
@@ -10,18 +10,18 @@ require_relative 'serp_api_client'
|
|
|
10
10
|
# api_key: "Your SERP API Key"
|
|
11
11
|
# }
|
|
12
12
|
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
13
|
+
# search = YandexSearch.new(parameter)
|
|
14
|
+
# search.params[:yandex_domain] = "yandex.com"
|
|
15
15
|
#
|
|
16
|
-
# html_results =
|
|
17
|
-
# hash_results =
|
|
18
|
-
# json_results =
|
|
16
|
+
# html_results = search.get_html
|
|
17
|
+
# hash_results = search.get_hash
|
|
18
|
+
# json_results = search.get_json
|
|
19
19
|
#
|
|
20
20
|
# ```
|
|
21
21
|
#
|
|
22
22
|
# doc: https://serpapi.com/yandex-search-api
|
|
23
23
|
|
|
24
|
-
class
|
|
24
|
+
class YandexSearch < SerpApiSearch
|
|
25
25
|
|
|
26
26
|
def initialize(params = {})
|
|
27
27
|
super(params, YANDEX_ENGINE)
|
|
@@ -29,7 +29,7 @@ class YandexSearchResults < SerpApiClient
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def get_location
|
|
32
|
-
raise 'location is not supported by ' + YAHOO_ENGINE
|
|
32
|
+
raise SerpApiException.new('location is not supported by ' + YAHOO_ENGINE)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require_relative 'serp_api_search'
|
|
2
|
+
|
|
3
|
+
# Youtube Search Result for Ruby powered by SerpApi
|
|
4
|
+
#
|
|
5
|
+
# Search API Usage
|
|
6
|
+
#
|
|
7
|
+
# ```ruby
|
|
8
|
+
# parameter = {
|
|
9
|
+
# search_query: "query",
|
|
10
|
+
# api_key: "Serp API Key"
|
|
11
|
+
# }
|
|
12
|
+
#
|
|
13
|
+
# search = YoutubeSearch.new(parameter)
|
|
14
|
+
#
|
|
15
|
+
# html_results = search.get_html
|
|
16
|
+
# hash_results = search.get_hash
|
|
17
|
+
# json_results = search.get_json
|
|
18
|
+
#
|
|
19
|
+
# ```
|
|
20
|
+
# doc: https://serpapi.com/youtube-search-api
|
|
21
|
+
|
|
22
|
+
class YoutubeSearch < SerpApiSearch
|
|
23
|
+
|
|
24
|
+
def initialize(params = {})
|
|
25
|
+
super(params, YOUTUBE_ENGINE)
|
|
26
|
+
check_params([:search_query, :engine])
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: google_search_results
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- hartator
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2021-10-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rake
|
|
@@ -59,14 +59,14 @@ dependencies:
|
|
|
59
59
|
requirements:
|
|
60
60
|
- - "~>"
|
|
61
61
|
- !ruby/object:Gem::Version
|
|
62
|
-
version: 0.
|
|
62
|
+
version: 0.49.1
|
|
63
63
|
type: :development
|
|
64
64
|
prerelease: false
|
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
|
66
66
|
requirements:
|
|
67
67
|
- - "~>"
|
|
68
68
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: 0.
|
|
69
|
+
version: 0.49.1
|
|
70
70
|
description: Scape localized search results from search engine using SerpApi.com and
|
|
71
71
|
returns Hash, JSON, raw HTML
|
|
72
72
|
email: hartator@gmail.com
|
|
@@ -74,13 +74,18 @@ executables: []
|
|
|
74
74
|
extensions: []
|
|
75
75
|
extra_rdoc_files: []
|
|
76
76
|
files:
|
|
77
|
-
- lib/baidu_search_results.rb
|
|
78
|
-
- lib/bing_search_results.rb
|
|
79
|
-
- lib/ebay_search_results.rb
|
|
80
77
|
- lib/google_search_results.rb
|
|
81
|
-
- lib/
|
|
82
|
-
- lib/
|
|
83
|
-
- lib/
|
|
78
|
+
- lib/search/baidu_search.rb
|
|
79
|
+
- lib/search/bing_search.rb
|
|
80
|
+
- lib/search/duckduckgo_search.rb
|
|
81
|
+
- lib/search/ebay_search.rb
|
|
82
|
+
- lib/search/google_search.rb
|
|
83
|
+
- lib/search/homedepot_search.rb
|
|
84
|
+
- lib/search/serp_api_search.rb
|
|
85
|
+
- lib/search/walmart_search.rb
|
|
86
|
+
- lib/search/yahoo_search.rb
|
|
87
|
+
- lib/search/yandex_search.rb
|
|
88
|
+
- lib/search/youtube_search.rb
|
|
84
89
|
homepage: https://github.com/serpapi/google-search-results-ruby
|
|
85
90
|
licenses:
|
|
86
91
|
- MIT
|
|
@@ -101,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
101
106
|
- !ruby/object:Gem::Version
|
|
102
107
|
version: '0'
|
|
103
108
|
requirements: []
|
|
104
|
-
rubygems_version: 3.
|
|
109
|
+
rubygems_version: 3.0.3
|
|
105
110
|
signing_key:
|
|
106
111
|
specification_version: 4
|
|
107
112
|
summary: Get Google, Bing, Baidu, Ebay, Yahoo, Yandex Search Results via SerpApi.com
|
data/lib/baidu_search_results.rb
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
require_relative 'serp_api_client'
|
|
2
|
-
|
|
3
|
-
# Baidu Search Result for Ruby powered by SerpApi
|
|
4
|
-
#
|
|
5
|
-
# Search API Usage
|
|
6
|
-
#
|
|
7
|
-
# ```ruby
|
|
8
|
-
# parameter = {
|
|
9
|
-
# q: "query",
|
|
10
|
-
# api_key: "Serp API Key"
|
|
11
|
-
# }
|
|
12
|
-
#
|
|
13
|
-
# client = BaiduSearchResults.new(parameter)
|
|
14
|
-
#
|
|
15
|
-
# html_results = client.get_html
|
|
16
|
-
# hash_results = client.get_hash
|
|
17
|
-
# json_results = client.get_json
|
|
18
|
-
#
|
|
19
|
-
# ```
|
|
20
|
-
# doc: https://serpapi.com/baidu-search-api
|
|
21
|
-
|
|
22
|
-
class BaiduSearchResults < SerpApiClient
|
|
23
|
-
|
|
24
|
-
def initialize(params = {})
|
|
25
|
-
super(params, BING_ENGINE)
|
|
26
|
-
check_params([:q, :engine])
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def get_location
|
|
30
|
-
raise 'location is not supported by Baidu'
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
end
|