fetchserp 0.1.1 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3cd4f221a3c82a7cbbe3f8f30f2ad30d34033d98090ddaabe716dd6710b7e93c
4
- data.tar.gz: 334c72468085154f231e4cc5de15002fc208e4aeeabcc04a67d4c79a40e7a21f
3
+ metadata.gz: aee8e95fe03152c7170f302c9dc12708b6dd34be523518d19d68d06806faf1f0
4
+ data.tar.gz: 9e5bf93d85115a71444f7d012d91e202565e050ba22126e008ddbca3cf17f8ea
5
5
  SHA512:
6
- metadata.gz: d7e76b461290d590368bf47e5892cf161d8255011259a6bbffa488c8c4959700146ac99597d9f1bd15a9529741f2270543996c117440319ed94b8162b32460f7
7
- data.tar.gz: 69c53b9825c3d84eccdb6770eab3552e335882ad9ea59b40e5b69cec10a5372d6b9699227bb52f0aa51eb0170d33249a3dc30028e315f99b5cb26dc2777bdcd6
6
+ metadata.gz: 7b5f79d83dab6a5ac4a608aa47c90b8571a1cc9d898faa41f02f062ead8efd6cd93aef3d91a48d529d131fab0beafe987be01004d204fb1c08f57b42219db75c
7
+ data.tar.gz: e36ebed82d26a5e684a7010ed5b1ddab57c9081c030466e9e60fadbfc5da040e6d8e4862d1e8b3b62ddbb92d52d34d6f5e5bbf99c33bc65bef7a115f28b729f2
data/README.md CHANGED
@@ -7,7 +7,7 @@ A lightweight, hand-crafted Ruby SDK for the FetchSERP REST API.
7
7
  Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
- gem "fetchserp", git: "https://github.com/fetchserp/fetchserp-ruby.git"
10
+ gem "fetchserp", "~> 0.1"
11
11
  ```
12
12
 
13
13
  Then bundle install:
@@ -16,6 +16,22 @@ Then bundle install:
16
16
  bundle install
17
17
  ```
18
18
 
19
+ ## Authentication
20
+
21
+ An API key is required for **all** requests. You can create a free account and grab your key at <https://fetchserp.com/> — every new account starts with **250 free credits** so you can test the endpoints immediately.
22
+
23
+ Set it in your environment (recommended):
24
+
25
+ ```bash
26
+ export FETCHSERP_API_KEY="your-secret-token"
27
+ ```
28
+
29
+ or pass it directly when instantiating the client:
30
+
31
+ ```ruby
32
+ client = FetchSERP.new(api_key: "your-secret-token")
33
+ ```
34
+
19
35
  ## Quick Start
20
36
 
21
37
  ```ruby
@@ -30,6 +46,10 @@ puts response.data
30
46
  # Fetch Google SERP results
31
47
  serp = client.serp(query: "best ruby gems", country: "us")
32
48
  puts serp.data["results"]
49
+
50
+ # Get ranking positions for a domain/keyword
51
+ ranking = client.ranking(keyword: "serp api", domain: "fetchserp.com", pages_number: 5)
52
+ puts ranking.data["results"]
33
53
  ```
34
54
 
35
55
  The client will raise `FetchSERP::Error` on any HTTP error (network, 4xx, 5xx) so you can handle failures gracefully.
@@ -43,12 +63,14 @@ The client will raise `FetchSERP::Error` on any HTTP error (network, 4xx, 5xx) s
43
63
  * `/api/v1/keywords_suggestions`
44
64
  * `/api/v1/long_tail_keywords_generator`
45
65
  * `/api/v1/page_indexation`
66
+ * `/api/v1/playwright_mcp`
46
67
  * `/api/v1/ranking`
47
68
  * `/api/v1/scrape`
48
69
  * `/api/v1/scrape_domain`
49
70
  * `/api/v1/scrape_js`
50
71
  * `/api/v1/scrape_js_with_proxy`
51
72
  * `/api/v1/serp`
73
+ * `/api/v1/serp_ai_mode`
52
74
  * `/api/v1/serp_html`
53
75
  * `/api/v1/serp_js` & `/api/v1/serp_js/{uuid}`
54
76
  * `/api/v1/serp_text`
