capturekitdev 0.1.0__py3-none-any.whl
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.
- capturekit/__init__.py +61 -0
- capturekit/_endpoints.py +62 -0
- capturekit/_operations.py +791 -0
- capturekit/_response.py +82 -0
- capturekit/_serialization.py +109 -0
- capturekit/_version.py +1 -0
- capturekit/client.py +533 -0
- capturekit/errors.py +85 -0
- capturekit/models.py +81 -0
- capturekit/py.typed +1 -0
- capturekitdev-0.1.0.dist-info/METADATA +215 -0
- capturekitdev-0.1.0.dist-info/RECORD +14 -0
- capturekitdev-0.1.0.dist-info/WHEEL +4 -0
- capturekitdev-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,791 @@
|
|
|
1
|
+
"""Generated from the CaptureKit OpenAPI document. Do not edit by hand."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import Sequence
|
|
6
|
+
from typing import Any, Literal, cast
|
|
7
|
+
|
|
8
|
+
from .models import APIResponse, JsonResponse, RequestOptions
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class _SyncOperations:
|
|
12
|
+
"""Generated CaptureKit endpoint methods."""
|
|
13
|
+
|
|
14
|
+
__slots__ = ()
|
|
15
|
+
|
|
16
|
+
def _call(
|
|
17
|
+
self, name: str, params: dict[str, Any], options: RequestOptions | None
|
|
18
|
+
) -> APIResponse:
|
|
19
|
+
raise NotImplementedError
|
|
20
|
+
|
|
21
|
+
def analyze(
|
|
22
|
+
self,
|
|
23
|
+
*,
|
|
24
|
+
url: str,
|
|
25
|
+
custom_response: str | None = None,
|
|
26
|
+
custom_prompt: str | None = None,
|
|
27
|
+
proxy: str | None = None,
|
|
28
|
+
cache: bool | None = None,
|
|
29
|
+
cache_ttl: int | float | None = None,
|
|
30
|
+
fields: str | None = None,
|
|
31
|
+
is_async: bool | None = None,
|
|
32
|
+
soft_fail: bool | None = None,
|
|
33
|
+
request_options: RequestOptions | None = None,
|
|
34
|
+
) -> JsonResponse:
|
|
35
|
+
"""Analyze (AI). AI Content API analyzes any webpage and returns AI insights summary, value proposition, features, categories, use cases, and optional contact signals. Credit cost: 1 credit per call.
|
|
36
|
+
|
|
37
|
+
``GET / POST /v1/analyze``
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
url: The URL of the webpage to capture.
|
|
41
|
+
custom_response: Pass custom response fields to be included in the AI response.
|
|
42
|
+
custom_prompt: Add your own instructions to guide the AI’s analysis.
|
|
43
|
+
proxy: Specify a proxy server to route your request through.
|
|
44
|
+
cache: Cache the response.
|
|
45
|
+
cache_ttl: Cache the response for a custom TTL (in seconds).
|
|
46
|
+
fields: Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
|
|
47
|
+
is_async: Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob).
|
|
48
|
+
soft_fail: Return HTTP 200 even when an error occurs; the error is then in the response body.
|
|
49
|
+
"""
|
|
50
|
+
return cast(
|
|
51
|
+
JsonResponse,
|
|
52
|
+
self._call(
|
|
53
|
+
"analyze",
|
|
54
|
+
{
|
|
55
|
+
"url": url,
|
|
56
|
+
"custom_response": custom_response,
|
|
57
|
+
"custom_prompt": custom_prompt,
|
|
58
|
+
"proxy": proxy,
|
|
59
|
+
"cache": cache,
|
|
60
|
+
"cache_ttl": cache_ttl,
|
|
61
|
+
"fields": fields,
|
|
62
|
+
"is_async": is_async,
|
|
63
|
+
"soft_fail": soft_fail,
|
|
64
|
+
},
|
|
65
|
+
request_options,
|
|
66
|
+
),
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
def capture(
|
|
70
|
+
self,
|
|
71
|
+
*,
|
|
72
|
+
url: str,
|
|
73
|
+
format: Literal["jpeg", "jpg", "pdf", "png", "webp"] | str | None = None,
|
|
74
|
+
device: Literal[
|
|
75
|
+
"galaxy_fold4",
|
|
76
|
+
"galaxy_s23",
|
|
77
|
+
"galaxy_s23_ultra",
|
|
78
|
+
"galaxy_s8",
|
|
79
|
+
"huawei_mate_50_pro",
|
|
80
|
+
"huawei_p60_pro",
|
|
81
|
+
"ipad",
|
|
82
|
+
"iphone_12",
|
|
83
|
+
"iphone_13_mini",
|
|
84
|
+
"iphone_13_pro_max",
|
|
85
|
+
"iphone_14_pro",
|
|
86
|
+
"iphone_14_pro_max",
|
|
87
|
+
"iphone_x",
|
|
88
|
+
"pixel_5",
|
|
89
|
+
"pixel_6a",
|
|
90
|
+
"pixel_7_pro",
|
|
91
|
+
"redmi_note_11",
|
|
92
|
+
"redmi_note_12_pro",
|
|
93
|
+
]
|
|
94
|
+
| str
|
|
95
|
+
| None = None,
|
|
96
|
+
full_page: bool | None = None,
|
|
97
|
+
full_page_scroll: bool | None = None,
|
|
98
|
+
full_page_scroll_duration: int | float | None = None,
|
|
99
|
+
viewport_width: int | float | None = None,
|
|
100
|
+
viewport_height: int | float | None = None,
|
|
101
|
+
scale_factor: int | float | None = None,
|
|
102
|
+
image_quality: str | None = None,
|
|
103
|
+
selector: str | None = None,
|
|
104
|
+
cache: bool | None = None,
|
|
105
|
+
cache_ttl: int | float | None = None,
|
|
106
|
+
remove_selectors: str | None = None,
|
|
107
|
+
remove_cookie_banners: bool | None = None,
|
|
108
|
+
remove_ads: bool | None = None,
|
|
109
|
+
block_resources: Literal[
|
|
110
|
+
"document",
|
|
111
|
+
"eventsource",
|
|
112
|
+
"fetch",
|
|
113
|
+
"font",
|
|
114
|
+
"image",
|
|
115
|
+
"manifest",
|
|
116
|
+
"media",
|
|
117
|
+
"other",
|
|
118
|
+
"script",
|
|
119
|
+
"stylesheet",
|
|
120
|
+
"texttrack",
|
|
121
|
+
"websocket",
|
|
122
|
+
"xhr",
|
|
123
|
+
]
|
|
124
|
+
| str
|
|
125
|
+
| None = None,
|
|
126
|
+
block_urls: str | None = None,
|
|
127
|
+
delay: int | float | None = None,
|
|
128
|
+
wait_until: Sequence[
|
|
129
|
+
Literal["domcontentloaded", "load", "networkidle0", "networkidle2"] | str
|
|
130
|
+
]
|
|
131
|
+
| None = None,
|
|
132
|
+
wait_for_selector: str | None = None,
|
|
133
|
+
proxy: str | None = None,
|
|
134
|
+
s3_secret_key: str | None = None,
|
|
135
|
+
s3_access_key_id: str | None = None,
|
|
136
|
+
s3_bucket: str | None = None,
|
|
137
|
+
s3_object_key: str | None = None,
|
|
138
|
+
s3_region: str | None = None,
|
|
139
|
+
storage_endpoint: str | None = None,
|
|
140
|
+
s3_url: bool | None = None,
|
|
141
|
+
fields: str | None = None,
|
|
142
|
+
is_async: bool | None = None,
|
|
143
|
+
soft_fail: bool | None = None,
|
|
144
|
+
request_options: RequestOptions | None = None,
|
|
145
|
+
) -> APIResponse:
|
|
146
|
+
"""Capture (Screenshot). Browser-like Screenshot API that captures webpages as PNG/JPEG/WebP or PDF for previews, QA, reporting, monitoring, and archiving no headless setup. Credit cost: 1 credit per call.
|
|
147
|
+
|
|
148
|
+
``GET / POST /v1/capture``
|
|
149
|
+
|
|
150
|
+
Args:
|
|
151
|
+
url: The URL of the webpage to capture. Examples: https://www.amazon.com/s?k=pokemon
|
|
152
|
+
format: The output format of the screenshot.
|
|
153
|
+
device: The device type to emulate for the screenshot.
|
|
154
|
+
full_page: Capture the entire page instead of just the visible viewport.
|
|
155
|
+
full_page_scroll: Scroll the page to fully load lazy-loaded elements before capturing a full-page screenshot.
|
|
156
|
+
full_page_scroll_duration: Time in milliseconds for scrolling before capturing the full page.
|
|
157
|
+
viewport_width: The width of the browser viewport in pixels.
|
|
158
|
+
viewport_height: The height of the browser viewport in pixels.
|
|
159
|
+
scale_factor: The scale factor for high-resolution screenshots.
|
|
160
|
+
image_quality: Generate images with custom quality settings.
|
|
161
|
+
selector: Capture a specific element on the page instead of the full viewport.
|
|
162
|
+
cache: Cache the response.
|
|
163
|
+
cache_ttl: Cache the response for a custom TTL (in seconds).
|
|
164
|
+
remove_selectors: A comma-separated list of elements to hide before capturing (e.g., ads, popups).
|
|
165
|
+
remove_cookie_banners: Automatically remove cookie banners before capturing.
|
|
166
|
+
remove_ads: Automatically remove ads before capturing.
|
|
167
|
+
block_resources: Comma-separated list of resource types to block (e.g., “image,stylesheet,font”).
|
|
168
|
+
block_urls: Comma-separated list of URL patterns to block (e.g., “analytics,tracking,advertisement”).
|
|
169
|
+
delay: Delay in seconds before capturing the screenshot.
|
|
170
|
+
wait_until: Define when to capture.
|
|
171
|
+
wait_for_selector: Wait for a specific element to appear before taking the screenshot.
|
|
172
|
+
proxy: Specify a proxy server to route your request through.
|
|
173
|
+
s3_secret_key: AWS S3 secret access key.
|
|
174
|
+
s3_access_key_id: AWS S3 access key ID.
|
|
175
|
+
s3_bucket: The S3 bucket name where the screenshot will be uploaded.
|
|
176
|
+
s3_object_key: The filename for the S3 object (auto-generated if not provided).
|
|
177
|
+
s3_region: AWS S3 region for storage.
|
|
178
|
+
storage_endpoint: Leave this field empty for AWS S3. Only specify a value if required. S3-compatible storage services are supported, for example, use https://<accountId>.r2.cloudflarestorage.com for Cloudflare R2.
|
|
179
|
+
s3_url: Use S3 storage for screenshots. The S3 URL will be returned in the response.
|
|
180
|
+
fields: Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
|
|
181
|
+
is_async: Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob).
|
|
182
|
+
soft_fail: Return HTTP 200 even when an error occurs; the error is then in the response body.
|
|
183
|
+
"""
|
|
184
|
+
return self._call(
|
|
185
|
+
"capture",
|
|
186
|
+
{
|
|
187
|
+
"url": url,
|
|
188
|
+
"format": format,
|
|
189
|
+
"device": device,
|
|
190
|
+
"full_page": full_page,
|
|
191
|
+
"full_page_scroll": full_page_scroll,
|
|
192
|
+
"full_page_scroll_duration": full_page_scroll_duration,
|
|
193
|
+
"viewport_width": viewport_width,
|
|
194
|
+
"viewport_height": viewport_height,
|
|
195
|
+
"scale_factor": scale_factor,
|
|
196
|
+
"image_quality": image_quality,
|
|
197
|
+
"selector": selector,
|
|
198
|
+
"cache": cache,
|
|
199
|
+
"cache_ttl": cache_ttl,
|
|
200
|
+
"remove_selectors": remove_selectors,
|
|
201
|
+
"remove_cookie_banners": remove_cookie_banners,
|
|
202
|
+
"remove_ads": remove_ads,
|
|
203
|
+
"block_resources": block_resources,
|
|
204
|
+
"block_urls": block_urls,
|
|
205
|
+
"delay": delay,
|
|
206
|
+
"wait_until": wait_until,
|
|
207
|
+
"wait_for_selector": wait_for_selector,
|
|
208
|
+
"proxy": proxy,
|
|
209
|
+
"s3_secret_key": s3_secret_key,
|
|
210
|
+
"s3_access_key_id": s3_access_key_id,
|
|
211
|
+
"s3_bucket": s3_bucket,
|
|
212
|
+
"s3_object_key": s3_object_key,
|
|
213
|
+
"s3_region": s3_region,
|
|
214
|
+
"storage_endpoint": storage_endpoint,
|
|
215
|
+
"s3_url": s3_url,
|
|
216
|
+
"fields": fields,
|
|
217
|
+
"is_async": is_async,
|
|
218
|
+
"soft_fail": soft_fail,
|
|
219
|
+
},
|
|
220
|
+
request_options,
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
def content(
|
|
224
|
+
self,
|
|
225
|
+
*,
|
|
226
|
+
url: str,
|
|
227
|
+
include_html: bool | None = None,
|
|
228
|
+
include_markdown: bool | None = None,
|
|
229
|
+
include_sitemap: bool | None = None,
|
|
230
|
+
use_defuddle: bool | None = None,
|
|
231
|
+
remove_selectors: str | None = None,
|
|
232
|
+
remove_cookie_banners: bool | None = None,
|
|
233
|
+
remove_ads: bool | None = None,
|
|
234
|
+
block_resources: Literal[
|
|
235
|
+
"document",
|
|
236
|
+
"eventsource",
|
|
237
|
+
"fetch",
|
|
238
|
+
"font",
|
|
239
|
+
"image",
|
|
240
|
+
"manifest",
|
|
241
|
+
"media",
|
|
242
|
+
"other",
|
|
243
|
+
"script",
|
|
244
|
+
"stylesheet",
|
|
245
|
+
"texttrack",
|
|
246
|
+
"websocket",
|
|
247
|
+
"xhr",
|
|
248
|
+
]
|
|
249
|
+
| str
|
|
250
|
+
| None = None,
|
|
251
|
+
block_urls: str | None = None,
|
|
252
|
+
delay: int | float | None = None,
|
|
253
|
+
wait_until: Sequence[
|
|
254
|
+
Literal["domcontentloaded", "load", "networkidle0", "networkidle2"] | str
|
|
255
|
+
]
|
|
256
|
+
| None = None,
|
|
257
|
+
wait_for_selector: str | None = None,
|
|
258
|
+
proxy: str | None = None,
|
|
259
|
+
cache: bool | None = None,
|
|
260
|
+
cache_ttl: int | float | None = None,
|
|
261
|
+
fields: str | None = None,
|
|
262
|
+
is_async: bool | None = None,
|
|
263
|
+
soft_fail: bool | None = None,
|
|
264
|
+
request_options: RequestOptions | None = None,
|
|
265
|
+
) -> JsonResponse:
|
|
266
|
+
"""Content. CaptureKit Content API extracts structured webpage data, metadata, links, HTML/Markdown: in one request for SEO, monitoring, indexing and automation. Credit cost: 1 credit per call.
|
|
267
|
+
|
|
268
|
+
``GET / POST /v1/content``
|
|
269
|
+
|
|
270
|
+
Args:
|
|
271
|
+
url: The URL of the webpage to capture.
|
|
272
|
+
include_html: Include the raw HTML of the webpage in the response.
|
|
273
|
+
include_markdown: Include the Markdown of the webpage in the response.
|
|
274
|
+
include_sitemap: Include the sitemap of the website in the response.
|
|
275
|
+
use_defuddle: Use Defuddle to clean and extract the main content from web pages. This popular library removes unnecessary elements like comments, sidebars, headers, footers, and other non-essential elements, leavi…
|
|
276
|
+
remove_selectors: A comma-separated list of elements to hide before capturing (e.g., ads, popups).
|
|
277
|
+
remove_cookie_banners: Automatically remove cookie banners before capturing.
|
|
278
|
+
remove_ads: Automatically remove ads before capturing.
|
|
279
|
+
block_resources: Comma-separated list of resource types to block (e.g., “image,stylesheet,font”).
|
|
280
|
+
block_urls: Comma-separated list of URL patterns to block (e.g., “analytics,tracking,advertisement”).
|
|
281
|
+
delay: Delay in seconds before capturing the screenshot.
|
|
282
|
+
wait_until: Define when to capture.
|
|
283
|
+
wait_for_selector: Wait for a specific element to appear before taking the screenshot.
|
|
284
|
+
proxy: Specify a proxy server to route your request through.
|
|
285
|
+
cache: Cache the response.
|
|
286
|
+
cache_ttl: Cache the response for a custom TTL (in seconds).
|
|
287
|
+
fields: Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
|
|
288
|
+
is_async: Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob).
|
|
289
|
+
soft_fail: Return HTTP 200 even when an error occurs; the error is then in the response body.
|
|
290
|
+
"""
|
|
291
|
+
return cast(
|
|
292
|
+
JsonResponse,
|
|
293
|
+
self._call(
|
|
294
|
+
"content",
|
|
295
|
+
{
|
|
296
|
+
"url": url,
|
|
297
|
+
"include_html": include_html,
|
|
298
|
+
"include_markdown": include_markdown,
|
|
299
|
+
"include_sitemap": include_sitemap,
|
|
300
|
+
"use_defuddle": use_defuddle,
|
|
301
|
+
"remove_selectors": remove_selectors,
|
|
302
|
+
"remove_cookie_banners": remove_cookie_banners,
|
|
303
|
+
"remove_ads": remove_ads,
|
|
304
|
+
"block_resources": block_resources,
|
|
305
|
+
"block_urls": block_urls,
|
|
306
|
+
"delay": delay,
|
|
307
|
+
"wait_until": wait_until,
|
|
308
|
+
"wait_for_selector": wait_for_selector,
|
|
309
|
+
"proxy": proxy,
|
|
310
|
+
"cache": cache,
|
|
311
|
+
"cache_ttl": cache_ttl,
|
|
312
|
+
"fields": fields,
|
|
313
|
+
"is_async": is_async,
|
|
314
|
+
"soft_fail": soft_fail,
|
|
315
|
+
},
|
|
316
|
+
request_options,
|
|
317
|
+
),
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
def jobs(
|
|
321
|
+
self,
|
|
322
|
+
*,
|
|
323
|
+
id: str,
|
|
324
|
+
request_options: RequestOptions | None = None,
|
|
325
|
+
) -> JsonResponse:
|
|
326
|
+
"""Jobs. Poll the status, progress (0–100) and result of a job started with is_async=true. Polling is free. Poll until status is terminal: CompletedJob, Error, NotFound or BadRequest.
|
|
327
|
+
|
|
328
|
+
``GET /v1/jobs/{id}``
|
|
329
|
+
|
|
330
|
+
Args:
|
|
331
|
+
id: The job_id returned by an endpoint called with is_async=true.
|
|
332
|
+
"""
|
|
333
|
+
return cast(JsonResponse, self._call("jobs", {"id": id}, request_options))
|
|
334
|
+
|
|
335
|
+
def stats(
|
|
336
|
+
self,
|
|
337
|
+
*,
|
|
338
|
+
engine: str | None = None,
|
|
339
|
+
path: str | None = None,
|
|
340
|
+
request_options: RequestOptions | None = None,
|
|
341
|
+
) -> JsonResponse:
|
|
342
|
+
"""Stats. Infrastructure health for an engine or endpoint over the last hour. Not scoped to your account or tenant. Enabled per account: HTTP 403 means contact support to activate it.
|
|
343
|
+
|
|
344
|
+
``GET /v1/stats``
|
|
345
|
+
|
|
346
|
+
Args:
|
|
347
|
+
engine: API family to check, for example capture. Provide at least engine or path.
|
|
348
|
+
path: Specific endpoint to check, for example /v1/capture. If you also pass engine, use an endpoint from that API.
|
|
349
|
+
"""
|
|
350
|
+
return cast(
|
|
351
|
+
JsonResponse, self._call("stats", {"engine": engine, "path": path}, request_options)
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
def usage(
|
|
355
|
+
self,
|
|
356
|
+
*,
|
|
357
|
+
request_options: RequestOptions | None = None,
|
|
358
|
+
) -> JsonResponse:
|
|
359
|
+
"""Usage. Retrieve real-time usage statistics and credit balance for your CaptureKit account.
|
|
360
|
+
|
|
361
|
+
``GET /v1/usage``
|
|
362
|
+
"""
|
|
363
|
+
return cast(JsonResponse, self._call("usage", {}, request_options))
|
|
364
|
+
|
|
365
|
+
def website_crawler(
|
|
366
|
+
self,
|
|
367
|
+
*,
|
|
368
|
+
query: str,
|
|
369
|
+
allow_redirects: bool | None = None,
|
|
370
|
+
return_page_source: bool | None = None,
|
|
371
|
+
fields: str | None = None,
|
|
372
|
+
is_async: bool | None = None,
|
|
373
|
+
soft_fail: bool | None = None,
|
|
374
|
+
request_options: RequestOptions | None = None,
|
|
375
|
+
) -> APIResponse:
|
|
376
|
+
"""Website Crawler. Website Crawler API fetches raw HTML from any webpage in request mode (no rendering) for fast scraping, audits, monitoring, and link/metadata extraction. Credit cost: 1 credit per call.
|
|
377
|
+
|
|
378
|
+
``GET / POST /v1/website/crawler``
|
|
379
|
+
|
|
380
|
+
Args:
|
|
381
|
+
query: A website URL with either the http or https protocol.
|
|
382
|
+
allow_redirects: If set to false, do not follow redirects.
|
|
383
|
+
return_page_source: If set to true, the response will be the HTML source of the page.
|
|
384
|
+
fields: Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
|
|
385
|
+
is_async: Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob).
|
|
386
|
+
soft_fail: Return HTTP 200 even when an error occurs; the error is then in the response body.
|
|
387
|
+
"""
|
|
388
|
+
return self._call(
|
|
389
|
+
"website_crawler",
|
|
390
|
+
{
|
|
391
|
+
"query": query,
|
|
392
|
+
"allow_redirects": allow_redirects,
|
|
393
|
+
"return_page_source": return_page_source,
|
|
394
|
+
"fields": fields,
|
|
395
|
+
"is_async": is_async,
|
|
396
|
+
"soft_fail": soft_fail,
|
|
397
|
+
},
|
|
398
|
+
request_options,
|
|
399
|
+
)
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
class _AsyncOperations:
|
|
403
|
+
"""Generated CaptureKit endpoint methods."""
|
|
404
|
+
|
|
405
|
+
__slots__ = ()
|
|
406
|
+
|
|
407
|
+
async def _call(
|
|
408
|
+
self, name: str, params: dict[str, Any], options: RequestOptions | None
|
|
409
|
+
) -> APIResponse:
|
|
410
|
+
raise NotImplementedError
|
|
411
|
+
|
|
412
|
+
async def analyze(
|
|
413
|
+
self,
|
|
414
|
+
*,
|
|
415
|
+
url: str,
|
|
416
|
+
custom_response: str | None = None,
|
|
417
|
+
custom_prompt: str | None = None,
|
|
418
|
+
proxy: str | None = None,
|
|
419
|
+
cache: bool | None = None,
|
|
420
|
+
cache_ttl: int | float | None = None,
|
|
421
|
+
fields: str | None = None,
|
|
422
|
+
is_async: bool | None = None,
|
|
423
|
+
soft_fail: bool | None = None,
|
|
424
|
+
request_options: RequestOptions | None = None,
|
|
425
|
+
) -> JsonResponse:
|
|
426
|
+
"""Analyze (AI). AI Content API analyzes any webpage and returns AI insights summary, value proposition, features, categories, use cases, and optional contact signals. Credit cost: 1 credit per call.
|
|
427
|
+
|
|
428
|
+
``GET / POST /v1/analyze``
|
|
429
|
+
|
|
430
|
+
Args:
|
|
431
|
+
url: The URL of the webpage to capture.
|
|
432
|
+
custom_response: Pass custom response fields to be included in the AI response.
|
|
433
|
+
custom_prompt: Add your own instructions to guide the AI’s analysis.
|
|
434
|
+
proxy: Specify a proxy server to route your request through.
|
|
435
|
+
cache: Cache the response.
|
|
436
|
+
cache_ttl: Cache the response for a custom TTL (in seconds).
|
|
437
|
+
fields: Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
|
|
438
|
+
is_async: Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob).
|
|
439
|
+
soft_fail: Return HTTP 200 even when an error occurs; the error is then in the response body.
|
|
440
|
+
"""
|
|
441
|
+
return cast(
|
|
442
|
+
JsonResponse,
|
|
443
|
+
await self._call(
|
|
444
|
+
"analyze",
|
|
445
|
+
{
|
|
446
|
+
"url": url,
|
|
447
|
+
"custom_response": custom_response,
|
|
448
|
+
"custom_prompt": custom_prompt,
|
|
449
|
+
"proxy": proxy,
|
|
450
|
+
"cache": cache,
|
|
451
|
+
"cache_ttl": cache_ttl,
|
|
452
|
+
"fields": fields,
|
|
453
|
+
"is_async": is_async,
|
|
454
|
+
"soft_fail": soft_fail,
|
|
455
|
+
},
|
|
456
|
+
request_options,
|
|
457
|
+
),
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
async def capture(
|
|
461
|
+
self,
|
|
462
|
+
*,
|
|
463
|
+
url: str,
|
|
464
|
+
format: Literal["jpeg", "jpg", "pdf", "png", "webp"] | str | None = None,
|
|
465
|
+
device: Literal[
|
|
466
|
+
"galaxy_fold4",
|
|
467
|
+
"galaxy_s23",
|
|
468
|
+
"galaxy_s23_ultra",
|
|
469
|
+
"galaxy_s8",
|
|
470
|
+
"huawei_mate_50_pro",
|
|
471
|
+
"huawei_p60_pro",
|
|
472
|
+
"ipad",
|
|
473
|
+
"iphone_12",
|
|
474
|
+
"iphone_13_mini",
|
|
475
|
+
"iphone_13_pro_max",
|
|
476
|
+
"iphone_14_pro",
|
|
477
|
+
"iphone_14_pro_max",
|
|
478
|
+
"iphone_x",
|
|
479
|
+
"pixel_5",
|
|
480
|
+
"pixel_6a",
|
|
481
|
+
"pixel_7_pro",
|
|
482
|
+
"redmi_note_11",
|
|
483
|
+
"redmi_note_12_pro",
|
|
484
|
+
]
|
|
485
|
+
| str
|
|
486
|
+
| None = None,
|
|
487
|
+
full_page: bool | None = None,
|
|
488
|
+
full_page_scroll: bool | None = None,
|
|
489
|
+
full_page_scroll_duration: int | float | None = None,
|
|
490
|
+
viewport_width: int | float | None = None,
|
|
491
|
+
viewport_height: int | float | None = None,
|
|
492
|
+
scale_factor: int | float | None = None,
|
|
493
|
+
image_quality: str | None = None,
|
|
494
|
+
selector: str | None = None,
|
|
495
|
+
cache: bool | None = None,
|
|
496
|
+
cache_ttl: int | float | None = None,
|
|
497
|
+
remove_selectors: str | None = None,
|
|
498
|
+
remove_cookie_banners: bool | None = None,
|
|
499
|
+
remove_ads: bool | None = None,
|
|
500
|
+
block_resources: Literal[
|
|
501
|
+
"document",
|
|
502
|
+
"eventsource",
|
|
503
|
+
"fetch",
|
|
504
|
+
"font",
|
|
505
|
+
"image",
|
|
506
|
+
"manifest",
|
|
507
|
+
"media",
|
|
508
|
+
"other",
|
|
509
|
+
"script",
|
|
510
|
+
"stylesheet",
|
|
511
|
+
"texttrack",
|
|
512
|
+
"websocket",
|
|
513
|
+
"xhr",
|
|
514
|
+
]
|
|
515
|
+
| str
|
|
516
|
+
| None = None,
|
|
517
|
+
block_urls: str | None = None,
|
|
518
|
+
delay: int | float | None = None,
|
|
519
|
+
wait_until: Sequence[
|
|
520
|
+
Literal["domcontentloaded", "load", "networkidle0", "networkidle2"] | str
|
|
521
|
+
]
|
|
522
|
+
| None = None,
|
|
523
|
+
wait_for_selector: str | None = None,
|
|
524
|
+
proxy: str | None = None,
|
|
525
|
+
s3_secret_key: str | None = None,
|
|
526
|
+
s3_access_key_id: str | None = None,
|
|
527
|
+
s3_bucket: str | None = None,
|
|
528
|
+
s3_object_key: str | None = None,
|
|
529
|
+
s3_region: str | None = None,
|
|
530
|
+
storage_endpoint: str | None = None,
|
|
531
|
+
s3_url: bool | None = None,
|
|
532
|
+
fields: str | None = None,
|
|
533
|
+
is_async: bool | None = None,
|
|
534
|
+
soft_fail: bool | None = None,
|
|
535
|
+
request_options: RequestOptions | None = None,
|
|
536
|
+
) -> APIResponse:
|
|
537
|
+
"""Capture (Screenshot). Browser-like Screenshot API that captures webpages as PNG/JPEG/WebP or PDF for previews, QA, reporting, monitoring, and archiving no headless setup. Credit cost: 1 credit per call.
|
|
538
|
+
|
|
539
|
+
``GET / POST /v1/capture``
|
|
540
|
+
|
|
541
|
+
Args:
|
|
542
|
+
url: The URL of the webpage to capture. Examples: https://www.amazon.com/s?k=pokemon
|
|
543
|
+
format: The output format of the screenshot.
|
|
544
|
+
device: The device type to emulate for the screenshot.
|
|
545
|
+
full_page: Capture the entire page instead of just the visible viewport.
|
|
546
|
+
full_page_scroll: Scroll the page to fully load lazy-loaded elements before capturing a full-page screenshot.
|
|
547
|
+
full_page_scroll_duration: Time in milliseconds for scrolling before capturing the full page.
|
|
548
|
+
viewport_width: The width of the browser viewport in pixels.
|
|
549
|
+
viewport_height: The height of the browser viewport in pixels.
|
|
550
|
+
scale_factor: The scale factor for high-resolution screenshots.
|
|
551
|
+
image_quality: Generate images with custom quality settings.
|
|
552
|
+
selector: Capture a specific element on the page instead of the full viewport.
|
|
553
|
+
cache: Cache the response.
|
|
554
|
+
cache_ttl: Cache the response for a custom TTL (in seconds).
|
|
555
|
+
remove_selectors: A comma-separated list of elements to hide before capturing (e.g., ads, popups).
|
|
556
|
+
remove_cookie_banners: Automatically remove cookie banners before capturing.
|
|
557
|
+
remove_ads: Automatically remove ads before capturing.
|
|
558
|
+
block_resources: Comma-separated list of resource types to block (e.g., “image,stylesheet,font”).
|
|
559
|
+
block_urls: Comma-separated list of URL patterns to block (e.g., “analytics,tracking,advertisement”).
|
|
560
|
+
delay: Delay in seconds before capturing the screenshot.
|
|
561
|
+
wait_until: Define when to capture.
|
|
562
|
+
wait_for_selector: Wait for a specific element to appear before taking the screenshot.
|
|
563
|
+
proxy: Specify a proxy server to route your request through.
|
|
564
|
+
s3_secret_key: AWS S3 secret access key.
|
|
565
|
+
s3_access_key_id: AWS S3 access key ID.
|
|
566
|
+
s3_bucket: The S3 bucket name where the screenshot will be uploaded.
|
|
567
|
+
s3_object_key: The filename for the S3 object (auto-generated if not provided).
|
|
568
|
+
s3_region: AWS S3 region for storage.
|
|
569
|
+
storage_endpoint: Leave this field empty for AWS S3. Only specify a value if required. S3-compatible storage services are supported, for example, use https://<accountId>.r2.cloudflarestorage.com for Cloudflare R2.
|
|
570
|
+
s3_url: Use S3 storage for screenshots. The S3 URL will be returned in the response.
|
|
571
|
+
fields: Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
|
|
572
|
+
is_async: Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob).
|
|
573
|
+
soft_fail: Return HTTP 200 even when an error occurs; the error is then in the response body.
|
|
574
|
+
"""
|
|
575
|
+
return await self._call(
|
|
576
|
+
"capture",
|
|
577
|
+
{
|
|
578
|
+
"url": url,
|
|
579
|
+
"format": format,
|
|
580
|
+
"device": device,
|
|
581
|
+
"full_page": full_page,
|
|
582
|
+
"full_page_scroll": full_page_scroll,
|
|
583
|
+
"full_page_scroll_duration": full_page_scroll_duration,
|
|
584
|
+
"viewport_width": viewport_width,
|
|
585
|
+
"viewport_height": viewport_height,
|
|
586
|
+
"scale_factor": scale_factor,
|
|
587
|
+
"image_quality": image_quality,
|
|
588
|
+
"selector": selector,
|
|
589
|
+
"cache": cache,
|
|
590
|
+
"cache_ttl": cache_ttl,
|
|
591
|
+
"remove_selectors": remove_selectors,
|
|
592
|
+
"remove_cookie_banners": remove_cookie_banners,
|
|
593
|
+
"remove_ads": remove_ads,
|
|
594
|
+
"block_resources": block_resources,
|
|
595
|
+
"block_urls": block_urls,
|
|
596
|
+
"delay": delay,
|
|
597
|
+
"wait_until": wait_until,
|
|
598
|
+
"wait_for_selector": wait_for_selector,
|
|
599
|
+
"proxy": proxy,
|
|
600
|
+
"s3_secret_key": s3_secret_key,
|
|
601
|
+
"s3_access_key_id": s3_access_key_id,
|
|
602
|
+
"s3_bucket": s3_bucket,
|
|
603
|
+
"s3_object_key": s3_object_key,
|
|
604
|
+
"s3_region": s3_region,
|
|
605
|
+
"storage_endpoint": storage_endpoint,
|
|
606
|
+
"s3_url": s3_url,
|
|
607
|
+
"fields": fields,
|
|
608
|
+
"is_async": is_async,
|
|
609
|
+
"soft_fail": soft_fail,
|
|
610
|
+
},
|
|
611
|
+
request_options,
|
|
612
|
+
)
|
|
613
|
+
|
|
614
|
+
async def content(
|
|
615
|
+
self,
|
|
616
|
+
*,
|
|
617
|
+
url: str,
|
|
618
|
+
include_html: bool | None = None,
|
|
619
|
+
include_markdown: bool | None = None,
|
|
620
|
+
include_sitemap: bool | None = None,
|
|
621
|
+
use_defuddle: bool | None = None,
|
|
622
|
+
remove_selectors: str | None = None,
|
|
623
|
+
remove_cookie_banners: bool | None = None,
|
|
624
|
+
remove_ads: bool | None = None,
|
|
625
|
+
block_resources: Literal[
|
|
626
|
+
"document",
|
|
627
|
+
"eventsource",
|
|
628
|
+
"fetch",
|
|
629
|
+
"font",
|
|
630
|
+
"image",
|
|
631
|
+
"manifest",
|
|
632
|
+
"media",
|
|
633
|
+
"other",
|
|
634
|
+
"script",
|
|
635
|
+
"stylesheet",
|
|
636
|
+
"texttrack",
|
|
637
|
+
"websocket",
|
|
638
|
+
"xhr",
|
|
639
|
+
]
|
|
640
|
+
| str
|
|
641
|
+
| None = None,
|
|
642
|
+
block_urls: str | None = None,
|
|
643
|
+
delay: int | float | None = None,
|
|
644
|
+
wait_until: Sequence[
|
|
645
|
+
Literal["domcontentloaded", "load", "networkidle0", "networkidle2"] | str
|
|
646
|
+
]
|
|
647
|
+
| None = None,
|
|
648
|
+
wait_for_selector: str | None = None,
|
|
649
|
+
proxy: str | None = None,
|
|
650
|
+
cache: bool | None = None,
|
|
651
|
+
cache_ttl: int | float | None = None,
|
|
652
|
+
fields: str | None = None,
|
|
653
|
+
is_async: bool | None = None,
|
|
654
|
+
soft_fail: bool | None = None,
|
|
655
|
+
request_options: RequestOptions | None = None,
|
|
656
|
+
) -> JsonResponse:
|
|
657
|
+
"""Content. CaptureKit Content API extracts structured webpage data, metadata, links, HTML/Markdown: in one request for SEO, monitoring, indexing and automation. Credit cost: 1 credit per call.
|
|
658
|
+
|
|
659
|
+
``GET / POST /v1/content``
|
|
660
|
+
|
|
661
|
+
Args:
|
|
662
|
+
url: The URL of the webpage to capture.
|
|
663
|
+
include_html: Include the raw HTML of the webpage in the response.
|
|
664
|
+
include_markdown: Include the Markdown of the webpage in the response.
|
|
665
|
+
include_sitemap: Include the sitemap of the website in the response.
|
|
666
|
+
use_defuddle: Use Defuddle to clean and extract the main content from web pages. This popular library removes unnecessary elements like comments, sidebars, headers, footers, and other non-essential elements, leavi…
|
|
667
|
+
remove_selectors: A comma-separated list of elements to hide before capturing (e.g., ads, popups).
|
|
668
|
+
remove_cookie_banners: Automatically remove cookie banners before capturing.
|
|
669
|
+
remove_ads: Automatically remove ads before capturing.
|
|
670
|
+
block_resources: Comma-separated list of resource types to block (e.g., “image,stylesheet,font”).
|
|
671
|
+
block_urls: Comma-separated list of URL patterns to block (e.g., “analytics,tracking,advertisement”).
|
|
672
|
+
delay: Delay in seconds before capturing the screenshot.
|
|
673
|
+
wait_until: Define when to capture.
|
|
674
|
+
wait_for_selector: Wait for a specific element to appear before taking the screenshot.
|
|
675
|
+
proxy: Specify a proxy server to route your request through.
|
|
676
|
+
cache: Cache the response.
|
|
677
|
+
cache_ttl: Cache the response for a custom TTL (in seconds).
|
|
678
|
+
fields: Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
|
|
679
|
+
is_async: Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob).
|
|
680
|
+
soft_fail: Return HTTP 200 even when an error occurs; the error is then in the response body.
|
|
681
|
+
"""
|
|
682
|
+
return cast(
|
|
683
|
+
JsonResponse,
|
|
684
|
+
await self._call(
|
|
685
|
+
"content",
|
|
686
|
+
{
|
|
687
|
+
"url": url,
|
|
688
|
+
"include_html": include_html,
|
|
689
|
+
"include_markdown": include_markdown,
|
|
690
|
+
"include_sitemap": include_sitemap,
|
|
691
|
+
"use_defuddle": use_defuddle,
|
|
692
|
+
"remove_selectors": remove_selectors,
|
|
693
|
+
"remove_cookie_banners": remove_cookie_banners,
|
|
694
|
+
"remove_ads": remove_ads,
|
|
695
|
+
"block_resources": block_resources,
|
|
696
|
+
"block_urls": block_urls,
|
|
697
|
+
"delay": delay,
|
|
698
|
+
"wait_until": wait_until,
|
|
699
|
+
"wait_for_selector": wait_for_selector,
|
|
700
|
+
"proxy": proxy,
|
|
701
|
+
"cache": cache,
|
|
702
|
+
"cache_ttl": cache_ttl,
|
|
703
|
+
"fields": fields,
|
|
704
|
+
"is_async": is_async,
|
|
705
|
+
"soft_fail": soft_fail,
|
|
706
|
+
},
|
|
707
|
+
request_options,
|
|
708
|
+
),
|
|
709
|
+
)
|
|
710
|
+
|
|
711
|
+
async def jobs(
|
|
712
|
+
self,
|
|
713
|
+
*,
|
|
714
|
+
id: str,
|
|
715
|
+
request_options: RequestOptions | None = None,
|
|
716
|
+
) -> JsonResponse:
|
|
717
|
+
"""Jobs. Poll the status, progress (0–100) and result of a job started with is_async=true. Polling is free. Poll until status is terminal: CompletedJob, Error, NotFound or BadRequest.
|
|
718
|
+
|
|
719
|
+
``GET /v1/jobs/{id}``
|
|
720
|
+
|
|
721
|
+
Args:
|
|
722
|
+
id: The job_id returned by an endpoint called with is_async=true.
|
|
723
|
+
"""
|
|
724
|
+
return cast(JsonResponse, await self._call("jobs", {"id": id}, request_options))
|
|
725
|
+
|
|
726
|
+
async def stats(
|
|
727
|
+
self,
|
|
728
|
+
*,
|
|
729
|
+
engine: str | None = None,
|
|
730
|
+
path: str | None = None,
|
|
731
|
+
request_options: RequestOptions | None = None,
|
|
732
|
+
) -> JsonResponse:
|
|
733
|
+
"""Stats. Infrastructure health for an engine or endpoint over the last hour. Not scoped to your account or tenant. Enabled per account: HTTP 403 means contact support to activate it.
|
|
734
|
+
|
|
735
|
+
``GET /v1/stats``
|
|
736
|
+
|
|
737
|
+
Args:
|
|
738
|
+
engine: API family to check, for example capture. Provide at least engine or path.
|
|
739
|
+
path: Specific endpoint to check, for example /v1/capture. If you also pass engine, use an endpoint from that API.
|
|
740
|
+
"""
|
|
741
|
+
return cast(
|
|
742
|
+
JsonResponse,
|
|
743
|
+
await self._call("stats", {"engine": engine, "path": path}, request_options),
|
|
744
|
+
)
|
|
745
|
+
|
|
746
|
+
async def usage(
|
|
747
|
+
self,
|
|
748
|
+
*,
|
|
749
|
+
request_options: RequestOptions | None = None,
|
|
750
|
+
) -> JsonResponse:
|
|
751
|
+
"""Usage. Retrieve real-time usage statistics and credit balance for your CaptureKit account.
|
|
752
|
+
|
|
753
|
+
``GET /v1/usage``
|
|
754
|
+
"""
|
|
755
|
+
return cast(JsonResponse, await self._call("usage", {}, request_options))
|
|
756
|
+
|
|
757
|
+
async def website_crawler(
|
|
758
|
+
self,
|
|
759
|
+
*,
|
|
760
|
+
query: str,
|
|
761
|
+
allow_redirects: bool | None = None,
|
|
762
|
+
return_page_source: bool | None = None,
|
|
763
|
+
fields: str | None = None,
|
|
764
|
+
is_async: bool | None = None,
|
|
765
|
+
soft_fail: bool | None = None,
|
|
766
|
+
request_options: RequestOptions | None = None,
|
|
767
|
+
) -> APIResponse:
|
|
768
|
+
"""Website Crawler. Website Crawler API fetches raw HTML from any webpage in request mode (no rendering) for fast scraping, audits, monitoring, and link/metadata extraction. Credit cost: 1 credit per call.
|
|
769
|
+
|
|
770
|
+
``GET / POST /v1/website/crawler``
|
|
771
|
+
|
|
772
|
+
Args:
|
|
773
|
+
query: A website URL with either the http or https protocol.
|
|
774
|
+
allow_redirects: If set to false, do not follow redirects.
|
|
775
|
+
return_page_source: If set to true, the response will be the HTML source of the page.
|
|
776
|
+
fields: Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
|
|
777
|
+
is_async: Process the request asynchronously: the response is a job_id to poll on /v1/jobs/{id} (see waitForJob).
|
|
778
|
+
soft_fail: Return HTTP 200 even when an error occurs; the error is then in the response body.
|
|
779
|
+
"""
|
|
780
|
+
return await self._call(
|
|
781
|
+
"website_crawler",
|
|
782
|
+
{
|
|
783
|
+
"query": query,
|
|
784
|
+
"allow_redirects": allow_redirects,
|
|
785
|
+
"return_page_source": return_page_source,
|
|
786
|
+
"fields": fields,
|
|
787
|
+
"is_async": is_async,
|
|
788
|
+
"soft_fail": soft_fail,
|
|
789
|
+
},
|
|
790
|
+
request_options,
|
|
791
|
+
)
|