context.dev 1.23.0 → 1.25.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +1 -1
- data/lib/context_dev/internal/type/base_model.rb +5 -5
- data/lib/context_dev/models/web_extract_fonts_params.rb +12 -1
- data/lib/context_dev/models/web_extract_params.rb +148 -0
- data/lib/context_dev/models/web_extract_response.rb +83 -0
- data/lib/context_dev/models/web_extract_styleguide_params.rb +12 -1
- data/lib/context_dev/models.rb +2 -0
- data/lib/context_dev/resources/web.rb +64 -4
- data/lib/context_dev/version.rb +1 -1
- data/lib/context_dev.rb +2 -0
- data/rbi/context_dev/models/web_extract_fonts_params.rbi +17 -0
- data/rbi/context_dev/models/web_extract_params.rbi +232 -0
- data/rbi/context_dev/models/web_extract_response.rbi +134 -0
- data/rbi/context_dev/models/web_extract_styleguide_params.rbi +17 -0
- data/rbi/context_dev/models.rbi +2 -0
- data/rbi/context_dev/resources/web.rbi +71 -0
- data/sig/context_dev/models/web_extract_fonts_params.rbs +12 -1
- data/sig/context_dev/models/web_extract_params.rbs +120 -0
- data/sig/context_dev/models/web_extract_response.rbs +77 -0
- data/sig/context_dev/models/web_extract_styleguide_params.rbs +12 -1
- data/sig/context_dev/models.rbs +2 -0
- data/sig/context_dev/resources/web.rbs +17 -0
- metadata +8 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f1a0062418eca906ad8f308d3ab6541bd3a6c9f0b8bc1805b58a978e7aea61c2
|
|
4
|
+
data.tar.gz: a02eb3ec2fe28d611a14d976810b5ff51c2e2c49e432cdea9d89661eaae2de9c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7b3c3c7ff3f1e75e6199c810205c287cb0b1e03ff2cf332a2392e5e5880a3722090959d96b39bd39dddefd1c4961faf569d03c10fbcda26e9231ad67875dd45b
|
|
7
|
+
data.tar.gz: 5aef11c0e5b365ad204eced64e126807a96dfe32351da7940a2f780c07c461bcf0e2e8542e2e2cbfc8af6fa41d49864788b9979101e3d42e8920fb853c4ce5da
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.25.0 (2026-05-31)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v1.24.0...v1.25.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.24.0...v1.25.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** manual updates ([688e5f5](https://github.com/context-dot-dev/context-ruby-sdk/commit/688e5f56137aeac7c5219383f241a459173f961f))
|
|
10
|
+
|
|
11
|
+
## 1.24.0 (2026-05-30)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v1.23.0...v1.24.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.23.0...v1.24.0)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **api:** api update ([7948cbf](https://github.com/context-dot-dev/context-ruby-sdk/commit/7948cbf296742dd0fea7c08c148962a35ed88c20))
|
|
18
|
+
|
|
3
19
|
## 1.23.0 (2026-05-19)
|
|
4
20
|
|
|
5
21
|
Full Changelog: [v1.22.0...v1.23.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.22.0...v1.23.0)
|
data/README.md
CHANGED
|
@@ -438,11 +438,11 @@ module ContextDev
|
|
|
438
438
|
# @return [Hash{Symbol=>Object}]
|
|
439
439
|
#
|
|
440
440
|
# @example
|
|
441
|
-
# # `
|
|
442
|
-
#
|
|
443
|
-
#
|
|
444
|
-
#
|
|
445
|
-
#
|
|
441
|
+
# # `web_extract_response` is a `ContextDev::Models::WebExtractResponse`
|
|
442
|
+
# web_extract_response => {
|
|
443
|
+
# data: data,
|
|
444
|
+
# metadata: metadata,
|
|
445
|
+
# status: status
|
|
446
446
|
# }
|
|
447
447
|
def deconstruct_keys(keys)
|
|
448
448
|
(keys || self.class.known_fields.keys)
|
|
@@ -23,6 +23,15 @@ module ContextDev
|
|
|
23
23
|
# @return [String, nil]
|
|
24
24
|
optional :domain, String
|
|
25
25
|
|
|
26
|
+
# @!attribute max_age_ms
|
|
27
|
+
# Maximum age in milliseconds for cached data before the API performs a hard
|
|
28
|
+
# refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
|
|
29
|
+
# are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
|
|
30
|
+
# year.
|
|
31
|
+
#
|
|
32
|
+
# @return [Integer, nil]
|
|
33
|
+
optional :max_age_ms, Integer
|
|
34
|
+
|
|
26
35
|
# @!attribute timeout_ms
|
|
27
36
|
# Optional timeout in milliseconds for the request. If the request takes longer
|
|
28
37
|
# than this value, it will be aborted with a 408 status code. Maximum allowed
|
|
@@ -31,7 +40,7 @@ module ContextDev
|
|
|
31
40
|
# @return [Integer, nil]
|
|
32
41
|
optional :timeout_ms, Integer
|
|
33
42
|
|
|
34
|
-
# @!method initialize(direct_url: nil, domain: nil, timeout_ms: nil, request_options: {})
|
|
43
|
+
# @!method initialize(direct_url: nil, domain: nil, max_age_ms: nil, timeout_ms: nil, request_options: {})
|
|
35
44
|
# Some parameter documentations has been truncated, see
|
|
36
45
|
# {ContextDev::Models::WebExtractFontsParams} for more details.
|
|
37
46
|
#
|
|
@@ -39,6 +48,8 @@ module ContextDev
|
|
|
39
48
|
#
|
|
40
49
|
# @param domain [String] Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The domai
|
|
41
50
|
#
|
|
51
|
+
# @param max_age_ms [Integer] Maximum age in milliseconds for cached data before the API performs a hard refre
|
|
52
|
+
#
|
|
42
53
|
# @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
|
|
43
54
|
#
|
|
44
55
|
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ContextDev
|
|
4
|
+
module Models
|
|
5
|
+
# @see ContextDev::Resources::Web#extract
|
|
6
|
+
class WebExtractParams < ContextDev::Internal::Type::BaseModel
|
|
7
|
+
extend ContextDev::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include ContextDev::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute schema
|
|
11
|
+
# JSON Schema for the returned data object. TypeScript Zod users can pass a JSON
|
|
12
|
+
# Schema generated from a Zod object; Python users can pass the equivalent JSON
|
|
13
|
+
# Schema object.
|
|
14
|
+
#
|
|
15
|
+
# @return [Hash{Symbol=>Object}]
|
|
16
|
+
required :schema, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown]
|
|
17
|
+
|
|
18
|
+
# @!attribute url
|
|
19
|
+
# The starting website URL to crawl and extract from. Must include http:// or
|
|
20
|
+
# https://.
|
|
21
|
+
#
|
|
22
|
+
# @return [String]
|
|
23
|
+
required :url, String
|
|
24
|
+
|
|
25
|
+
# @!attribute fact_check
|
|
26
|
+
# When true (default), every returned value must be grounded in facts stated on
|
|
27
|
+
# the page; fields that cannot be supported by the page are returned as
|
|
28
|
+
# null/empty. When false, the model may make reasonable inferences and derivations
|
|
29
|
+
# from the page content (e.g. ideal customer, competitor analysis,
|
|
30
|
+
# recommendations) while keeping verifiable specifics (names, quotes, URLs, dates,
|
|
31
|
+
# metrics) faithful to the source.
|
|
32
|
+
#
|
|
33
|
+
# @return [Boolean, nil]
|
|
34
|
+
optional :fact_check, ContextDev::Internal::Type::Boolean, api_name: :factCheck
|
|
35
|
+
|
|
36
|
+
# @!attribute follow_subdomains
|
|
37
|
+
# When true, follow links on subdomains of the starting URL's domain.
|
|
38
|
+
#
|
|
39
|
+
# @return [Boolean, nil]
|
|
40
|
+
optional :follow_subdomains, ContextDev::Internal::Type::Boolean, api_name: :followSubdomains
|
|
41
|
+
|
|
42
|
+
# @!attribute include_frames
|
|
43
|
+
# When true, iframe contents are included in Markdown before extraction.
|
|
44
|
+
#
|
|
45
|
+
# @return [Boolean, nil]
|
|
46
|
+
optional :include_frames, ContextDev::Internal::Type::Boolean, api_name: :includeFrames
|
|
47
|
+
|
|
48
|
+
# @!attribute instructions
|
|
49
|
+
# Optional extraction guidance, such as which facts to prioritize or how to
|
|
50
|
+
# interpret fields in the schema.
|
|
51
|
+
#
|
|
52
|
+
# @return [String, nil]
|
|
53
|
+
optional :instructions, String
|
|
54
|
+
|
|
55
|
+
# @!attribute max_age_ms
|
|
56
|
+
# Return cached scrape results if a prior scrape for the same parameters is
|
|
57
|
+
# younger than this many milliseconds.
|
|
58
|
+
#
|
|
59
|
+
# @return [Integer, nil]
|
|
60
|
+
optional :max_age_ms, Integer, api_name: :maxAgeMs
|
|
61
|
+
|
|
62
|
+
# @!attribute pdf
|
|
63
|
+
#
|
|
64
|
+
# @return [ContextDev::Models::WebExtractParams::Pdf, nil]
|
|
65
|
+
optional :pdf, -> { ContextDev::WebExtractParams::Pdf }
|
|
66
|
+
|
|
67
|
+
# @!attribute stop_after_ms
|
|
68
|
+
# Soft time budget for the crawl in milliseconds.
|
|
69
|
+
#
|
|
70
|
+
# @return [Integer, nil]
|
|
71
|
+
optional :stop_after_ms, Integer, api_name: :stopAfterMs
|
|
72
|
+
|
|
73
|
+
# @!attribute timeout_ms
|
|
74
|
+
# Optional timeout in milliseconds for the request. If the request takes longer
|
|
75
|
+
# than this value, it will be aborted with a 408 status code. Maximum allowed
|
|
76
|
+
# value is 300000ms (5 minutes).
|
|
77
|
+
#
|
|
78
|
+
# @return [Integer, nil]
|
|
79
|
+
optional :timeout_ms, Integer, api_name: :timeoutMS
|
|
80
|
+
|
|
81
|
+
# @!attribute wait_for_ms
|
|
82
|
+
# Optional browser wait time in milliseconds after initial page load for each
|
|
83
|
+
# crawled page.
|
|
84
|
+
#
|
|
85
|
+
# @return [Integer, nil]
|
|
86
|
+
optional :wait_for_ms, Integer, api_name: :waitForMs
|
|
87
|
+
|
|
88
|
+
# @!method initialize(schema:, url:, fact_check: nil, follow_subdomains: nil, include_frames: nil, instructions: nil, max_age_ms: nil, pdf: nil, stop_after_ms: nil, timeout_ms: nil, wait_for_ms: nil, request_options: {})
|
|
89
|
+
# Some parameter documentations has been truncated, see
|
|
90
|
+
# {ContextDev::Models::WebExtractParams} for more details.
|
|
91
|
+
#
|
|
92
|
+
# @param schema [Hash{Symbol=>Object}] JSON Schema for the returned data object. TypeScript Zod users can pass a JSON S
|
|
93
|
+
#
|
|
94
|
+
# @param url [String] The starting website URL to crawl and extract from. Must include http:// or http
|
|
95
|
+
#
|
|
96
|
+
# @param fact_check [Boolean] When true (default), every returned value must be grounded in facts stated on th
|
|
97
|
+
#
|
|
98
|
+
# @param follow_subdomains [Boolean] When true, follow links on subdomains of the starting URL's domain.
|
|
99
|
+
#
|
|
100
|
+
# @param include_frames [Boolean] When true, iframe contents are included in Markdown before extraction.
|
|
101
|
+
#
|
|
102
|
+
# @param instructions [String] Optional extraction guidance, such as which facts to prioritize or how to interp
|
|
103
|
+
#
|
|
104
|
+
# @param max_age_ms [Integer] Return cached scrape results if a prior scrape for the same parameters is younge
|
|
105
|
+
#
|
|
106
|
+
# @param pdf [ContextDev::Models::WebExtractParams::Pdf]
|
|
107
|
+
#
|
|
108
|
+
# @param stop_after_ms [Integer] Soft time budget for the crawl in milliseconds.
|
|
109
|
+
#
|
|
110
|
+
# @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
|
|
111
|
+
#
|
|
112
|
+
# @param wait_for_ms [Integer] Optional browser wait time in milliseconds after initial page load for each craw
|
|
113
|
+
#
|
|
114
|
+
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]
|
|
115
|
+
|
|
116
|
+
class Pdf < ContextDev::Internal::Type::BaseModel
|
|
117
|
+
# @!attribute end_
|
|
118
|
+
# Last 1-based PDF page to parse. Must be greater than or equal to start when both
|
|
119
|
+
# are provided.
|
|
120
|
+
#
|
|
121
|
+
# @return [Integer, nil]
|
|
122
|
+
optional :end_, Integer, api_name: :end
|
|
123
|
+
|
|
124
|
+
# @!attribute should_parse
|
|
125
|
+
# When true, PDF pages are fetched and parsed. When false, PDF pages are skipped.
|
|
126
|
+
#
|
|
127
|
+
# @return [Boolean, nil]
|
|
128
|
+
optional :should_parse, ContextDev::Internal::Type::Boolean, api_name: :shouldParse
|
|
129
|
+
|
|
130
|
+
# @!attribute start
|
|
131
|
+
# First 1-based PDF page to parse.
|
|
132
|
+
#
|
|
133
|
+
# @return [Integer, nil]
|
|
134
|
+
optional :start, Integer
|
|
135
|
+
|
|
136
|
+
# @!method initialize(end_: nil, should_parse: nil, start: nil)
|
|
137
|
+
# Some parameter documentations has been truncated, see
|
|
138
|
+
# {ContextDev::Models::WebExtractParams::Pdf} for more details.
|
|
139
|
+
#
|
|
140
|
+
# @param end_ [Integer] Last 1-based PDF page to parse. Must be greater than or equal to start when both
|
|
141
|
+
#
|
|
142
|
+
# @param should_parse [Boolean] When true, PDF pages are fetched and parsed. When false, PDF pages are skipped.
|
|
143
|
+
#
|
|
144
|
+
# @param start [Integer] First 1-based PDF page to parse.
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ContextDev
|
|
4
|
+
module Models
|
|
5
|
+
# @see ContextDev::Resources::Web#extract
|
|
6
|
+
class WebExtractResponse < ContextDev::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute data
|
|
8
|
+
# Extracted data matching the request schema
|
|
9
|
+
#
|
|
10
|
+
# @return [Hash{Symbol=>Object}]
|
|
11
|
+
required :data, ContextDev::Internal::Type::HashOf[ContextDev::Internal::Type::Unknown]
|
|
12
|
+
|
|
13
|
+
# @!attribute metadata
|
|
14
|
+
#
|
|
15
|
+
# @return [ContextDev::Models::WebExtractResponse::Metadata]
|
|
16
|
+
required :metadata, -> { ContextDev::Models::WebExtractResponse::Metadata }
|
|
17
|
+
|
|
18
|
+
# @!attribute status
|
|
19
|
+
# Status of the response, e.g., 'ok'
|
|
20
|
+
#
|
|
21
|
+
# @return [String]
|
|
22
|
+
required :status, String
|
|
23
|
+
|
|
24
|
+
# @!attribute url
|
|
25
|
+
# The starting URL that was analyzed
|
|
26
|
+
#
|
|
27
|
+
# @return [String]
|
|
28
|
+
required :url, String
|
|
29
|
+
|
|
30
|
+
# @!attribute urls_analyzed
|
|
31
|
+
# List of URLs whose Markdown was used for extraction
|
|
32
|
+
#
|
|
33
|
+
# @return [Array<String>]
|
|
34
|
+
required :urls_analyzed, ContextDev::Internal::Type::ArrayOf[String]
|
|
35
|
+
|
|
36
|
+
# @!method initialize(data:, metadata:, status:, url:, urls_analyzed:)
|
|
37
|
+
# @param data [Hash{Symbol=>Object}] Extracted data matching the request schema
|
|
38
|
+
#
|
|
39
|
+
# @param metadata [ContextDev::Models::WebExtractResponse::Metadata]
|
|
40
|
+
#
|
|
41
|
+
# @param status [String] Status of the response, e.g., 'ok'
|
|
42
|
+
#
|
|
43
|
+
# @param url [String] The starting URL that was analyzed
|
|
44
|
+
#
|
|
45
|
+
# @param urls_analyzed [Array<String>] List of URLs whose Markdown was used for extraction
|
|
46
|
+
|
|
47
|
+
# @see ContextDev::Models::WebExtractResponse#metadata
|
|
48
|
+
class Metadata < ContextDev::Internal::Type::BaseModel
|
|
49
|
+
# @!attribute max_crawl_depth
|
|
50
|
+
#
|
|
51
|
+
# @return [Integer]
|
|
52
|
+
required :max_crawl_depth, Integer, api_name: :maxCrawlDepth
|
|
53
|
+
|
|
54
|
+
# @!attribute num_failed
|
|
55
|
+
#
|
|
56
|
+
# @return [Integer]
|
|
57
|
+
required :num_failed, Integer, api_name: :numFailed
|
|
58
|
+
|
|
59
|
+
# @!attribute num_skipped
|
|
60
|
+
#
|
|
61
|
+
# @return [Integer]
|
|
62
|
+
required :num_skipped, Integer, api_name: :numSkipped
|
|
63
|
+
|
|
64
|
+
# @!attribute num_succeeded
|
|
65
|
+
#
|
|
66
|
+
# @return [Integer]
|
|
67
|
+
required :num_succeeded, Integer, api_name: :numSucceeded
|
|
68
|
+
|
|
69
|
+
# @!attribute num_urls
|
|
70
|
+
#
|
|
71
|
+
# @return [Integer]
|
|
72
|
+
required :num_urls, Integer, api_name: :numUrls
|
|
73
|
+
|
|
74
|
+
# @!method initialize(max_crawl_depth:, num_failed:, num_skipped:, num_succeeded:, num_urls:)
|
|
75
|
+
# @param max_crawl_depth [Integer]
|
|
76
|
+
# @param num_failed [Integer]
|
|
77
|
+
# @param num_skipped [Integer]
|
|
78
|
+
# @param num_succeeded [Integer]
|
|
79
|
+
# @param num_urls [Integer]
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -24,6 +24,15 @@ module ContextDev
|
|
|
24
24
|
# @return [String, nil]
|
|
25
25
|
optional :domain, String
|
|
26
26
|
|
|
27
|
+
# @!attribute max_age_ms
|
|
28
|
+
# Maximum age in milliseconds for cached data before the API performs a hard
|
|
29
|
+
# refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
|
|
30
|
+
# are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
|
|
31
|
+
# year.
|
|
32
|
+
#
|
|
33
|
+
# @return [Integer, nil]
|
|
34
|
+
optional :max_age_ms, Integer
|
|
35
|
+
|
|
27
36
|
# @!attribute timeout_ms
|
|
28
37
|
# Optional timeout in milliseconds for the request. If the request takes longer
|
|
29
38
|
# than this value, it will be aborted with a 408 status code. Maximum allowed
|
|
@@ -32,7 +41,7 @@ module ContextDev
|
|
|
32
41
|
# @return [Integer, nil]
|
|
33
42
|
optional :timeout_ms, Integer
|
|
34
43
|
|
|
35
|
-
# @!method initialize(direct_url: nil, domain: nil, timeout_ms: nil, request_options: {})
|
|
44
|
+
# @!method initialize(direct_url: nil, domain: nil, max_age_ms: nil, timeout_ms: nil, request_options: {})
|
|
36
45
|
# Some parameter documentations has been truncated, see
|
|
37
46
|
# {ContextDev::Models::WebExtractStyleguideParams} for more details.
|
|
38
47
|
#
|
|
@@ -40,6 +49,8 @@ module ContextDev
|
|
|
40
49
|
#
|
|
41
50
|
# @param domain [String] Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The
|
|
42
51
|
#
|
|
52
|
+
# @param max_age_ms [Integer] Maximum age in milliseconds for cached data before the API performs a hard refre
|
|
53
|
+
#
|
|
43
54
|
# @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
|
|
44
55
|
#
|
|
45
56
|
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]
|
data/lib/context_dev/models.rb
CHANGED
|
@@ -69,6 +69,8 @@ module ContextDev
|
|
|
69
69
|
|
|
70
70
|
WebExtractFontsParams = ContextDev::Models::WebExtractFontsParams
|
|
71
71
|
|
|
72
|
+
WebExtractParams = ContextDev::Models::WebExtractParams
|
|
73
|
+
|
|
72
74
|
WebExtractStyleguideParams = ContextDev::Models::WebExtractStyleguideParams
|
|
73
75
|
|
|
74
76
|
WebScreenshotParams = ContextDev::Models::WebScreenshotParams
|
|
@@ -3,18 +3,68 @@
|
|
|
3
3
|
module ContextDev
|
|
4
4
|
module Resources
|
|
5
5
|
class Web
|
|
6
|
+
# Some parameter documentations has been truncated, see
|
|
7
|
+
# {ContextDev::Models::WebExtractParams} for more details.
|
|
8
|
+
#
|
|
9
|
+
# Crawl a website, convert pages to Markdown using the scrape cache, and extract
|
|
10
|
+
# structured data into the provided JSON Schema. The schema must describe the
|
|
11
|
+
# response data object. This endpoint does not accept targeted page-type
|
|
12
|
+
# selection.
|
|
13
|
+
#
|
|
14
|
+
# @overload extract(schema:, url:, fact_check: nil, follow_subdomains: nil, include_frames: nil, instructions: nil, max_age_ms: nil, pdf: nil, stop_after_ms: nil, timeout_ms: nil, wait_for_ms: nil, request_options: {})
|
|
15
|
+
#
|
|
16
|
+
# @param schema [Hash{Symbol=>Object}] JSON Schema for the returned data object. TypeScript Zod users can pass a JSON S
|
|
17
|
+
#
|
|
18
|
+
# @param url [String] The starting website URL to crawl and extract from. Must include http:// or http
|
|
19
|
+
#
|
|
20
|
+
# @param fact_check [Boolean] When true (default), every returned value must be grounded in facts stated on th
|
|
21
|
+
#
|
|
22
|
+
# @param follow_subdomains [Boolean] When true, follow links on subdomains of the starting URL's domain.
|
|
23
|
+
#
|
|
24
|
+
# @param include_frames [Boolean] When true, iframe contents are included in Markdown before extraction.
|
|
25
|
+
#
|
|
26
|
+
# @param instructions [String] Optional extraction guidance, such as which facts to prioritize or how to interp
|
|
27
|
+
#
|
|
28
|
+
# @param max_age_ms [Integer] Return cached scrape results if a prior scrape for the same parameters is younge
|
|
29
|
+
#
|
|
30
|
+
# @param pdf [ContextDev::Models::WebExtractParams::Pdf]
|
|
31
|
+
#
|
|
32
|
+
# @param stop_after_ms [Integer] Soft time budget for the crawl in milliseconds.
|
|
33
|
+
#
|
|
34
|
+
# @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
|
|
35
|
+
#
|
|
36
|
+
# @param wait_for_ms [Integer] Optional browser wait time in milliseconds after initial page load for each craw
|
|
37
|
+
#
|
|
38
|
+
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
39
|
+
#
|
|
40
|
+
# @return [ContextDev::Models::WebExtractResponse]
|
|
41
|
+
#
|
|
42
|
+
# @see ContextDev::Models::WebExtractParams
|
|
43
|
+
def extract(params)
|
|
44
|
+
parsed, options = ContextDev::WebExtractParams.dump_request(params)
|
|
45
|
+
@client.request(
|
|
46
|
+
method: :post,
|
|
47
|
+
path: "web/extract",
|
|
48
|
+
body: parsed,
|
|
49
|
+
model: ContextDev::Models::WebExtractResponse,
|
|
50
|
+
options: options
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
|
|
6
54
|
# Some parameter documentations has been truncated, see
|
|
7
55
|
# {ContextDev::Models::WebExtractFontsParams} for more details.
|
|
8
56
|
#
|
|
9
57
|
# Scrape font information from a website including font families, usage
|
|
10
58
|
# statistics, fallbacks, and element/word counts.
|
|
11
59
|
#
|
|
12
|
-
# @overload extract_fonts(direct_url: nil, domain: nil, timeout_ms: nil, request_options: {})
|
|
60
|
+
# @overload extract_fonts(direct_url: nil, domain: nil, max_age_ms: nil, timeout_ms: nil, request_options: {})
|
|
13
61
|
#
|
|
14
62
|
# @param direct_url [String] A specific URL to fetch fonts from directly, bypassing domain resolution (e.g.,
|
|
15
63
|
#
|
|
16
64
|
# @param domain [String] Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The domai
|
|
17
65
|
#
|
|
66
|
+
# @param max_age_ms [Integer] Maximum age in milliseconds for cached data before the API performs a hard refre
|
|
67
|
+
#
|
|
18
68
|
# @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
|
|
19
69
|
#
|
|
20
70
|
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
@@ -28,7 +78,11 @@ module ContextDev
|
|
|
28
78
|
@client.request(
|
|
29
79
|
method: :get,
|
|
30
80
|
path: "web/fonts",
|
|
31
|
-
query: query.transform_keys(
|
|
81
|
+
query: query.transform_keys(
|
|
82
|
+
direct_url: "directUrl",
|
|
83
|
+
max_age_ms: "maxAgeMs",
|
|
84
|
+
timeout_ms: "timeoutMS"
|
|
85
|
+
),
|
|
32
86
|
model: ContextDev::Models::WebExtractFontsResponse,
|
|
33
87
|
options: options
|
|
34
88
|
)
|
|
@@ -40,12 +94,14 @@ module ContextDev
|
|
|
40
94
|
# Extract a comprehensive design system from a website including colors,
|
|
41
95
|
# typography, spacing, shadows, and UI components.
|
|
42
96
|
#
|
|
43
|
-
# @overload extract_styleguide(direct_url: nil, domain: nil, timeout_ms: nil, request_options: {})
|
|
97
|
+
# @overload extract_styleguide(direct_url: nil, domain: nil, max_age_ms: nil, timeout_ms: nil, request_options: {})
|
|
44
98
|
#
|
|
45
99
|
# @param direct_url [String] A specific URL to fetch the styleguide from directly, bypassing domain resolutio
|
|
46
100
|
#
|
|
47
101
|
# @param domain [String] Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The
|
|
48
102
|
#
|
|
103
|
+
# @param max_age_ms [Integer] Maximum age in milliseconds for cached data before the API performs a hard refre
|
|
104
|
+
#
|
|
49
105
|
# @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
|
|
50
106
|
#
|
|
51
107
|
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
@@ -59,7 +115,11 @@ module ContextDev
|
|
|
59
115
|
@client.request(
|
|
60
116
|
method: :get,
|
|
61
117
|
path: "web/styleguide",
|
|
62
|
-
query: query.transform_keys(
|
|
118
|
+
query: query.transform_keys(
|
|
119
|
+
direct_url: "directUrl",
|
|
120
|
+
max_age_ms: "maxAgeMs",
|
|
121
|
+
timeout_ms: "timeoutMS"
|
|
122
|
+
),
|
|
63
123
|
model: ContextDev::Models::WebExtractStyleguideResponse,
|
|
64
124
|
options: options
|
|
65
125
|
)
|
data/lib/context_dev/version.rb
CHANGED
data/lib/context_dev.rb
CHANGED
|
@@ -82,6 +82,8 @@ require_relative "context_dev/models/utility_prefetch_params"
|
|
|
82
82
|
require_relative "context_dev/models/utility_prefetch_response"
|
|
83
83
|
require_relative "context_dev/models/web_extract_fonts_params"
|
|
84
84
|
require_relative "context_dev/models/web_extract_fonts_response"
|
|
85
|
+
require_relative "context_dev/models/web_extract_params"
|
|
86
|
+
require_relative "context_dev/models/web_extract_response"
|
|
85
87
|
require_relative "context_dev/models/web_extract_styleguide_params"
|
|
86
88
|
require_relative "context_dev/models/web_extract_styleguide_response"
|
|
87
89
|
require_relative "context_dev/models/web_screenshot_params"
|
|
@@ -32,6 +32,16 @@ module ContextDev
|
|
|
32
32
|
sig { params(domain: String).void }
|
|
33
33
|
attr_writer :domain
|
|
34
34
|
|
|
35
|
+
# Maximum age in milliseconds for cached data before the API performs a hard
|
|
36
|
+
# refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
|
|
37
|
+
# are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
|
|
38
|
+
# year.
|
|
39
|
+
sig { returns(T.nilable(Integer)) }
|
|
40
|
+
attr_reader :max_age_ms
|
|
41
|
+
|
|
42
|
+
sig { params(max_age_ms: Integer).void }
|
|
43
|
+
attr_writer :max_age_ms
|
|
44
|
+
|
|
35
45
|
# Optional timeout in milliseconds for the request. If the request takes longer
|
|
36
46
|
# than this value, it will be aborted with a 408 status code. Maximum allowed
|
|
37
47
|
# value is 300000ms (5 minutes).
|
|
@@ -45,6 +55,7 @@ module ContextDev
|
|
|
45
55
|
params(
|
|
46
56
|
direct_url: String,
|
|
47
57
|
domain: String,
|
|
58
|
+
max_age_ms: Integer,
|
|
48
59
|
timeout_ms: Integer,
|
|
49
60
|
request_options: ContextDev::RequestOptions::OrHash
|
|
50
61
|
).returns(T.attached_class)
|
|
@@ -58,6 +69,11 @@ module ContextDev
|
|
|
58
69
|
# domain will be automatically normalized and validated. You must provide either
|
|
59
70
|
# 'domain' or 'directUrl', but not both.
|
|
60
71
|
domain: nil,
|
|
72
|
+
# Maximum age in milliseconds for cached data before the API performs a hard
|
|
73
|
+
# refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms)
|
|
74
|
+
# are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1
|
|
75
|
+
# year.
|
|
76
|
+
max_age_ms: nil,
|
|
61
77
|
# Optional timeout in milliseconds for the request. If the request takes longer
|
|
62
78
|
# than this value, it will be aborted with a 408 status code. Maximum allowed
|
|
63
79
|
# value is 300000ms (5 minutes).
|
|
@@ -71,6 +87,7 @@ module ContextDev
|
|
|
71
87
|
{
|
|
72
88
|
direct_url: String,
|
|
73
89
|
domain: String,
|
|
90
|
+
max_age_ms: Integer,
|
|
74
91
|
timeout_ms: Integer,
|
|
75
92
|
request_options: ContextDev::RequestOptions
|
|
76
93
|
}
|