You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- executes a scalable search on `engine: "google"` using the search query: `q: "coffee"`.
1167
-
- parses the messy HTML responses from Google on the backend.
1168
-
- returns a standardized JSON response.
1169
-
The class SerpApi::Client (client side / ruby):
1170
-
- Format the request to SerpApi.com server.
1171
-
- Execute HTTP Get request.
1172
-
- Parse JSON into Ruby Hash using a standard JSON library.
1173
-
Et voila!
1102
+
## Development
1174
1103
1104
+
Contributions are welcome. Make sure to read our [development guide](./DEVELOPMENT.md).
1105
+
1175
1106
## Continuous integration
1176
1107
We love [continuous integration](https://en.wikipedia.org/wiki/Continuous_integration) (CI) and [Test-Driven Development](https://en.wikipedia.org/wiki/Test-driven_development) (TDD) at SerpApi.
1177
1108
We use RSpec and Github Actions to test our infrastructure around the clock, and that includes all changes to our clients.
Integrate search data into your AI workflow, RAG / fine-tuning, or Ruby application using this official wrapper for [SerpApi](https://serpapi.com).
25
+
Integrate search data into your AI workflow, RAG / fine-tuning, or Ruby application using this official wrapper for [SerpApi](https://serpapi.com).
26
26
27
-
SerpApi supports Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and [more](https://serpapi.com).
27
+
SerpApi supports Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and [more](https://serpapi.com).
28
28
29
-
Query a vast range of data at scale, including web search results, flight schedules, stock market data, news headlines, and [more](https://serpapi.com).
29
+
Query a vast range of data at scale, including web search results, flight schedules, stock market data, news headlines, and [more](https://serpapi.com).
30
30
31
31
## Features
32
32
* `persistent` → Keep socket connection open to save on SSL handshake / reconnection (2x faster). [Search at scale](#Search-At-Scale)
@@ -45,7 +45,7 @@ Other versions, such as Ruby 1.9, Ruby 2.x, and JRuby, are compatible with [lega
45
45
gem 'serpapi', '~> 1.0', '>= 1.0.3'
46
46
```
47
47
48
-
### Gem
48
+
### Gem
49
49
```bash
50
50
$ gem install serpapi
51
51
```
@@ -139,7 +139,7 @@ Search API enables `async` search.
139
139
- Non-blocking (`async=true`) : the development is more complex, but this allows handling many simultaneous connections.
140
140
- Blocking (`async=false`) : it is easy to write the code but more compute-intensive when the parent process needs to hold many connections.
141
141
142
-
Here is an example of asynchronous searches using Ruby
142
+
Here is an example of asynchronous searches using Ruby
143
143
```ruby
144
144
require 'serpapi'
145
145
@@ -204,9 +204,9 @@ end
204
204
responses = threads.map(&:value)
205
205
```
206
206
207
-
The code aims to demonstrate how thread pools can be used to
208
-
improve performance by executing multiple tasks concurrently. In
209
-
this case, it makes multiple HTTP requests to an API endpoint using
207
+
The code aims to demonstrate how thread pools can be used to
208
+
improve performance by executing multiple tasks concurrently. In
209
+
this case, it makes multiple HTTP requests to an API endpoint using
210
210
a thread pool of persistent connections.
211
211
212
212
Note: `gem install connection_pool` to run this example.
4. **SerpApi Optimization**: Shows consistent ~2.2x improvement with persistent connections regardless of Ruby version
509
509
5. **Ruby 4.0.0 Performance**: Shows mixed results with some regressions compared to 3.4.4, particularly for HTTP.rb persistent connections. Ruby 4.0.0 was just released for Christmas 2025, and HTTP.rb has not been optimized for it yet.
510
510
511
-
The older library (google-search-results-ruby) was performing at 55 req/s on Ruby 2.7.8, which is 2x slower than the current version (serpapi-ruby) on Ruby 3.4.4 or 4.0.0.
511
+
The older library (google-search-results-ruby) was performing at 55 req/s on Ruby 2.7.8, which is 2x slower than the current version (serpapi-ruby) on Ruby 3.4.4 or 4.0.0.
512
512
513
-
**Context** This benchmark was performed on warmup search results using a MacBook Pro 2025 connected via Wi-Fi 6.0 home network on AT&T fiber from Austin, TX (no network optimization).
513
+
**Context** This benchmark was performed on warmup search results using a MacBook Pro 2025 connected via Wi-Fi 6.0 home network on AT&T fiber from Austin, TX (no network optimization).
514
514
515
515
## Migration quick guide
516
516
517
517
If you were already using [google-search-results-ruby gem](https://github.com/serpapi/google-search-results-ruby), here are the changes.
- executes a scalable search on `engine: "google"` using the search query: `q: "coffee"`.
653
-
- parses the messy HTML responses from Google on the backend.
654
-
- returns a standardized JSON response.
655
-
The class SerpApi::Client (client side / ruby):
656
-
- Format the request to SerpApi.com server.
657
-
- Execute HTTP Get request.
658
-
- Parse JSON into Ruby Hash using a standard JSON library.
659
-
Et voila!
660
-
661
588
## Continuous integration
662
-
We love [continuous integration](https://en.wikipedia.org/wiki/Continuous_integration) (CI) and [Test-Driven Development](https://en.wikipedia.org/wiki/Test-driven_development) (TDD) at SerpApi.
589
+
We love [continuous integration](https://en.wikipedia.org/wiki/Continuous_integration) (CI) and [Test-Driven Development](https://en.wikipedia.org/wiki/Test-driven_development) (TDD) at SerpApi.
663
590
We use RSpec and Github Actions to test our infrastructure around the clock, and that includes all changes to our clients.
664
591
665
592
The directory spec/ includes specification which serves the dual purposes of examples and functional tests.
666
593
667
-
Set your secret API key in your shell before running a test.
594
+
Set your secret API key in your shell before running a test.
668
595
The SerpApi key can be obtained from [serpapi.com/signup](https://serpapi.com/users/sign_up?plan=free).
0 commit comments