@@ -70,12 +92,14 @@ Below is the full list of convenience helpers exposed by `FetchSERP::Client`. Al
70
92
  | `keywords_suggestions(url: nil, keywords: nil, **opts)` | `GET /api/v1/keywords_suggestions` | one of `url` or `keywords` |
71
93
  | `long_tail_keywords_generator(keyword:, **opts)` | `GET /api/v1/long_tail_keywords_generator` | `keyword` |
72
94
  | `page_indexation(domain:, keyword:)` | `GET /api/v1/page_indexation` | `domain`, `keyword` |
95
+ | `playwright_mcp(prompt:, **opts)` | `GET /api/v1/playwright_mcp` | `prompt` |
73
96
  | `ranking(keyword:, domain:, **opts)` | `GET /api/v1/ranking` | `keyword`, `domain` |
74
97
  | `scrape(url:)` | `GET /api/v1/scrape` | `url` |
75
98
  | `scrape_domain(domain:, **opts)` | `GET /api/v1/scrape_domain` | `domain` |
76
99
  | `scrape_js(url:, js_script: nil)` | `POST /api/v1/scrape_js` | `url` |
77
100
  | `scrape_js_with_proxy(url:, country:, js_script: nil)` | `POST /api/v1/scrape_js_with_proxy` | `url`, `country` |
78
101
  | `serp(query:, **opts)` | `GET /api/v1/serp` | `query` |
102
+ | `serp_ai_mode(query:, **opts)` | `GET /api/v1/serp_ai_mode` | `query` |
79
103
  | `serp_html(query:, **opts)` | `GET /api/v1/serp_html` | `query` |
80
104
  | `serp_js(query:, **opts)` | `GET /api/v1/serp_js` | `query` |
81
105
  | `serp_js_content(uuid:)` | `GET /api/v1/serp_js/{uuid}` | `uuid` |
@@ -93,6 +117,25 @@ resp = client.keywords_suggestions(keywords: ["ruby sdk", "seo api"], country: "
93
117
  puts resp.data["keywords_suggestions"]
94
118
  ```
95
119
 
120
+ ### Example — Get SERP AI Overview and AI Mode
121
+
122
+ ```ruby
123
+ client = FetchSERP.new(api_key: ENV["FETCHSERP_API_KEY"])
124
+
125
+ # Get AI overview and AI mode response for a search query
126
+ resp = client.serp_ai_mode(query: "ruby programming best practices")
127
+ ```
128
+
129
+ ### Example — Remote control browser with Playwright MCP
130
+
131
+ ```ruby
132
+ client = FetchSERP.new(api_key: ENV["FETCHSERP_API_KEY"])
133
+
134
+ # Use GPT-4.1 to remote control a browser via Playwright MCP
135
+ resp = client.playwright_mcp(prompt: "Navigate to google.com and search for 'ruby gems'")
136
+ puts resp.data["response"]
137
+ ```
138
+
96
139
  ### Handling errors
97
140
 
98
141
  Any 4xx/5xx response raises `FetchSERP::Error` which includes `status` and raw `body` so you can debug:
@@ -51,6 +51,11 @@ module FetchSERP
51
51
  get("/api/v1/page_indexation", params)
52
52
  end
53
53
 
54
+ # Playwright MCP - uses GPT-4.1 to remote control a browser via a Playwright MCP server
55
+ def playwright_mcp(**params)
56
+ get("/api/v1/playwright_mcp", params)
57
+ end
58
+
54
59
  def ranking(**params)
55
60
  get("/api/v1/ranking", params)
56
61
  end
@@ -79,6 +84,12 @@ module FetchSERP
79
84
  get("/api/v1/serp_html", params)
80
85
  end
81
86
 
87
+ # SERP AI Overview and AI Mode - returns AI overview and AI mode response for the query
88
+ # Less reliable than the 2-step process but returns results in under 30 seconds
89
+ def serp_ai_mode(**params)
90
+ get("/api/v1/serp_ai_mode", params)
91
+ end
92
+
82
93
  # Step 1: returns uuid
83
94
  def serp_js(**params)
84
95
  get("/api/v1/serp_js", params)
@@ -1,3 +1,3 @@
1
1
  module FetchSERP
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fetchserp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - FetchSERP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-19 00:00:00.000000000 Z
11
+ date: 2025-07-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A lightweight Ruby client for interacting with the FetchSERP API. Provides
14
14
  helpers for authentication and convenient Ruby methods for each endpoint.