searchapi-ruby 0.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.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +48 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +1064 -0
  5. data/lib/searchapi/client.rb +45 -0
  6. data/lib/searchapi/configuration.rb +15 -0
  7. data/lib/searchapi/error.rb +11 -0
  8. data/lib/searchapi/resource.rb +20 -0
  9. data/lib/searchapi/resources/airbnb.rb +17 -0
  10. data/lib/searchapi/resources/amazon_search.rb +17 -0
  11. data/lib/searchapi/resources/apple_app_store.rb +17 -0
  12. data/lib/searchapi/resources/baidu.rb +17 -0
  13. data/lib/searchapi/resources/bing.rb +17 -0
  14. data/lib/searchapi/resources/bing_images.rb +17 -0
  15. data/lib/searchapi/resources/bing_videos.rb +17 -0
  16. data/lib/searchapi/resources/duckduckgo.rb +17 -0
  17. data/lib/searchapi/resources/ebay_search.rb +18 -0
  18. data/lib/searchapi/resources/facebook_business_page.rb +25 -0
  19. data/lib/searchapi/resources/google.rb +17 -0
  20. data/lib/searchapi/resources/google_about_this_domain.rb +17 -0
  21. data/lib/searchapi/resources/google_ads_transparency_center.rb +25 -0
  22. data/lib/searchapi/resources/google_ai_mode.rb +17 -0
  23. data/lib/searchapi/resources/google_ai_overview.rb +17 -0
  24. data/lib/searchapi/resources/google_autocomplete.rb +17 -0
  25. data/lib/searchapi/resources/google_events.rb +17 -0
  26. data/lib/searchapi/resources/google_finance.rb +17 -0
  27. data/lib/searchapi/resources/google_flights.rb +23 -0
  28. data/lib/searchapi/resources/google_forums.rb +17 -0
  29. data/lib/searchapi/resources/google_hotels.rb +17 -0
  30. data/lib/searchapi/resources/google_images.rb +17 -0
  31. data/lib/searchapi/resources/google_jobs.rb +17 -0
  32. data/lib/searchapi/resources/google_lens.rb +17 -0
  33. data/lib/searchapi/resources/google_local.rb +17 -0
  34. data/lib/searchapi/resources/google_maps.rb +30 -0
  35. data/lib/searchapi/resources/google_news.rb +17 -0
  36. data/lib/searchapi/resources/google_patents.rb +17 -0
  37. data/lib/searchapi/resources/google_play_store.rb +33 -0
  38. data/lib/searchapi/resources/google_rank_tracking.rb +17 -0
  39. data/lib/searchapi/resources/google_scholar.rb +21 -0
  40. data/lib/searchapi/resources/google_shopping.rb +17 -0
  41. data/lib/searchapi/resources/google_shorts.rb +17 -0
  42. data/lib/searchapi/resources/google_trends.rb +33 -0
  43. data/lib/searchapi/resources/google_videos.rb +17 -0
  44. data/lib/searchapi/resources/instagram_profile.rb +17 -0
  45. data/lib/searchapi/resources/linkedin_ad_library.rb +17 -0
  46. data/lib/searchapi/resources/meta_ad_library.rb +17 -0
  47. data/lib/searchapi/resources/naver.rb +17 -0
  48. data/lib/searchapi/resources/reddit_ad_library.rb +17 -0
  49. data/lib/searchapi/resources/shein_search.rb +17 -0
  50. data/lib/searchapi/resources/tiktok_ads_library.rb +17 -0
  51. data/lib/searchapi/resources/tiktok_profile.rb +17 -0
  52. data/lib/searchapi/resources/tripadvisor.rb +17 -0
  53. data/lib/searchapi/resources/walmart_search.rb +17 -0
  54. data/lib/searchapi/resources/yahoo.rb +17 -0
  55. data/lib/searchapi/resources/yandex.rb +17 -0
  56. data/lib/searchapi/resources/yandex_reverse_image.rb +17 -0
  57. data/lib/searchapi/resources/youtube.rb +17 -0
  58. data/lib/searchapi/response.rb +25 -0
  59. data/lib/searchapi/version.rb +5 -0
  60. data/lib/searchapi.rb +177 -0
  61. metadata +138 -0
