apiverve_seoscraper 1.2.0 → 1.2.2
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/LICENSE +21 -21
- data/README.md +101 -480
- data/lib/apiverve_seoscraper/client.rb +184 -186
- data/lib/apiverve_seoscraper.rb +9 -9
- metadata +11 -8
- data/lib/apiverve/client.rb +0 -184
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 852cf030a506ad313f599a6bb84cedd0762b56f53a24d3164814eae351bfe906
|
|
4
|
+
data.tar.gz: 41716a101992472be846b7b685a9ca57f882c24fea15f2d7b56def42405bf449
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bdfbe0b71b684ce66b8fab288a66fb44d021f8d0acc0e344fae64e17947de8c8be15f6c298e9fc9ae99f3a2a6530644d82b182c13d4a0c7be5cb3ae0976bcdeb
|
|
7
|
+
data.tar.gz: 3e45e7f070891e726a7b581a70626ebb69860d4c315d6da028de42f6aea05b35d5058b2227da8291a2c72dc0c7e1879a00cf7e9f00495a76471156edf1fac59d
|
data/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 APIVerve and EvlarSoft LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,490 +1,111 @@
|
|
|
1
|
-
# SEO Data Scraper API - Ruby Gem
|
|
2
|
-
|
|
3
|
-
SEO Scraper
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
Add this line to your application's Gemfile:
|
|
8
|
-
|
|
9
|
-
```ruby
|
|
10
|
-
gem 'apiverve_seoscraper'
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
And then execute:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
$ bundle install
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Or install it yourself as:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
$ gem install apiverve_seoscraper
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Getting Started
|
|
26
|
-
|
|
27
|
-
Get your API key at [APIVerve](https://apiverve.com)
|
|
28
|
-
|
|
29
|
-
### Basic Usage
|
|
30
|
-
|
|
31
|
-
```ruby
|
|
32
|
-
require 'apiverve_seoscraper'
|
|
33
|
-
|
|
34
|
-
# Initialize the client
|
|
35
|
-
client = APIVerve::Seoscraper::Client.new(api_key: "YOUR_API_KEY")
|
|
36
|
-
|
|
37
|
-
# Make a request
|
|
38
|
-
response = client.execute({ url: "https://apiverve.com" })
|
|
39
|
-
|
|
40
|
-
# Print the response
|
|
41
|
-
puts response
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
### Error Handling
|
|
46
|
-
|
|
47
|
-
```ruby
|
|
48
|
-
begin
|
|
49
|
-
response = client.execute({ url: "https://apiverve.com" })
|
|
50
|
-
puts response["data"]
|
|
51
|
-
rescue APIVerve::Seoscraper::ValidationError => e
|
|
52
|
-
puts "Validation error: #{e.errors.join(', ')}"
|
|
53
|
-
rescue APIVerve::Seoscraper::APIError => e
|
|
54
|
-
puts "API error: #{e.message}"
|
|
55
|
-
puts "Status code: #{e.status_code}"
|
|
56
|
-
end
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Debug Mode
|
|
60
|
-
|
|
61
|
-
```ruby
|
|
62
|
-
# Enable debug logging
|
|
63
|
-
client = APIVerve::Seoscraper::Client.new(
|
|
64
|
-
api_key: "YOUR_API_KEY",
|
|
65
|
-
debug: true
|
|
66
|
-
)
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Example Response
|
|
70
|
-
|
|
71
|
-
```json
|
|
1
|
+
# SEO Data Scraper API - Ruby Gem
|
|
2
|
+
|
|
3
|
+
SEO Data Scraper parses any public URL to collect title tags, meta descriptions, robots directives, and Open Graph or Twitter card previews. Paid plans add canonical URLs to verify indexing rules.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'apiverve_seoscraper'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
$ bundle install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
$ gem install apiverve_seoscraper
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Getting Started
|
|
26
|
+
|
|
27
|
+
Get your API key at [APIVerve](https://apiverve.com)
|
|
28
|
+
|
|
29
|
+
### Basic Usage
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
require 'apiverve_seoscraper'
|
|
33
|
+
|
|
34
|
+
# Initialize the client
|
|
35
|
+
client = APIVerve::Seoscraper::Client.new(api_key: "YOUR_API_KEY")
|
|
36
|
+
|
|
37
|
+
# Make a request
|
|
38
|
+
response = client.execute({ url: "https://apiverve.com" })
|
|
39
|
+
|
|
40
|
+
# Print the response
|
|
41
|
+
puts response
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Error Handling
|
|
46
|
+
|
|
47
|
+
```ruby
|
|
48
|
+
begin
|
|
49
|
+
response = client.execute({ url: "https://apiverve.com" })
|
|
50
|
+
puts response["data"]
|
|
51
|
+
rescue APIVerve::Seoscraper::ValidationError => e
|
|
52
|
+
puts "Validation error: #{e.errors.join(', ')}"
|
|
53
|
+
rescue APIVerve::Seoscraper::APIError => e
|
|
54
|
+
puts "API error: #{e.message}"
|
|
55
|
+
puts "Status code: #{e.status_code}"
|
|
56
|
+
end
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Debug Mode
|
|
60
|
+
|
|
61
|
+
```ruby
|
|
62
|
+
# Enable debug logging
|
|
63
|
+
client = APIVerve::Seoscraper::Client.new(
|
|
64
|
+
api_key: "YOUR_API_KEY",
|
|
65
|
+
debug: true
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Example Response
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
72
|
{
|
|
73
73
|
"status": "ok",
|
|
74
74
|
"error": null,
|
|
75
75
|
"data": {
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
|
|
85
|
-
"rel": "icon",
|
|
86
|
-
"type": "image/x-icon",
|
|
87
|
-
"href": "/images/favicon.ico"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"rel": "icon",
|
|
91
|
-
"type": "image/png",
|
|
92
|
-
"href": "/images/favicon.png"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
"rel": "apple-touch-icon",
|
|
96
|
-
"href": "/images/favicon.png"
|
|
97
|
-
}
|
|
98
|
-
],
|
|
99
|
-
"author": "APIVerve",
|
|
100
|
-
"description": "APIVerve offers fast, scalable, and reliable APIs for developers. Access data enrichment, validation, and integration services with enterprise-grade performance.",
|
|
101
|
-
"keywords": "API, developer tools, data enrichment, API integration, scalable APIs, reliable APIs",
|
|
102
|
-
"source": "",
|
|
103
|
-
"price": "",
|
|
104
|
-
"priceCurrency": "",
|
|
105
|
-
"availability": "",
|
|
106
|
-
"robots": "index, follow",
|
|
107
|
-
"jsonld": [
|
|
108
|
-
{
|
|
109
|
-
"@context": "https://schema.org",
|
|
110
|
-
"@type": "Organization",
|
|
111
|
-
"name": "APIVerve",
|
|
112
|
-
"url": "https://apiverve.com",
|
|
113
|
-
"logo": "https://apiverve.com/images/favicon.png",
|
|
114
|
-
"sameAs": [
|
|
115
|
-
"https://www.facebook.com/apiverve",
|
|
116
|
-
"https://www.twitter.com/apivervehq",
|
|
117
|
-
"https://www.linkedin.com/company/apiverve",
|
|
118
|
-
"https://github.com/apiverve",
|
|
119
|
-
"https://www.instagram.com/apiverve"
|
|
120
|
-
]
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
"@context": "https://schema.org",
|
|
124
|
-
"@type": "WebSite",
|
|
125
|
-
"url": "https://apiverve.com",
|
|
126
|
-
"potentialAction": {
|
|
127
|
-
"@type": "SearchAction",
|
|
128
|
-
"target": {
|
|
129
|
-
"@type": "EntryPoint",
|
|
130
|
-
"urlTemplate": "https://apiverve.com/marketplace?search={search_term_string}"
|
|
131
|
-
},
|
|
132
|
-
"query-input": "required name=search_term_string"
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
],
|
|
76
|
+
"url": "https://apiverve.com",
|
|
77
|
+
"title": "APIVerve — One key for 300+ production APIs",
|
|
78
|
+
"description": "Consistent schemas, predictable credit pricing, and an uptime SLA on every paid plan across 300+ production APIs. One key, one bill, zero glue code.",
|
|
79
|
+
"keywords": "",
|
|
80
|
+
"author": "",
|
|
81
|
+
"canonical": "",
|
|
82
|
+
"og:title": "APIVerve — One key for 300+ production APIs",
|
|
83
|
+
"og:description": "Consistent schemas, predictable credit pricing, and an uptime SLA on every paid plan across 300+ production APIs. One key, one bill, zero glue code.",
|
|
84
|
+
"og:image": "https://apiverve.com/social-images/page-home.png",
|
|
136
85
|
"og:url": "https://apiverve.com",
|
|
137
|
-
"og:locale": "",
|
|
138
|
-
"og:locale:alternate": "",
|
|
139
|
-
"og:title": "APIVerve - Fast, Scalable, and Reliable APIs",
|
|
140
86
|
"og:type": "website",
|
|
141
|
-
"og:description": "APIVerve offers fast, scalable, and reliable APIs for developers. Access data enrichment, validation, and integration services with enterprise-grade performance.",
|
|
142
|
-
"og:determiner": "",
|
|
143
87
|
"og:site_name": "APIVerve",
|
|
144
|
-
"og:image": "https://apiverve.com/images/posterImage.png",
|
|
145
|
-
"og:image:secure_url": "",
|
|
146
|
-
"og:image:type": "",
|
|
147
|
-
"og:image:width": "1200",
|
|
148
|
-
"og:image:height": "630",
|
|
149
|
-
"twitter:title": "APIVerve - Fast, Scalable, and Reliable APIs",
|
|
150
|
-
"twitter:description": "APIVerve offers fast, scalable, and reliable APIs for developers. Access data enrichment, validation, and integration services with enterprise-grade performance.",
|
|
151
|
-
"twitter:image": "https://apiverve.com/images/posterImage.png",
|
|
152
|
-
"twitter:image:alt": "",
|
|
153
88
|
"twitter:card": "summary_large_image",
|
|
89
|
+
"twitter:title": "APIVerve — One key for 300+ production APIs",
|
|
90
|
+
"twitter:description": "Consistent schemas, predictable credit pricing, and an uptime SLA on every paid plan across 300+ production APIs.",
|
|
91
|
+
"twitter:image": "https://apiverve.com/social-images/page-home.png",
|
|
154
92
|
"twitter:site": "",
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"twitter:creator": "",
|
|
159
|
-
"twitter:creator:id": "",
|
|
160
|
-
"twitter:player": "",
|
|
161
|
-
"twitter:player:width": "",
|
|
162
|
-
"twitter:player:height": "",
|
|
163
|
-
"twitter:player:stream": "",
|
|
164
|
-
"twitter:app:name:iphone": "",
|
|
165
|
-
"twitter:app:id:iphone": "",
|
|
166
|
-
"twitter:app:url:iphone": "",
|
|
167
|
-
"twitter:app:name:ipad": "",
|
|
168
|
-
"twitter:app:id:ipad": "",
|
|
169
|
-
"twitter:app:url:ipad": "",
|
|
170
|
-
"twitter:app:name:googleplay": "",
|
|
171
|
-
"twitter:app:id:googleplay": "",
|
|
172
|
-
"twitter:app:url:googleplay": "",
|
|
173
|
-
"headings": [
|
|
174
|
-
{
|
|
175
|
-
"level": "h4",
|
|
176
|
-
"text": "API Platform"
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"level": "h5",
|
|
180
|
-
"text": "Core Platform"
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
"level": "h5",
|
|
184
|
-
"text": "Developer Tools"
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
"level": "h5",
|
|
188
|
-
"text": "Integrations"
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
"level": "h4",
|
|
192
|
-
"text": "Solutions"
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
"level": "h5",
|
|
196
|
-
"text": "By Industry"
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
"level": "h5",
|
|
200
|
-
"text": "By Use Case"
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
"level": "h4",
|
|
204
|
-
"text": "Resources"
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
"level": "h5",
|
|
208
|
-
"text": "Learn & Build"
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
"level": "h5",
|
|
212
|
-
"text": "Support & Community"
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
"level": "h5",
|
|
216
|
-
"text": "Trust & Transparency"
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
"level": "h1",
|
|
220
|
-
"text": "Fast, Scalable, and Reliable |"
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
"level": "h2",
|
|
224
|
-
"text": "Trusted by over 40,000 forward thinking developers"
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
"level": "h2",
|
|
228
|
-
"text": "Why Developers Choose APIVerve"
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
"level": "h3",
|
|
232
|
-
"text": "⚡ Unmatched Reliability"
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
"level": "h3",
|
|
236
|
-
"text": "🔑 True One-Key Simplicity"
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
"level": "h3",
|
|
240
|
-
"text": "🌐 GraphQL & Mocking"
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
"level": "h2",
|
|
244
|
-
"text": "Most Popular APIs"
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
"level": "h3",
|
|
248
|
-
"text": "Daily API Performance"
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
"level": "h2",
|
|
252
|
-
"text": "Trusted by Developers Worldwide"
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
"level": "h4",
|
|
256
|
-
"text": "Tomasz K."
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
"level": "h4",
|
|
260
|
-
"text": "Priya M."
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
"level": "h4",
|
|
264
|
-
"text": "Rafael S."
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
"level": "h2",
|
|
268
|
-
"text": "Native SDKs & Libraries"
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
"level": "h4",
|
|
272
|
-
"text": "JavaScript/TypeScript"
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
"level": "h4",
|
|
276
|
-
"text": "React"
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
"level": "h4",
|
|
280
|
-
"text": "Vue.js"
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
"level": "h4",
|
|
284
|
-
"text": "Angular"
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
"level": "h4",
|
|
288
|
-
"text": "Node.js"
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
"level": "h4",
|
|
292
|
-
"text": "Next.js"
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
"level": "h2",
|
|
296
|
-
"text": "Frequently Asked Questions"
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
"level": "h3",
|
|
300
|
-
"text": "How much usage is included with the Free Trial plan?"
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
"level": "h3",
|
|
304
|
-
"text": "How do I get an API Key?"
|
|
305
|
-
},
|
|
306
|
-
{
|
|
307
|
-
"level": "h3",
|
|
308
|
-
"text": "How does APIVerve use my data?"
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
"level": "h3",
|
|
312
|
-
"text": "Can I change my plan at any time?"
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
"level": "h3",
|
|
316
|
-
"text": "How do I know my plan usage?"
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
"level": "h3",
|
|
320
|
-
"text": "Can I cancel my plan anytime?"
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
"level": "h3",
|
|
324
|
-
"text": "Where can I find my invoices?"
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
"level": "h3",
|
|
328
|
-
"text": "What are your accepted payment methods?"
|
|
329
|
-
},
|
|
330
|
-
{
|
|
331
|
-
"level": "h3",
|
|
332
|
-
"text": "What happens when I go over the token limit for the month?"
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
"level": "h3",
|
|
336
|
-
"text": "What is a token?"
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
"level": "h3",
|
|
340
|
-
"text": "Do you offer student discounts?"
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
"level": "h2",
|
|
344
|
-
"text": "Ready to build something amazing?"
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
"level": "h3",
|
|
348
|
-
"text": "APIVerve"
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
"level": "h4",
|
|
352
|
-
"text": "Product"
|
|
353
|
-
},
|
|
354
|
-
{
|
|
355
|
-
"level": "h4",
|
|
356
|
-
"text": "Integrations"
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
"level": "h4",
|
|
360
|
-
"text": "Solutions"
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
"level": "h4",
|
|
364
|
-
"text": "Resources"
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
"level": "h4",
|
|
368
|
-
"text": "Compare"
|
|
369
|
-
},
|
|
370
|
-
{
|
|
371
|
-
"level": "h4",
|
|
372
|
-
"text": "SDKs"
|
|
373
|
-
},
|
|
374
|
-
{
|
|
375
|
-
"level": "h4",
|
|
376
|
-
"text": "Company"
|
|
377
|
-
},
|
|
378
|
-
{
|
|
379
|
-
"level": "h4",
|
|
380
|
-
"text": "Legal"
|
|
381
|
-
}
|
|
382
|
-
],
|
|
383
|
-
"imgTags": [
|
|
384
|
-
{
|
|
385
|
-
"src": "/images/favicon.png",
|
|
386
|
-
"alt": "APIVerve"
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
"src": "/images/wreath.svg",
|
|
390
|
-
"alt": "Award"
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
"src": "/images/brands/brand06.png",
|
|
394
|
-
"alt": "Postman"
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
"src": "/images/brands/brand01.png",
|
|
398
|
-
"alt": "Microsoft"
|
|
399
|
-
},
|
|
400
|
-
{
|
|
401
|
-
"src": "/images/brands/brand02.png",
|
|
402
|
-
"alt": "DuckDuckGo"
|
|
403
|
-
},
|
|
404
|
-
{
|
|
405
|
-
"src": "/images/brands/brand03.png",
|
|
406
|
-
"alt": "Topdanmark"
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
"src": "/images/brands/brand04.png",
|
|
410
|
-
"alt": "University of Maryland"
|
|
411
|
-
},
|
|
412
|
-
{
|
|
413
|
-
"src": "/images/brands/brand05.png",
|
|
414
|
-
"alt": "Postman"
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
"src": "/images/brands/brand06.png",
|
|
418
|
-
"alt": "RapidAPI"
|
|
419
|
-
},
|
|
420
|
-
{
|
|
421
|
-
"src": "/images/brands/brand07.png",
|
|
422
|
-
"alt": "Zapier"
|
|
423
|
-
},
|
|
424
|
-
{
|
|
425
|
-
"src": "/images/brands/brand08.svg",
|
|
426
|
-
"alt": "Brand"
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
"src": "/images/brands/brand01.png",
|
|
430
|
-
"alt": "Microsoft"
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
"src": "/images/brands/brand02.png",
|
|
434
|
-
"alt": "DuckDuckGo"
|
|
435
|
-
},
|
|
436
|
-
{
|
|
437
|
-
"src": "/images/brands/brand03.png",
|
|
438
|
-
"alt": "Topdanmark"
|
|
439
|
-
},
|
|
440
|
-
{
|
|
441
|
-
"src": "/images/brands/brand04.png",
|
|
442
|
-
"alt": "University of Maryland"
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
"src": "/images/brands/brand05.png",
|
|
446
|
-
"alt": "Postman"
|
|
447
|
-
},
|
|
448
|
-
{
|
|
449
|
-
"src": "/images/brands/brand06.png",
|
|
450
|
-
"alt": "RapidAPI"
|
|
451
|
-
},
|
|
452
|
-
{
|
|
453
|
-
"src": "/images/brands/brand07.png",
|
|
454
|
-
"alt": "Zapier"
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
"src": "/images/brands/brand08.svg",
|
|
458
|
-
"alt": "Brand"
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
"src": "/images/favicon.png",
|
|
462
|
-
"alt": "APIVerve"
|
|
463
|
-
}
|
|
464
|
-
],
|
|
465
|
-
"responseBody": "",
|
|
466
|
-
"viewport": "width=device-width, initial-scale=1,width=device-width, initial-scale=1",
|
|
467
|
-
"googlebot": "index, follow",
|
|
468
|
-
"theme-color": "#ffffff",
|
|
469
|
-
"application-name": "APIVerve",
|
|
470
|
-
"msapplication-TileColor": "#3b82f6",
|
|
471
|
-
"mobile-web-app-capable": "yes",
|
|
472
|
-
"apple-mobile-web-app-title": "APIVerve",
|
|
473
|
-
"apple-mobile-web-app-status-bar-style": "default",
|
|
474
|
-
"og:image:alt": "APIVerve - Fast, Scalable, and Reliable APIs"
|
|
93
|
+
"robots": "",
|
|
94
|
+
"viewport": "width=device-width, initial-scale=1, maximum-scale=1",
|
|
95
|
+
"charset": "utf-8"
|
|
475
96
|
}
|
|
476
|
-
}
|
|
477
|
-
```
|
|
478
|
-
|
|
479
|
-
## Documentation
|
|
480
|
-
|
|
481
|
-
For more information, visit the [API Documentation](https://docs.apiverve.com/ref/seoscraper?utm_source=rubygems&utm_medium=readme).
|
|
482
|
-
|
|
483
|
-
## Support
|
|
484
|
-
|
|
485
|
-
- Website: [https://apiverve.com/marketplace/seoscraper?utm_source=ruby&utm_medium=readme](https://apiverve.com/marketplace/seoscraper?utm_source=ruby&utm_medium=readme)
|
|
486
|
-
- Email: hello@apiverve.com
|
|
487
|
-
|
|
488
|
-
## License
|
|
489
|
-
|
|
490
|
-
This gem is available under the [MIT License](LICENSE).
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Documentation
|
|
101
|
+
|
|
102
|
+
For more information, visit the [API Documentation](https://docs.apiverve.com/ref/seoscraper?utm_source=rubygems&utm_medium=referral&utm_content=readme).
|
|
103
|
+
|
|
104
|
+
## Support
|
|
105
|
+
|
|
106
|
+
- Website: [https://apiverve.com/marketplace/seoscraper?utm_source=ruby&utm_medium=referral&utm_content=readme](https://apiverve.com/marketplace/seoscraper?utm_source=ruby&utm_medium=referral&utm_content=readme)
|
|
107
|
+
- Email: hello@apiverve.com
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
This gem is available under the [MIT License](LICENSE).
|
|
@@ -1,186 +1,184 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "faraday"
|
|
4
|
-
require "faraday/multipart"
|
|
5
|
-
require "json"
|
|
6
|
-
|
|
7
|
-
module APIVerve
|
|
8
|
-
module Seoscraper
|
|
9
|
-
# Client for the SEO Data Scraper API
|
|
10
|
-
#
|
|
11
|
-
# @example Basic usage
|
|
12
|
-
# client = APIVerve::Seoscraper::Client.new(api_key: "your_api_key")
|
|
13
|
-
# response = client.execute({ url: "https://apiverve.com" })
|
|
14
|
-
# puts response
|
|
15
|
-
#
|
|
16
|
-
# @see https://apiverve.com/marketplace/seoscraper?utm_source=ruby&utm_medium=readme
|
|
17
|
-
class Client
|
|
18
|
-
BASE_URL = "https://api.apiverve.com/v1/seoscraper"
|
|
19
|
-
DEFAULT_TIMEOUT = 30
|
|
20
|
-
|
|
21
|
-
# Validation rules for parameters
|
|
22
|
-
VALIDATION_RULES = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
# @param
|
|
38
|
-
# @
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
@
|
|
45
|
-
|
|
46
|
-
@
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
conn.
|
|
50
|
-
conn.
|
|
51
|
-
conn.
|
|
52
|
-
conn.
|
|
53
|
-
conn.headers["
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
#
|
|
60
|
-
#
|
|
61
|
-
# @
|
|
62
|
-
# @
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
errors << "Parameter [#{param_name}] must be
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
data
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
end
|
|
186
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "faraday"
|
|
4
|
+
require "faraday/multipart"
|
|
5
|
+
require "json"
|
|
6
|
+
|
|
7
|
+
module APIVerve
|
|
8
|
+
module Seoscraper
|
|
9
|
+
# Client for the SEO Data Scraper API
|
|
10
|
+
#
|
|
11
|
+
# @example Basic usage
|
|
12
|
+
# client = APIVerve::Seoscraper::Client.new(api_key: "your_api_key")
|
|
13
|
+
# response = client.execute({ url: "https://apiverve.com" })
|
|
14
|
+
# puts response
|
|
15
|
+
#
|
|
16
|
+
# @see https://apiverve.com/marketplace/seoscraper?utm_source=ruby&utm_medium=referral&utm_content=readme
|
|
17
|
+
class Client
|
|
18
|
+
BASE_URL = "https://api.apiverve.com/v1/seoscraper"
|
|
19
|
+
DEFAULT_TIMEOUT = 30
|
|
20
|
+
|
|
21
|
+
# Validation rules for parameters
|
|
22
|
+
VALIDATION_RULES = { 'url' => { type: 'string', required: true, format: 'url' } }
|
|
23
|
+
|
|
24
|
+
# Format validation patterns
|
|
25
|
+
FORMAT_PATTERNS = {
|
|
26
|
+
'email' => /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
|
27
|
+
'url' => /^https?:\/\/.+/,
|
|
28
|
+
'ip' => /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$|^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/,
|
|
29
|
+
'date' => /^\d{4}-\d{2}-\d{2}$/,
|
|
30
|
+
'hexColor' => /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/
|
|
31
|
+
}.freeze
|
|
32
|
+
|
|
33
|
+
# Initialize the client
|
|
34
|
+
#
|
|
35
|
+
# @param api_key [String] Your APIVerve API key
|
|
36
|
+
# @param timeout [Integer] Request timeout in seconds (default: 30)
|
|
37
|
+
# @param debug [Boolean] Enable debug logging (default: false)
|
|
38
|
+
# @raise [ArgumentError] If API key is invalid
|
|
39
|
+
def initialize(api_key:, timeout: DEFAULT_TIMEOUT, debug: false)
|
|
40
|
+
validate_api_key!(api_key)
|
|
41
|
+
|
|
42
|
+
@api_key = api_key
|
|
43
|
+
@timeout = timeout
|
|
44
|
+
@debug = debug
|
|
45
|
+
|
|
46
|
+
@connection = Faraday.new(url: BASE_URL) do |conn|
|
|
47
|
+
conn.request :multipart
|
|
48
|
+
conn.request :url_encoded
|
|
49
|
+
conn.adapter Faraday.default_adapter
|
|
50
|
+
conn.options.timeout = @timeout
|
|
51
|
+
conn.headers["x-api-key"] = @api_key
|
|
52
|
+
conn.headers["auth-mode"] = "rubygems-package"
|
|
53
|
+
conn.headers["Content-Type"] = "application/json"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Execute the API request
|
|
58
|
+
#
|
|
59
|
+
# @param params [Hash] Query parameters or request body
|
|
60
|
+
# @return [Hash] API response
|
|
61
|
+
# @raise [APIError] If the request fails
|
|
62
|
+
# @raise [ValidationError] If parameter validation fails
|
|
63
|
+
def execute(params = {})
|
|
64
|
+
validate_params!(params)
|
|
65
|
+
|
|
66
|
+
log("Making POST request to #{BASE_URL}")
|
|
67
|
+
log("Parameters: #{params.inspect}") if params.any?
|
|
68
|
+
|
|
69
|
+
response = @connection.post do |req|
|
|
70
|
+
req.body = params.to_json
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
handle_response(response)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
private
|
|
77
|
+
|
|
78
|
+
def validate_api_key!(api_key)
|
|
79
|
+
raise ArgumentError, "API key is required. Get your API key at: https://apiverve.com" if api_key.nil? || api_key.strip.empty?
|
|
80
|
+
|
|
81
|
+
unless api_key.match?(/^[a-zA-Z0-9_-]+$/)
|
|
82
|
+
raise ArgumentError, "Invalid API key format. API key should only contain letters, numbers, hyphens, and underscores."
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def validate_params!(params)
|
|
87
|
+
return if VALIDATION_RULES.empty?
|
|
88
|
+
|
|
89
|
+
errors = []
|
|
90
|
+
|
|
91
|
+
VALIDATION_RULES.each do |param_name, rules|
|
|
92
|
+
value = params[param_name.to_sym] || params[param_name]
|
|
93
|
+
|
|
94
|
+
# Check required
|
|
95
|
+
if rules[:required] && (value.nil? || value.to_s.empty?)
|
|
96
|
+
errors << "Required parameter [#{param_name}] is missing."
|
|
97
|
+
next
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
next if value.nil?
|
|
101
|
+
|
|
102
|
+
case rules[:type]
|
|
103
|
+
when "integer", "number"
|
|
104
|
+
begin
|
|
105
|
+
num_value = rules[:type] == "number" ? Float(value) : Integer(value)
|
|
106
|
+
errors << "Parameter [#{param_name}] must be at least #{rules[:min]}." if rules[:min] && num_value < rules[:min]
|
|
107
|
+
errors << "Parameter [#{param_name}] must be at most #{rules[:max]}." if rules[:max] && num_value > rules[:max]
|
|
108
|
+
rescue ArgumentError, TypeError
|
|
109
|
+
errors << "Parameter [#{param_name}] must be a valid #{rules[:type]}."
|
|
110
|
+
end
|
|
111
|
+
when "string"
|
|
112
|
+
unless value.is_a?(String)
|
|
113
|
+
errors << "Parameter [#{param_name}] must be a string."
|
|
114
|
+
next
|
|
115
|
+
end
|
|
116
|
+
errors << "Parameter [#{param_name}] must be at least #{rules[:min_length]} characters." if rules[:min_length] && value.length < rules[:min_length]
|
|
117
|
+
errors << "Parameter [#{param_name}] must be at most #{rules[:max_length]} characters." if rules[:max_length] && value.length > rules[:max_length]
|
|
118
|
+
|
|
119
|
+
if rules[:format] && FORMAT_PATTERNS[rules[:format]]
|
|
120
|
+
unless value.match?(FORMAT_PATTERNS[rules[:format]])
|
|
121
|
+
errors << "Parameter [#{param_name}] must be a valid #{rules[:format]}."
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
when "boolean"
|
|
125
|
+
unless [true, false, "true", "false"].include?(value)
|
|
126
|
+
errors << "Parameter [#{param_name}] must be a boolean."
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Enum validation
|
|
131
|
+
if rules[:enum] && !rules[:enum].include?(value)
|
|
132
|
+
errors << "Parameter [#{param_name}] must be one of: #{rules[:enum].join(', ')}."
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
raise ValidationError, errors unless errors.empty?
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def handle_response(response)
|
|
140
|
+
log("Response status: #{response.status}")
|
|
141
|
+
|
|
142
|
+
data = JSON.parse(response.body)
|
|
143
|
+
|
|
144
|
+
if data["status"] == "error"
|
|
145
|
+
raise APIError.new(data["error"] || "Unknown API error", response.status, data)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
unless response.success?
|
|
149
|
+
raise APIError.new(data["error"] || "HTTP #{response.status} error", response.status, data)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
log("Request successful")
|
|
153
|
+
data
|
|
154
|
+
rescue JSON::ParserError => e
|
|
155
|
+
raise APIError.new("Invalid JSON response: #{e.message}", response.status)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def log(message)
|
|
159
|
+
puts "[APIVerve::Seoscraper] #{message}" if @debug
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Custom error class for API errors
|
|
164
|
+
class APIError < StandardError
|
|
165
|
+
attr_reader :status_code, :response
|
|
166
|
+
|
|
167
|
+
def initialize(message, status_code = nil, response = nil)
|
|
168
|
+
@status_code = status_code
|
|
169
|
+
@response = response
|
|
170
|
+
super(message)
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Custom error class for validation errors
|
|
175
|
+
class ValidationError < StandardError
|
|
176
|
+
attr_reader :errors
|
|
177
|
+
|
|
178
|
+
def initialize(errors)
|
|
179
|
+
@errors = errors
|
|
180
|
+
super("Validation failed: #{errors.join(' ')}")
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
end
|
data/lib/apiverve_seoscraper.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "apiverve_seoscraper/client"
|
|
4
|
-
|
|
5
|
-
module APIVerve
|
|
6
|
-
module Seoscraper
|
|
7
|
-
VERSION = "1.2.
|
|
8
|
-
end
|
|
9
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "apiverve_seoscraper/client"
|
|
4
|
+
|
|
5
|
+
module APIVerve
|
|
6
|
+
module Seoscraper
|
|
7
|
+
VERSION = "1.2.2"
|
|
8
|
+
end
|
|
9
|
+
end
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: apiverve_seoscraper
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- APIVerve
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-10-21 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: faraday
|
|
@@ -57,8 +58,9 @@ dependencies:
|
|
|
57
58
|
- - "~>"
|
|
58
59
|
- !ruby/object:Gem::Version
|
|
59
60
|
version: '2.0'
|
|
60
|
-
description: SEO Scraper
|
|
61
|
-
|
|
61
|
+
description: SEO Data Scraper parses any public URL to collect title tags, meta descriptions,
|
|
62
|
+
robots directives, and Open Graph or Twitter card previews. Paid plans add canonical
|
|
63
|
+
URLs to verify indexing rules.
|
|
62
64
|
email:
|
|
63
65
|
- hello@apiverve.com
|
|
64
66
|
executables: []
|
|
@@ -67,17 +69,17 @@ extra_rdoc_files: []
|
|
|
67
69
|
files:
|
|
68
70
|
- LICENSE
|
|
69
71
|
- README.md
|
|
70
|
-
- lib/apiverve/client.rb
|
|
71
72
|
- lib/apiverve_seoscraper.rb
|
|
72
73
|
- lib/apiverve_seoscraper/client.rb
|
|
73
|
-
homepage: https://apiverve.com/marketplace/seoscraper?utm_source=ruby&utm_medium=homepage
|
|
74
|
+
homepage: https://apiverve.com/marketplace/seoscraper?utm_source=ruby&utm_medium=referral&utm_content=homepage
|
|
74
75
|
licenses:
|
|
75
76
|
- MIT
|
|
76
77
|
metadata:
|
|
77
|
-
homepage_uri: https://apiverve.com/marketplace/seoscraper?utm_source=ruby&utm_medium=homepage
|
|
78
|
+
homepage_uri: https://apiverve.com/marketplace/seoscraper?utm_source=ruby&utm_medium=referral&utm_content=homepage
|
|
78
79
|
source_code_uri: https://github.com/apiverve/seoscraper-API/tree/main/ruby
|
|
79
80
|
changelog_uri: https://apiverve.com/changelog
|
|
80
81
|
documentation_uri: https://docs.apiverve.com/ref/seoscraper
|
|
82
|
+
post_install_message:
|
|
81
83
|
rdoc_options: []
|
|
82
84
|
require_paths:
|
|
83
85
|
- lib
|
|
@@ -92,7 +94,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
92
94
|
- !ruby/object:Gem::Version
|
|
93
95
|
version: '0'
|
|
94
96
|
requirements: []
|
|
95
|
-
rubygems_version: 3.
|
|
97
|
+
rubygems_version: 3.0.3.1
|
|
98
|
+
signing_key:
|
|
96
99
|
specification_version: 4
|
|
97
100
|
summary: SEO Data Scraper API - Ruby Client
|
|
98
101
|
test_files: []
|
data/lib/apiverve/client.rb
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "faraday"
|
|
4
|
-
require "faraday/multipart"
|
|
5
|
-
require "json"
|
|
6
|
-
|
|
7
|
-
module APIVerve
|
|
8
|
-
module Seoscraper
|
|
9
|
-
# Client for the SEO Data Scraper API
|
|
10
|
-
#
|
|
11
|
-
# @example Basic usage
|
|
12
|
-
# client = APIVerve::Seoscraper::Client.new(api_key: "your_api_key")
|
|
13
|
-
# response = client.execute({ url: "https://apiverve.com" })
|
|
14
|
-
# puts response
|
|
15
|
-
#
|
|
16
|
-
# @see https://apiverve.com/marketplace/seoscraper?utm_source=ruby&utm_medium=readme
|
|
17
|
-
class Client
|
|
18
|
-
BASE_URL = "https://api.apiverve.com/v1/seoscraper"
|
|
19
|
-
DEFAULT_TIMEOUT = 30
|
|
20
|
-
|
|
21
|
-
# Validation rules for parameters
|
|
22
|
-
VALIDATION_RULES = { 'url' => { type: 'string', required: true, format: 'url' } }
|
|
23
|
-
|
|
24
|
-
# Format validation patterns
|
|
25
|
-
FORMAT_PATTERNS = {
|
|
26
|
-
'email' => /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
|
27
|
-
'url' => /^https?:\/\/.+/,
|
|
28
|
-
'ip' => /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$|^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/,
|
|
29
|
-
'date' => /^\d{4}-\d{2}-\d{2}$/,
|
|
30
|
-
'hexColor' => /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/
|
|
31
|
-
}.freeze
|
|
32
|
-
|
|
33
|
-
# Initialize the client
|
|
34
|
-
#
|
|
35
|
-
# @param api_key [String] Your APIVerve API key
|
|
36
|
-
# @param timeout [Integer] Request timeout in seconds (default: 30)
|
|
37
|
-
# @param debug [Boolean] Enable debug logging (default: false)
|
|
38
|
-
# @raise [ArgumentError] If API key is invalid
|
|
39
|
-
def initialize(api_key:, timeout: DEFAULT_TIMEOUT, debug: false)
|
|
40
|
-
validate_api_key!(api_key)
|
|
41
|
-
|
|
42
|
-
@api_key = api_key
|
|
43
|
-
@timeout = timeout
|
|
44
|
-
@debug = debug
|
|
45
|
-
|
|
46
|
-
@connection = Faraday.new(url: BASE_URL) do |conn|
|
|
47
|
-
conn.request :multipart
|
|
48
|
-
conn.request :url_encoded
|
|
49
|
-
conn.adapter Faraday.default_adapter
|
|
50
|
-
conn.options.timeout = @timeout
|
|
51
|
-
conn.headers["x-api-key"] = @api_key
|
|
52
|
-
conn.headers["auth-mode"] = "rubygems-package"
|
|
53
|
-
conn.headers["Content-Type"] = "application/json"
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
# Execute the API request
|
|
58
|
-
#
|
|
59
|
-
# @param params [Hash] Query parameters or request body
|
|
60
|
-
# @return [Hash] API response
|
|
61
|
-
# @raise [APIError] If the request fails
|
|
62
|
-
# @raise [ValidationError] If parameter validation fails
|
|
63
|
-
def execute(params = {})
|
|
64
|
-
validate_params!(params)
|
|
65
|
-
|
|
66
|
-
log("Making POST request to #{BASE_URL}")
|
|
67
|
-
log("Parameters: #{params.inspect}") if params.any?
|
|
68
|
-
|
|
69
|
-
response = @connection.post do |req|
|
|
70
|
-
req.body = params.to_json
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
handle_response(response)
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
private
|
|
77
|
-
|
|
78
|
-
def validate_api_key!(api_key)
|
|
79
|
-
raise ArgumentError, "API key is required. Get your API key at: https://apiverve.com" if api_key.nil? || api_key.strip.empty?
|
|
80
|
-
|
|
81
|
-
unless api_key.match?(/^[a-zA-Z0-9_-]+$/)
|
|
82
|
-
raise ArgumentError, "Invalid API key format. API key should only contain letters, numbers, hyphens, and underscores."
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def validate_params!(params)
|
|
87
|
-
return if VALIDATION_RULES.empty?
|
|
88
|
-
|
|
89
|
-
errors = []
|
|
90
|
-
|
|
91
|
-
VALIDATION_RULES.each do |param_name, rules|
|
|
92
|
-
value = params[param_name.to_sym] || params[param_name]
|
|
93
|
-
|
|
94
|
-
# Check required
|
|
95
|
-
if rules[:required] && (value.nil? || value.to_s.empty?)
|
|
96
|
-
errors << "Required parameter [#{param_name}] is missing."
|
|
97
|
-
next
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
next if value.nil?
|
|
101
|
-
|
|
102
|
-
case rules[:type]
|
|
103
|
-
when "integer", "number"
|
|
104
|
-
begin
|
|
105
|
-
num_value = rules[:type] == "number" ? Float(value) : Integer(value)
|
|
106
|
-
errors << "Parameter [#{param_name}] must be at least #{rules[:min]}." if rules[:min] && num_value < rules[:min]
|
|
107
|
-
errors << "Parameter [#{param_name}] must be at most #{rules[:max]}." if rules[:max] && num_value > rules[:max]
|
|
108
|
-
rescue ArgumentError, TypeError
|
|
109
|
-
errors << "Parameter [#{param_name}] must be a valid #{rules[:type]}."
|
|
110
|
-
end
|
|
111
|
-
when "string"
|
|
112
|
-
unless value.is_a?(String)
|
|
113
|
-
errors << "Parameter [#{param_name}] must be a string."
|
|
114
|
-
next
|
|
115
|
-
end
|
|
116
|
-
errors << "Parameter [#{param_name}] must be at least #{rules[:min_length]} characters." if rules[:min_length] && value.length < rules[:min_length]
|
|
117
|
-
errors << "Parameter [#{param_name}] must be at most #{rules[:max_length]} characters." if rules[:max_length] && value.length > rules[:max_length]
|
|
118
|
-
|
|
119
|
-
if rules[:format] && FORMAT_PATTERNS[rules[:format]]
|
|
120
|
-
unless value.match?(FORMAT_PATTERNS[rules[:format]])
|
|
121
|
-
errors << "Parameter [#{param_name}] must be a valid #{rules[:format]}."
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
when "boolean"
|
|
125
|
-
unless [true, false, "true", "false"].include?(value)
|
|
126
|
-
errors << "Parameter [#{param_name}] must be a boolean."
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
# Enum validation
|
|
131
|
-
if rules[:enum] && !rules[:enum].include?(value)
|
|
132
|
-
errors << "Parameter [#{param_name}] must be one of: #{rules[:enum].join(', ')}."
|
|
133
|
-
end
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
raise ValidationError, errors unless errors.empty?
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
def handle_response(response)
|
|
140
|
-
log("Response status: #{response.status}")
|
|
141
|
-
|
|
142
|
-
data = JSON.parse(response.body)
|
|
143
|
-
|
|
144
|
-
if data["status"] == "error"
|
|
145
|
-
raise APIError.new(data["error"] || "Unknown API error", response.status, data)
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
unless response.success?
|
|
149
|
-
raise APIError.new(data["error"] || "HTTP #{response.status} error", response.status, data)
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
log("Request successful")
|
|
153
|
-
data
|
|
154
|
-
rescue JSON::ParserError => e
|
|
155
|
-
raise APIError.new("Invalid JSON response: #{e.message}", response.status)
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
def log(message)
|
|
159
|
-
puts "[APIVerve::Seoscraper] #{message}" if @debug
|
|
160
|
-
end
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
# Custom error class for API errors
|
|
164
|
-
class APIError < StandardError
|
|
165
|
-
attr_reader :status_code, :response
|
|
166
|
-
|
|
167
|
-
def initialize(message, status_code = nil, response = nil)
|
|
168
|
-
@status_code = status_code
|
|
169
|
-
@response = response
|
|
170
|
-
super(message)
|
|
171
|
-
end
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
# Custom error class for validation errors
|
|
175
|
-
class ValidationError < StandardError
|
|
176
|
-
attr_reader :errors
|
|
177
|
-
|
|
178
|
-
def initialize(errors)
|
|
179
|
-
@errors = errors
|
|
180
|
-
super("Validation failed: #{errors.join(' ')}")
|
|
181
|
-
end
|
|
182
|
-
end
|
|
183
|
-
end
|
|
184
|
-
end
|