data/README.md ADDED
@@ -0,0 +1,1064 @@
1
+ <p align="center">
2
+ <img src="assets/logo.svg" alt="SearchApi Ruby — an octopus holding a Ruby gem" width="700" />
3
+ </p>
4
+
5
+ <p align="center">
6
+ <a href="https://rubygems.org/gems/searchapi-ruby"><img src="https://badge.fury.io/rb/searchapi-ruby.svg" alt="Gem Version" /></a>
7
+ <a href="LICENSE.txt"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License" /></a>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <strong>Full-featured Ruby client for <a href="https://www.searchapi.io/">SearchAPI.io</a></strong><br/>
12
+ Access <b>49 search engines</b> from a single, consistent interface.
13
+ </p>
14
+
15
+ <p align="center">
16
+ Google · Bing · Baidu · Yandex · DuckDuckGo · YouTube · Amazon · Walmart · eBay<br/>
17
+ Airbnb · TripAdvisor · Social Media · Ad Libraries · and much more
18
+ </p>
19
+
20
+ ---
21
+
22
+ ## Table of Contents
23
+
24
+ - [Installation](#installation)
25
+ - [Quick Start](#quick-start)
26
+ - [Configuration](#configuration)
27
+ - [Supported Engines](#supported-engines)
28
+ - [Usage](#usage)
29
+ <details>
30
+ <summary>All 49 engines...</summary>
31
+
32
+ - [Google Search](#google-search)
33
+ - [Google Rank Tracking](#google-rank-tracking)
34
+ - [Google Maps](#google-maps)
35
+ - [Google News](#google-news)
36
+ - [Google Scholar](#google-scholar)
37
+ - [Google Shopping](#google-shopping)
38
+ - [Google Flights](#google-flights)
39
+ - [Google Hotels](#google-hotels)
40
+ - [Google Images](#google-images)
41
+ - [Google Videos](#google-videos)
42
+ - [Google Trends](#google-trends)
43
+ - [Google Jobs](#google-jobs)
44
+ - [Google Events](#google-events)
45
+ - [Google Finance](#google-finance)
46
+ - [Google Autocomplete](#google-autocomplete)
47
+ - [Google Local](#google-local)
48
+ - [Google Forums](#google-forums)
49
+ - [Google Shorts](#google-shorts)
50
+ - [Google Patents](#google-patents)
51
+ - [Google Lens](#google-lens)
52
+ - [Google AI Mode](#google-ai-mode)
53
+ - [Google AI Overview](#google-ai-overview)
54
+ - [Google About This Domain](#google-about-this-domain)
55
+ - [Google Ads Transparency Center](#google-ads-transparency-center)
56
+ - [Google Play Store](#google-play-store)
57
+ - [YouTube](#youtube)
58
+ - [Bing](#bing)
59
+ - [Bing Images](#bing-images)
60
+ - [Bing Videos](#bing-videos)
61
+ - [Baidu](#baidu)
62
+ - [Yandex](#yandex)
63
+ - [Yandex Reverse Image](#yandex-reverse-image)
64
+ - [DuckDuckGo](#duckduckgo)
65
+ - [Yahoo](#yahoo)
66
+ - [Naver](#naver)
67
+ - [Amazon](#amazon)
68
+ - [Walmart](#walmart)
69
+ - [eBay](#ebay)
70
+ - [Shein](#shein)
71
+ - [Airbnb](#airbnb)
72
+ - [TripAdvisor](#tripadvisor)
73
+ - [Apple App Store](#apple-app-store)
74
+ - [Instagram Profile](#instagram-profile)
75
+ - [TikTok Profile](#tiktok-profile)
76
+ - [Facebook Business Page](#facebook-business-page)
77
+ - [LinkedIn Ad Library](#linkedin-ad-library)
78
+ - [Reddit Ad Library](#reddit-ad-library)
79
+ - [Meta Ad Library](#meta-ad-library)
80
+ - [TikTok Ads Library](#tiktok-ads-library)
81
+
82
+ </details>
83
+ - [Response Object](#response-object)
84
+ - [Error Handling](#error-handling)
85
+ - [Advanced Usage](#advanced-usage)
86
+ - [Contributing](#contributing)
87
+ - [License](#license)
88
+
89
+ ## Installation
90
+
91
+ Add to your Gemfile:
92
+
93
+ ```ruby
94
+ gem "searchapi-ruby"
95
+ ```
96
+
97
+ Then run:
98
+
99
+ ```bash
100
+ bundle install
101
+ ```
102
+
103
+ Or install directly:
104
+
105
+ ```bash
106
+ gem install searchapi-ruby
107
+ ```
108
+
109
+ ## Quick Start
110
+
111
+ ```ruby
112
+ require "searchapi"
113
+
114
+ SearchApi.configure do |config|
115
+ config.api_key = "your_api_key"
116
+ end
117
+
118
+ # Google search
119
+ response = SearchApi.google.search("ruby programming language")
120
+ puts response.data["organic_results"]
121
+
122
+ # YouTube search
123
+ response = SearchApi.youtube.search("ruby tutorial")
124
+ puts response.data["videos"]
125
+
126
+ # Amazon product search
127
+ response = SearchApi.amazon_search.search("wireless headphones")
128
+ puts response.data["organic_results"]
129
+
130
+ # Instagram profile
131
+ response = SearchApi.instagram_profile.search(username: "instagram")
132
+ puts response.data["profile"]
133
+ ```
134
+
135
+ ## Configuration
136
+
137
+ ```ruby
138
+ SearchApi.configure do |config|
139
+ config.api_key = ENV["SEARCHAPI_API_KEY"] # default: reads from env
140
+ config.base_url = "https://www.searchapi.io/api/v1" # default
141
+ config.timeout = 30 # seconds, default
142
+ config.retries = 2 # automatic retries on 429/5xx, default
143
+ config.logger = Logger.new($stdout) # optional, for debugging
144
+ end
145
+ ```
146
+
147
+ ## Supported Engines
148
+
149
+ <details>
150
+ <summary><b>View all 49 supported engines</b></summary>
151
+
152
+ | Category | Engine | Accessor |
153
+ |----------|--------|----------|
154
+ | **Google** | Google Search | `SearchApi.google` |
155
+ | | Google Rank Tracking | `SearchApi.google_rank_tracking` |
156
+ | | Google Maps | `SearchApi.google_maps` |
157
+ | | Google Local | `SearchApi.google_local` |
158
+ | | Google News | `SearchApi.google_news` |
159
+ | | Google Scholar | `SearchApi.google_scholar` |
160
+ | | Google Shopping | `SearchApi.google_shopping` |
161
+ | | Google Flights | `SearchApi.google_flights` |
162
+ | | Google Hotels | `SearchApi.google_hotels` |
163
+ | | Google Images | `SearchApi.google_images` |
164
+ | | Google Videos | `SearchApi.google_videos` |
165
+ | | Google Shorts | `SearchApi.google_shorts` |
166
+ | | Google Trends | `SearchApi.google_trends` |
167
+ | | Google Jobs | `SearchApi.google_jobs` |
168
+ | | Google Events | `SearchApi.google_events` |
169
+ | | Google Finance | `SearchApi.google_finance` |
170
+ | | Google Autocomplete | `SearchApi.google_autocomplete` |
171
+ | | Google Forums | `SearchApi.google_forums` |
172
+ | | Google Patents | `SearchApi.google_patents` |
173
+ | | Google Lens | `SearchApi.google_lens` |
174
+ | | Google AI Mode | `SearchApi.google_ai_mode` |
175
+ | | Google AI Overview | `SearchApi.google_ai_overview` |
176
+ | | Google About This Domain | `SearchApi.google_about_this_domain` |
177
+ | | Google Ads Transparency | `SearchApi.google_ads_transparency_center` |
178
+ | | Google Play Store | `SearchApi.google_play_store` |
179
+ | **Other Search Engines** | Bing | `SearchApi.bing` |
180
+ | | Bing Images | `SearchApi.bing_images` |
181
+ | | Bing Videos | `SearchApi.bing_videos` |
182
+ | | Baidu | `SearchApi.baidu` |
183
+ | | Yandex | `SearchApi.yandex` |
184
+ | | Yandex Reverse Image | `SearchApi.yandex_reverse_image` |
185
+ | | DuckDuckGo | `SearchApi.duckduckgo` |
186
+ | | Yahoo | `SearchApi.yahoo` |
187
+ | | Naver | `SearchApi.naver` |
188
+ | | YouTube | `SearchApi.youtube` |
189
+ | **E-commerce** | Amazon | `SearchApi.amazon_search` |
190
+ | | Walmart | `SearchApi.walmart_search` |
191
+ | | eBay | `SearchApi.ebay_search` |
192
+ | | Shein | `SearchApi.shein_search` |
193
+ | **Travel** | Airbnb | `SearchApi.airbnb` |
194
+ | | TripAdvisor | `SearchApi.tripadvisor` |
195
+ | **App Stores** | Apple App Store | `SearchApi.apple_app_store` |
196
+ | **Social Media** | Instagram Profile | `SearchApi.instagram_profile` |
197
+ | | TikTok Profile | `SearchApi.tiktok_profile` |
198
+ | | Facebook Business Page | `SearchApi.facebook_business_page` |
199
+ | **Ad Libraries** | LinkedIn Ad Library | `SearchApi.linkedin_ad_library` |
200
+ | | Reddit Ad Library | `SearchApi.reddit_ad_library` |
201
+ | | Meta Ad Library | `SearchApi.meta_ad_library` |
202
+ | | TikTok Ads Library | `SearchApi.tiktok_ads_library` |
203
+
204
+ </details>
205
+
206
+ ## Usage
207
+
208
+
209
+ <details>
210
+ <summary><b>Google Search</b></summary>
211
+
212
+
213
+ ```ruby
214
+ # Basic search
215
+ response = SearchApi.google.search("ruby programming")
216
+
217
+ # With parameters
218
+ response = SearchApi.google.search("ruby programming",
219
+ gl: "us",
220
+ hl: "en",
221
+ num: 10,
222
+ page: 1
223
+ )
224
+ ```
225
+
226
+
227
+ </details>
228
+
229
+ <details>
230
+ <summary><b>Google Rank Tracking</b></summary>
231
+
232
+
233
+ ```ruby
234
+ # Track rankings (up to 100 results per request)
235
+ response = SearchApi.google_rank_tracking.search("best crm software", num: 100)
236
+
237
+ # With location targeting
238
+ response = SearchApi.google_rank_tracking.search("plumber near me",
239
+ num: 50,
240
+ location: "New York, NY"
241
+ )
242
+ ```
243
+
244
+
245
+ </details>
246
+
247
+ <details>
248
+ <summary><b>Google Maps</b></summary>
249
+
250
+
251
+ ```ruby
252
+ # Search for places
253
+ response = SearchApi.google_maps.search("restaurants in Tokyo")
254
+
255
+ # With GPS coordinates
256
+ response = SearchApi.google_maps.search("coffee", ll: "@35.6762,139.6503,15z")
257
+
258
+ # Get place details
259
+ response = SearchApi.google_maps.place(data_id: "0x60188b857...")
260
+
261
+ # Get directions
262
+ response = SearchApi.google_maps.directions(
263
+ start: "Tokyo Station",
264
+ destination: "Shibuya Station"
265
+ )
266
+ ```
267
+
268
+
269
+ </details>
270
+
271
+ <details>
272
+ <summary><b>Google News</b></summary>
273
+
274
+
275
+ ```ruby
276
+ response = SearchApi.google_news.search("artificial intelligence")
277
+
278
+ # Filter by time period
279
+ response = SearchApi.google_news.search("tech startups",
280
+ time_period: "last_week",
281
+ gl: "us"
282
+ )
283
+ ```
284
+
285
+
286
+ </details>
287
+
288
+ <details>
289
+ <summary><b>Google Scholar</b></summary>
290
+
291
+
292
+ ```ruby
293
+ # Search papers
294
+ response = SearchApi.google_scholar.search("machine learning")
295
+
296
+ # Filter by year
297
+ response = SearchApi.google_scholar.search("deep learning",
298
+ as_ylo: 2023,
299
+ as_yhi: 2026
300
+ )
301
+
302
+ # Find citing articles
303
+ response = SearchApi.google_scholar.cite("article_id_here")
304
+ ```
305
+
306
+
307
+ </details>
308
+
309
+ <details>
310
+ <summary><b>Google Shopping</b></summary>
311
+
312
+
313
+ ```ruby
314
+ response = SearchApi.google_shopping.search("laptop")
315
+
316
+ # With filters
317
+ response = SearchApi.google_shopping.search("headphones",
318
+ sort_by: "price_low_to_high",
319
+ price_min: 50,
320
+ price_max: 200,
321
+ condition: "new"
322
+ )
323
+ ```
324
+
325
+
326
+ </details>
327
+
328
+ <details>
329
+ <summary><b>Google Flights</b></summary>
330
+
331
+
332
+ ```ruby
333
+ # Round trip
334
+ response = SearchApi.google_flights.search(
335
+ from: "JFK",
336
+ to: "LAX",
337
+ outbound_date: "2026-06-15",
338
+ return_date: "2026-06-22"
339
+ )
340
+
341
+ # One way
342
+ response = SearchApi.google_flights.search(
343
+ from: "SFO",
344
+ to: "ORD",
345
+ outbound_date: "2026-07-01",
346
+ flight_type: "one_way",
347
+ travel_class: "business"
348
+ )
349
+ ```
350
+
351
+
352
+ </details>
353
+
354
+ <details>
355
+ <summary><b>Google Hotels</b></summary>
356
+
357
+
358
+ ```ruby
359
+ response = SearchApi.google_hotels.search("hotels in Paris",
360
+ check_in: "2026-06-15",
361
+ check_out: "2026-06-18"
362
+ )
363
+ ```
364
+
365
+
366
+ </details>
367
+
368
+ <details>
369
+ <summary><b>Google Images</b></summary>
370
+
371
+
372
+ ```ruby
373
+ response = SearchApi.google_images.search("sunset over ocean")
374
+
375
+ # With filters
376
+ response = SearchApi.google_images.search("logo design",
377
+ color: "red",
378
+ size: "large",
379
+ image_type: "clipart"
380
+ )
381
+ ```
382
+
383
+
384
+ </details>
385
+
386
+ <details>
387
+ <summary><b>Google Videos</b></summary>
388
+
389
+
390
+ ```ruby
391
+ response = SearchApi.google_videos.search("ruby tutorial")
392
+
393
+ # With filters
394
+ response = SearchApi.google_videos.search("cooking pasta",
395
+ duration: "medium",
396
+ time_period: "last_month"
397
+ )
398
+ ```
399
+
400
+
401
+ </details>
402
+
403
+ <details>
404
+ <summary><b>Google Trends</b></summary>
405
+
406
+
407
+ ```ruby
408
+ # Interest over time
409
+ response = SearchApi.google_trends.interest_over_time("ruby, python, javascript")
410
+
411
+ # Interest by region
412
+ response = SearchApi.google_trends.interest_by_region("react", geo: "US")
413
+
414
+ # Related queries
415
+ response = SearchApi.google_trends.related_queries("machine learning")
416
+
417
+ # Related topics
418
+ response = SearchApi.google_trends.related_topics("artificial intelligence")
419
+
420
+ # Direct search with data_type
421
+ response = SearchApi.google_trends.search("web development",
422
+ data_type: "TIMESERIES",
423
+ time: "today 12-m"
424
+ )
425
+ ```
426
+
427
+
428
+ </details>
429
+
430
+ <details>
431
+ <summary><b>Google Jobs</b></summary>
432
+
433
+
434
+ ```ruby
435
+ response = SearchApi.google_jobs.search("software engineer")
436
+
437
+ # With filters
438
+ response = SearchApi.google_jobs.search("data scientist",
439
+ location: "San Francisco, CA",
440
+ gl: "us"
441
+ )
442
+ ```
443
+
444
+
445
+ </details>
446
+
447
+ <details>
448
+ <summary><b>Google Events</b></summary>
449
+
450
+
451
+ ```ruby
452
+ response = SearchApi.google_events.search("concerts in Austin")
453
+
454
+ # Filter by date
455
+ response = SearchApi.google_events.search("tech conferences",
456
+ chips: "date:next_week"
457
+ )
458
+ ```
459
+
460
+
461
+ </details>
462
+
463
+ <details>
464
+ <summary><b>Google Finance</b></summary>
465
+
466
+
467
+ ```ruby
468
+ # Stock quote
469
+ response = SearchApi.google_finance.search("NVDA:NASDAQ")
470
+
471
+ # With time window
472
+ response = SearchApi.google_finance.search("AAPL:NASDAQ", window: "1Y")
473
+
474
+ # Crypto
475
+ response = SearchApi.google_finance.search("BTC-USD")
476
+ ```
477
+
478
+
479
+ </details>
480
+
481
+ <details>
482
+ <summary><b>Google Autocomplete</b></summary>
483
+
484
+
485
+ ```ruby
486
+ response = SearchApi.google_autocomplete.search("how to learn")
487
+
488
+ # With client specification
489
+ response = SearchApi.google_autocomplete.search("best restaurants",
490
+ client: "chrome",
491
+ gl: "us"
492
+ )
493
+ ```
494
+
495
+
496
+ </details>
497
+
498
+ <details>
499
+ <summary><b>Google Local</b></summary>
500
+
501
+
502
+ ```ruby
503
+ response = SearchApi.google_local.search("pizza delivery",
504
+ location: "Chicago, IL"
505
+ )
506
+ ```
507
+
508
+
509
+ </details>
510
+
511
+ <details>
512
+ <summary><b>Google Forums</b></summary>
513
+
514
+
515
+ ```ruby
516
+ response = SearchApi.google_forums.search("best ruby gems 2026",
517
+ time_period: "last_year"
518
+ )
519
+ ```
520
+
521
+
522
+ </details>
523
+
524
+ <details>
525
+ <summary><b>Google Shorts</b></summary>
526
+
527
+
528
+ ```ruby
529
+ response = SearchApi.google_shorts.search("funny cats")
530
+ ```
531
+
532
+
533
+ </details>
534
+
535
+ <details>
536
+ <summary><b>Google Patents</b></summary>
537
+
538
+
539
+ ```ruby
540
+ response = SearchApi.google_patents.search("solar panel efficiency",
541
+ patent_status: "GRANT",
542
+ num: 20
543
+ )
544
+ ```
545
+
546
+
547
+ </details>
548
+
549
+ <details>
550
+ <summary><b>Google Lens</b></summary>
551
+
552
+
553
+ ```ruby
554
+ response = SearchApi.google_lens.search(
555
+ url: "https://example.com/image.jpg",
556
+ search_type: "products"
557
+ )
558
+ ```
559
+
560
+
561
+ </details>
562
+
563
+ <details>
564
+ <summary><b>Google AI Mode</b></summary>
565
+
566
+
567
+ ```ruby
568
+ response = SearchApi.google_ai_mode.search("explain quantum computing simply")
569
+ ```
570
+
571
+
572
+ </details>
573
+
574
+ <details>
575
+ <summary><b>Google AI Overview</b></summary>
576
+
577
+
578
+ ```ruby
579
+ # Requires a page_token from a prior Google Search response
580
+ response = SearchApi.google_ai_overview.search(page_token: "token_from_google_search")
581
+ ```
582
+
583
+
584
+ </details>
585
+
586
+ <details>
587
+ <summary><b>Google About This Domain</b></summary>
588
+
589
+
590
+ ```ruby
591
+ response = SearchApi.google_about_this_domain.search(domain: "github.com")
592
+ ```
593
+
594
+
595
+ </details>
596
+
597
+ <details>
598
+ <summary><b>Google Ads Transparency Center</b></summary>
599
+
600
+
601
+ ```ruby
602
+ # Search by advertiser
603
+ response = SearchApi.google_ads_transparency_center.by_advertiser("AR01234567890")
604
+
605
+ # Search by domain
606
+ response = SearchApi.google_ads_transparency_center.by_domain("example.com",
607
+ region: "US"
608
+ )
609
+
610
+ # Generic search
611
+ response = SearchApi.google_ads_transparency_center.search(
612
+ advertiser_id: "AR01234567890",
613
+ region: "US"
614
+ )
615
+ ```
616
+
617
+
618
+ </details>
619
+
620
+ <details>
621
+ <summary><b>Google Play Store</b></summary>
622
+
623
+
624
+ ```ruby
625
+ # Search apps
626
+ response = SearchApi.google_play_store.apps("calculator")
627
+
628
+ # Browse games
629
+ response = SearchApi.google_play_store.games
630
+
631
+ # Search movies
632
+ response = SearchApi.google_play_store.movies("action")
633
+
634
+ # Search books
635
+ response = SearchApi.google_play_store.books("ruby programming")
636
+
637
+ # Direct search with store parameter
638
+ response = SearchApi.google_play_store.search(store: "apps", q: "fitness", gl: "us")
639
+ ```
640
+
641
+
642
+ </details>
643
+
644
+ <details>
645
+ <summary><b>YouTube</b></summary>
646
+
647
+
648
+ ```ruby
649
+ response = SearchApi.youtube.search("ruby on rails tutorial")
650
+
651
+ # With parameters
652
+ response = SearchApi.youtube.search("cooking", gl: "us", hl: "en")
653
+ ```
654
+
655
+
656
+ </details>
657
+
658
+ <details>
659
+ <summary><b>Bing</b></summary>
660
+
661
+
662
+ ```ruby
663
+ response = SearchApi.bing.search("artificial intelligence")
664
+
665
+ # With parameters
666
+ response = SearchApi.bing.search("web development",
667
+ num: 30,
668
+ market_code: "en-US"
669
+ )
670
+ ```
671
+
672
+
673
+ </details>
674
+
675
+ <details>
676
+ <summary><b>Bing Images</b></summary>
677
+
678
+
679
+ ```ruby
680
+ response = SearchApi.bing_images.search("mountain landscape", size: "large")
681
+ ```
682
+
683
+
684
+ </details>
685
+
686
+ <details>
687
+ <summary><b>Bing Videos</b></summary>
688
+
689
+
690
+ ```ruby
691
+ response = SearchApi.bing_videos.search("cooking tutorial", duration: "short")
692
+ ```
693
+
694
+
695
+ </details>
696
+
697
+ <details>
698
+ <summary><b>Baidu</b></summary>
699
+
700
+
701
+ ```ruby
702
+ response = SearchApi.baidu.search("人工智能", num: 20)
703
+ ```
704
+
705
+
706
+ </details>
707
+
708
+ <details>
709
+ <summary><b>Yandex</b></summary>
710
+
711
+
712
+ ```ruby
713
+ response = SearchApi.yandex.search("programming tutorials", lang: "en")
714
+ ```
715
+
716
+
717
+ </details>
718
+
719
+ <details>
720
+ <summary><b>Yandex Reverse Image</b></summary>
721
+
722
+
723
+ ```ruby
724
+ response = SearchApi.yandex_reverse_image.search(
725
+ url: "https://example.com/photo.jpg"
726
+ )
727
+ ```
728
+
729
+
730
+ </details>
731
+
732
+ <details>
733
+ <summary><b>DuckDuckGo</b></summary>
734
+
735
+
736
+ ```ruby
737
+ response = SearchApi.duckduckgo.search("privacy tools", safe: "moderate")
738
+ ```
739
+
740
+
741
+ </details>
742
+
743
+ <details>
744
+ <summary><b>Yahoo</b></summary>
745
+
746
+
747
+ ```ruby
748
+ response = SearchApi.yahoo.search("weather forecast",
749
+ yahoo_domain: "search.yahoo.com"
750
+ )
751
+ ```
752
+
753
+
754
+ </details>
755
+
756
+ <details>
757
+ <summary><b>Naver</b></summary>
758
+
759
+
760
+ ```ruby
761
+ response = SearchApi.naver.search("한국 뉴스", page: 2)
762
+ ```
763
+
764
+
765
+ </details>
766
+
767
+ <details>
768
+ <summary><b>Amazon</b></summary>
769
+
770
+
771
+ ```ruby
772
+ response = SearchApi.amazon_search.search("wireless headphones")
773
+
774
+ # With filters
775
+ response = SearchApi.amazon_search.search("organic coffee",
776
+ amazon_domain: "amazon.co.uk",
777
+ sort_by: "price_asc",
778
+ page: 2
779
+ )
780
+ ```
781
+
782
+
783
+ </details>
784
+
785
+ <details>
786
+ <summary><b>Walmart</b></summary>
787
+
788
+
789
+ ```ruby
790
+ response = SearchApi.walmart_search.search("organic coffee", sort_by: "price_low")
791
+ ```
792
+
793
+
794
+ </details>
795
+
796
+ <details>
797
+ <summary><b>eBay</b></summary>
798
+
799
+
800
+ ```ruby
801
+ # Search with query
802
+ response = SearchApi.ebay_search.search("vintage watch")
803
+
804
+ # Browse by category
805
+ response = SearchApi.ebay_search.search(category_id: "123")
806
+
807
+ # With filters
808
+ response = SearchApi.ebay_search.search("laptop",
809
+ condition: "new",
810
+ price_min: 500,
811
+ price_max: 1500
812
+ )
813
+ ```
814
+
815
+
816
+ </details>
817
+
818
+ <details>
819
+ <summary><b>Shein</b></summary>
820
+
821
+
822
+ ```ruby
823
+ response = SearchApi.shein_search.search("summer dress",
824
+ sort_by: "price_asc",
825
+ currency: "USD"
826
+ )
827
+ ```
828
+
829
+
830
+ </details>
831
+
832
+ <details>
833
+ <summary><b>Airbnb</b></summary>
834
+
835
+
836
+ ```ruby
837
+ response = SearchApi.airbnb.search("Tulum",
838
+ check_in: "2026-06-15",
839
+ check_out: "2026-06-22",
840
+ adults: 2,
841
+ price_max: 200
842
+ )
843
+ ```
844
+
845
+
846
+ </details>
847
+
848
+ <details>
849
+ <summary><b>TripAdvisor</b></summary>
850
+
851
+
852
+ ```ruby
853
+ response = SearchApi.tripadvisor.search("best restaurants in Rome",
854
+ category: "restaurants"
855
+ )
856
+ ```
857
+
858
+
859
+ </details>
860
+
861
+ <details>
862
+ <summary><b>Apple App Store</b></summary>
863
+
864
+
865
+ ```ruby
866
+ response = SearchApi.apple_app_store.search(term: "photo editor",
867
+ country: "us",
868
+ num: 50
869
+ )
870
+ ```
871
+
872
+
873
+ </details>
874
+
875
+ <details>
876
+ <summary><b>Instagram Profile</b></summary>
877
+
878
+
879
+ ```ruby
880
+ response = SearchApi.instagram_profile.search(username: "natgeo")
881
+
882
+ profile = response.data["profile"]
883
+ posts = response.data["posts"]
884
+ ```
885
+
886
+
887
+ </details>
888
+
889
+ <details>
890
+ <summary><b>TikTok Profile</b></summary>
891
+
892
+
893
+ ```ruby
894
+ response = SearchApi.tiktok_profile.search(username: "tiktok")
895
+
896
+ profile = response.data["profile"]
897
+ ```
898
+
899
+
900
+ </details>
901
+
902
+ <details>
903
+ <summary><b>Facebook Business Page</b></summary>
904
+
905
+
906
+ ```ruby
907
+ # By username
908
+ response = SearchApi.facebook_business_page.by_username("cocacola")
909
+
910
+ # By page ID
911
+ response = SearchApi.facebook_business_page.by_page_id("123456789")
912
+
913
+ # Generic search
914
+ response = SearchApi.facebook_business_page.search(username: "nasa")
915
+ ```
916
+
917
+
918
+ </details>
919
+
920
+ <details>
921
+ <summary><b>LinkedIn Ad Library</b></summary>
922
+
923
+
924
+ ```ruby
925
+ response = SearchApi.linkedin_ad_library.search(
926
+ advertiser: "Google",
927
+ country: "US"
928
+ )
929
+ ```
930
+
931
+
932
+ </details>
933
+
934
+ <details>
935
+ <summary><b>Reddit Ad Library</b></summary>
936
+
937
+
938
+ ```ruby
939
+ response = SearchApi.reddit_ad_library.search(
940
+ q: "gaming",
941
+ industry: "GAMING",
942
+ budget_category: "HIGH"
943
+ )
944
+ ```
945
+
946
+
947
+ </details>
948
+
949
+ <details>
950
+ <summary><b>Meta Ad Library</b></summary>
951
+
952
+
953
+ ```ruby
954
+ response = SearchApi.meta_ad_library.search(
955
+ q: "sneakers",
956
+ active_status: "active",
957
+ platforms: "instagram"
958
+ )
959
+ ```
960
+
961
+
962
+ </details>
963
+
964
+ <details>
965
+ <summary><b>TikTok Ads Library</b></summary>
966
+
967
+
968
+ ```ruby
969
+ response = SearchApi.tiktok_ads_library.search(
970
+ q: "fashion",
971
+ country: "US",
972
+ sort_by: "last_shown_date_newest_to_oldest"
973
+ )
974
+ ```
975
+
976
+
977
+ </details>
978
+ ## Response Object
979
+
980
+ Every API call returns a `SearchApi::Response`:
981
+
982
+ ```ruby
983
+ response = SearchApi.google.search("ruby")
984
+
985
+ response.success? # => true
986
+ response.status # => 200
987
+ response.data # => parsed JSON hash (full response)
988
+ response.results # => same as data when it's a Hash
989
+ response.headers # => response headers
990
+ response.credits_remaining # => remaining API credits (integer)
991
+ ```
992
+
993
+ ## Error Handling
994
+
995
+ All errors inherit from `SearchApi::Error`:
996
+
997
+ ```ruby
998
+ begin
999
+ SearchApi.google.search("ruby")
1000
+ rescue SearchApi::AuthenticationError => e
1001
+ # Invalid or missing API key (401)
1002
+ rescue SearchApi::RateLimitError => e
1003
+ # Too many requests (429)
1004
+ rescue SearchApi::NotFoundError => e
1005
+ # Resource not found (404)
1006
+ rescue SearchApi::TimeoutError => e
1007
+ # Request timed out or connection failed
1008
+ rescue SearchApi::ServerError => e
1009
+ # Server-side error (5xx)
1010
+ rescue SearchApi::Error => e
1011
+ # Catch-all for any SearchApi error
1012
+ end
1013
+ ```
1014
+
1015
+ Automatic retries are built in for `429`, `500`, `502`, and `503` status codes (configurable via `config.retries`).
1016
+
1017
+ ## Advanced Usage
1018
+
1019
+ ### Custom Client Instance
1020
+
1021
+ You can create a standalone client instead of using the global module:
1022
+
1023
+ ```ruby
1024
+ config = SearchApi::Configuration.new
1025
+ config.api_key = "different_api_key"
1026
+ config.timeout = 60
1027
+
1028
+ client = SearchApi::Client.new(config)
1029
+ google = SearchApi::Resources::Google.new(client)
1030
+
1031
+ response = google.search("ruby programming")
1032
+ ```
1033
+
1034
+ ### Common Parameters
1035
+
1036
+ Most Google engines support these shared parameters:
1037
+
1038
+ | Parameter | Description | Example |
1039
+ |-----------|-------------|---------|
1040
+ | `gl` | Country code (ISO 3166-1 alpha-2) | `"us"`, `"gb"`, `"jp"` |
1041
+ | `hl` | Language code | `"en"`, `"es"`, `"ja"` |
1042
+ | `location` | Geo-targeting location | `"New York, NY"` |
1043
+ | `device` | Device type | `"desktop"`, `"mobile"`, `"tablet"` |
1044
+ | `page` | Pagination | `1`, `2`, `3` |
1045
+ | `safe` | SafeSearch | `"active"`, `"off"` |
1046
+ | `num` | Results per page | `10`, `20`, `100` |
1047
+
1048
+ See the [SearchAPI documentation](https://www.searchapi.io) for the full parameter reference of each engine.
1049
+
1050
+ ### Zero Retention (Enterprise)
1051
+
1052
+ Disable data logging for compliance scenarios:
1053
+
1054
+ ```ruby
1055
+ response = SearchApi.google.search("sensitive query", zero_retention: true)
1056
+ ```
1057
+
1058
+ ## Contributing
1059
+
1060
+ Bug reports and pull requests are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
1061
+
1062
+ ## License
1063
+
1064
+ Released under the [MIT License](LICENSE.txt).