context.dev 2.9.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -0
  3. data/README.md +1 -1
  4. data/lib/context_dev/client.rb +5 -0
  5. data/lib/context_dev/models/batch_get_results_response.rb +33 -3
  6. data/lib/context_dev/models/batch_submit_params.rb +44 -316
  7. data/lib/context_dev/models/brand_retrieve_response.rb +29 -1
  8. data/lib/context_dev/models/brand_retrieve_simplified_response.rb +30 -1
  9. data/lib/context_dev/models/brand_search_params.rb +41 -3
  10. data/lib/context_dev/models/news_search_params.rb +467 -0
  11. data/lib/context_dev/models/news_search_response.rb +284 -0
  12. data/lib/context_dev/models/parse_handle_params.rb +15 -144
  13. data/lib/context_dev/models/person_enrich_response.rb +61 -1
  14. data/lib/context_dev/models/utility_prefetch_params.rb +19 -16
  15. data/lib/context_dev/models/utility_prefetch_response.rb +4 -5
  16. data/lib/context_dev/models/web_screenshot_params.rb +16 -31
  17. data/lib/context_dev/models/web_web_crawl_md_response.rb +30 -1
  18. data/lib/context_dev/models/web_web_scrape_html_params.rb +15 -153
  19. data/lib/context_dev/models/web_web_scrape_html_response.rb +30 -1
  20. data/lib/context_dev/models/web_web_scrape_images_params.rb +12 -124
  21. data/lib/context_dev/models/web_web_scrape_md_params.rb +35 -238
  22. data/lib/context_dev/models/web_web_scrape_md_response.rb +41 -2
  23. data/lib/context_dev/models.rb +2 -0
  24. data/lib/context_dev/resources/brand.rb +10 -11
  25. data/lib/context_dev/resources/news.rb +51 -0
  26. data/lib/context_dev/resources/parse.rb +5 -5
  27. data/lib/context_dev/resources/utility.rb +7 -6
  28. data/lib/context_dev/resources/web.rb +30 -24
  29. data/lib/context_dev/version.rb +1 -1
  30. data/lib/context_dev.rb +3 -0
  31. data/rbi/context_dev/client.rbi +4 -0
  32. data/rbi/context_dev/models/batch_get_results_response.rbi +71 -2
  33. data/rbi/context_dev/models/batch_submit_params.rbi +58 -592
  34. data/rbi/context_dev/models/brand_retrieve_response.rbi +80 -3
  35. data/rbi/context_dev/models/brand_retrieve_simplified_response.rbi +80 -3
  36. data/rbi/context_dev/models/brand_search_params.rbi +71 -2
  37. data/rbi/context_dev/models/news_search_params.rbi +1294 -0
  38. data/rbi/context_dev/models/news_search_response.rbi +489 -0
  39. data/rbi/context_dev/models/parse_handle_params.rbi +20 -316
  40. data/rbi/context_dev/models/person_enrich_response.rbi +87 -0
  41. data/rbi/context_dev/models/utility_prefetch_params.rbi +24 -16
  42. data/rbi/context_dev/models/utility_prefetch_response.rbi +8 -6
  43. data/rbi/context_dev/models/web_screenshot_params.rbi +23 -71
  44. data/rbi/context_dev/models/web_web_crawl_md_response.rbi +67 -0
  45. data/rbi/context_dev/models/web_web_scrape_html_params.rbi +20 -356
  46. data/rbi/context_dev/models/web_web_scrape_html_response.rbi +65 -0
  47. data/rbi/context_dev/models/web_web_scrape_images_params.rbi +16 -287
  48. data/rbi/context_dev/models/web_web_scrape_md_params.rbi +47 -551
  49. data/rbi/context_dev/models/web_web_scrape_md_response.rbi +80 -0
  50. data/rbi/context_dev/models.rbi +2 -0
  51. data/rbi/context_dev/resources/brand.rbi +14 -9
  52. data/rbi/context_dev/resources/news.rbi +46 -0
  53. data/rbi/context_dev/resources/parse.rbi +5 -21
  54. data/rbi/context_dev/resources/utility.rbi +8 -6
  55. data/rbi/context_dev/resources/web.rbi +34 -66
  56. data/sig/context_dev/client.rbs +2 -0
  57. data/sig/context_dev/models/batch_get_results_response.rbs +21 -0
  58. data/sig/context_dev/models/batch_submit_params.rbs +54 -144
  59. data/sig/context_dev/models/brand_retrieve_response.rbs +33 -3
  60. data/sig/context_dev/models/brand_retrieve_simplified_response.rbs +33 -3
  61. data/sig/context_dev/models/brand_search_params.rbs +38 -1
  62. data/sig/context_dev/models/news_search_params.rbs +532 -0
  63. data/sig/context_dev/models/news_search_response.rbs +206 -0
  64. data/sig/context_dev/models/parse_handle_params.rbs +25 -90
  65. data/sig/context_dev/models/person_enrich_response.rbs +31 -0
  66. data/sig/context_dev/models/utility_prefetch_params.rbs +2 -1
  67. data/sig/context_dev/models/utility_prefetch_response.rbs +2 -1
  68. data/sig/context_dev/models/web_screenshot_params.rbs +12 -18
  69. data/sig/context_dev/models/web_web_crawl_md_response.rbs +21 -0
  70. data/sig/context_dev/models/web_web_scrape_html_params.rbs +24 -94
  71. data/sig/context_dev/models/web_web_scrape_html_response.rbs +21 -0
  72. data/sig/context_dev/models/web_web_scrape_images_params.rbs +20 -72
  73. data/sig/context_dev/models/web_web_scrape_md_params.rbs +46 -148
  74. data/sig/context_dev/models/web_web_scrape_md_response.rbs +28 -0
  75. data/sig/context_dev/models.rbs +2 -0
  76. data/sig/context_dev/resources/brand.rbs +3 -0
  77. data/sig/context_dev/resources/news.rbs +17 -0
  78. data/sig/context_dev/resources/parse.rbs +5 -5
  79. data/sig/context_dev/resources/web.rbs +13 -11
  80. metadata +11 -2
@@ -72,6 +72,15 @@ module ContextDev
72
72
  sig { params(actions_html_stale: T::Boolean).void }
73
73
  attr_writer :actions_html_stale
74
74
 
75
+ # Only present when includeHTML=true: the page HTML the Markdown was converted
76
+ # from — the same body the Scrape HTML endpoint returns for the equivalent
77
+ # request.
78
+ sig { returns(T.nilable(String)) }
79
+ attr_reader :html
80
+
81
+ sig { params(html: String).void }
82
+ attr_writer :html
83
+
75
84
  # Metadata about the API key used for the request. Included in every response
76
85
  # whenever a valid API key is provided, even when the response status is not 200.
77
86
  sig do
@@ -103,6 +112,7 @@ module ContextDev
103
112
  ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied::OrHash
104
113
  ],
105
114
  actions_html_stale: T::Boolean,
115
+ html: String,
106
116
  key_metadata:
107
117
  ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata::OrHash
108
118
  ).returns(T.attached_class)
@@ -125,6 +135,10 @@ module ContextDev
125
135
  # True when an action was applied but the returned content could not be refreshed
126
136
  # afterward.
127
137
  actions_html_stale: nil,
138
+ # Only present when includeHTML=true: the page HTML the Markdown was converted
139
+ # from — the same body the Scrape HTML endpoint returns for the equivalent
140
+ # request.
141
+ html: nil,
128
142
  # Metadata about the API key used for the request. Included in every response
129
143
  # whenever a valid API key is provided, even when the response status is not 200.
130
144
  key_metadata: nil
@@ -145,6 +159,7 @@ module ContextDev
145
159
  ContextDev::Models::WebWebScrapeMdResponse::ActionsApplied
146
160
  ],
147
161
  actions_html_stale: T::Boolean,
162
+ html: String,
148
163
  key_metadata:
149
164
  ContextDev::Models::WebWebScrapeMdResponse::KeyMetadata
150
165
  }
@@ -245,6 +260,29 @@ module ContextDev
245
260
  sig { params(favicon: String).void }
246
261
  attr_writer :favicon
247
262
 
263
+ # Page headings (h1–h6) in document order, extracted from the unfiltered document.
264
+ # Capped at the first 500 headings. Omitted when the page has none.
265
+ sig do
266
+ returns(
267
+ T.nilable(
268
+ T::Array[
269
+ ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading
270
+ ]
271
+ )
272
+ )
273
+ end
274
+ attr_reader :headings
275
+
276
+ sig do
277
+ params(
278
+ headings:
279
+ T::Array[
280
+ ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading::OrHash
281
+ ]
282
+ ).void
283
+ end
284
+ attr_writer :headings
285
+
248
286
  # Primary resolved preview image from Open Graph, Twitter, or image metadata.
249
287
  sig { returns(T.nilable(String)) }
250
288
  attr_reader :image
@@ -374,6 +412,10 @@ module ContextDev
374
412
  canonical_url: String,
375
413
  description: String,
376
414
  favicon: String,
415
+ headings:
416
+ T::Array[
417
+ ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading::OrHash
418
+ ],
377
419
  image: String,
378
420
  json_ld: T::Array[T::Hash[Symbol, T.anything]],
379
421
  keywords: T::Array[String],
@@ -413,6 +455,9 @@ module ContextDev
413
455
  description: nil,
414
456
  # Resolved favicon URL, when present.
415
457
  favicon: nil,
458
+ # Page headings (h1–h6) in document order, extracted from the unfiltered document.
459
+ # Capped at the first 500 headings. Omitted when the page has none.
460
+ headings: nil,
416
461
  # Primary resolved preview image from Open Graph, Twitter, or image metadata.
417
462
  image: nil,
418
463
  # JSON-LD structured data blocks parsed from the page.
@@ -456,6 +501,10 @@ module ContextDev
456
501
  canonical_url: String,
457
502
  description: String,
458
503
  favicon: String,
504
+ headings:
505
+ T::Array[
506
+ ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading
507
+ ],
459
508
  image: String,
460
509
  json_ld: T::Array[T::Hash[Symbol, T.anything]],
461
510
  keywords: T::Array[String],
@@ -566,6 +615,37 @@ module ContextDev
566
615
  end
567
616
  end
568
617
 
618
+ class Heading < ContextDev::Internal::Type::BaseModel
619
+ OrHash =
620
+ T.type_alias do
621
+ T.any(
622
+ ContextDev::Models::WebWebScrapeMdResponse::Metadata::Heading,
623
+ ContextDev::Internal::AnyHash
624
+ )
625
+ end
626
+
627
+ # Heading level, 1–6 (from h1–h6).
628
+ sig { returns(Integer) }
629
+ attr_accessor :level
630
+
631
+ # Heading text with whitespace collapsed, truncated to 1000 characters.
632
+ sig { returns(String) }
633
+ attr_accessor :text
634
+
635
+ sig { params(level: Integer, text: String).returns(T.attached_class) }
636
+ def self.new(
637
+ # Heading level, 1–6 (from h1–h6).
638
+ level:,
639
+ # Heading text with whitespace collapsed, truncated to 1000 characters.
640
+ text:
641
+ )
642
+ end
643
+
644
+ sig { override.returns({ level: Integer, text: String }) }
645
+ def to_hash
646
+ end
647
+ end
648
+
569
649
  module OpenGraph
570
650
  extend ContextDev::Internal::Type::Union
571
651
 
@@ -62,6 +62,8 @@ module ContextDev
62
62
 
63
63
  MonitorUpdateParams = ContextDev::Models::MonitorUpdateParams
64
64
 
65
+ NewsSearchParams = ContextDev::Models::NewsSearchParams
66
+
65
67
  PageErrorCount = ContextDev::Models::PageErrorCount
66
68
 
67
69
  ParseHandleParams = ContextDev::Models::ParseHandleParams
@@ -64,29 +64,34 @@ module ContextDev
64
64
  )
65
65
  end
66
66
 
67
- # Search brands by name or domain and get back up to 10 lightweight matches
68
- # (domain, name, logo). Name matches rank ahead of domain matches; within each
69
- # group the most popular brands come first: by Tranco rank, then market cap for
70
- # brands outside the Tranco list, with text relevance breaking ties. Matching is
71
- # prefix-based with no typo tolerance, so it is suited to autocomplete. Only
72
- # brands already in the Context.dev index are returned — use /brand/retrieve to
73
- # fetch (and index) a specific domain. Free on Pro and Scale plans; costs 1 credit
74
- # per request on the Free and Starter plans.
67
+ # Search indexed brands by name or domain
75
68
  sig do
76
69
  params(
77
70
  query: String,
71
+ autocomplete: T::Boolean,
72
+ query_by: T::Array[ContextDev::BrandSearchParams::QueryBy::OrSymbol],
78
73
  tags: T::Array[String],
74
+ typo_tolerance: Integer,
79
75
  request_options: ContextDev::RequestOptions::OrHash
80
76
  ).returns(ContextDev::Models::BrandSearchResponse)
81
77
  end
82
78
  def search(
83
- # Search term, matched against brand names and domains by prefix (e.g. 'nike',
79
+ # Search term, matched against the fields selected by queryBy (e.g. 'nike',
84
80
  # 'nike.com', 'nik').
85
81
  query:,
82
+ # Whether the search term matches by prefix, so partial words match as they are
83
+ # typed (e.g. 'nik' matches Nike). Set to false to match whole words only.
84
+ autocomplete: nil,
85
+ # Fields to match the search term against, as a comma-separated list or repeated
86
+ # parameter: 'name', 'domain', or both. Defaults to both.
87
+ query_by: nil,
86
88
  # Optional comma-separated caller-defined tags for tracking this request. Tags are
87
89
  # recorded on the request's usage log and can be used to filter usage on the
88
90
  # dashboard usage page. Up to 20 tags, each 1-50 characters.
89
91
  tags: nil,
92
+ # Maximum number of typos tolerated when matching, from 0 to 2. Defaults to 0 (no
93
+ # typo tolerance).
94
+ typo_tolerance: nil,
90
95
  request_options: {}
91
96
  )
92
97
  end
@@ -0,0 +1,46 @@
1
+ # typed: strong
2
+
3
+ module ContextDev
4
+ module Resources
5
+ # Search live first-party RSS and free historical news data by company identity.
6
+ class News
7
+ # Searches live and historical company news for one company, identified in
8
+ # searchBy by name, domain, ticker (optionally disambiguated by exchange), or
9
+ # ISIN. Results can be filtered by publisher domain, publisher country, article
10
+ # language, article type, and published-at date, and include stable story IDs,
11
+ # source metadata, verified entity relevance, and cursor pagination.
12
+ sig do
13
+ params(
14
+ search_by: ContextDev::NewsSearchParams::SearchBy::OrHash,
15
+ cursor: T.nilable(String),
16
+ filter_by: ContextDev::NewsSearchParams::FilterBy::OrHash,
17
+ limit: Integer,
18
+ sort_by: ContextDev::NewsSearchParams::SortBy::OrHash,
19
+ tags: T::Array[String],
20
+ request_options: ContextDev::RequestOptions::OrHash
21
+ ).returns(ContextDev::Models::NewsSearchResponse)
22
+ end
23
+ def search(
24
+ # What to search for.
25
+ search_by:,
26
+ # Opaque next_cursor from the previous response, or null for the first page.
27
+ cursor: nil,
28
+ # Optional result filters.
29
+ filter_by: nil,
30
+ # Maximum results to return. Defaults to 10.
31
+ limit: nil,
32
+ # Result ordering. Defaults to newest.
33
+ sort_by: nil,
34
+ # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
35
+ tags: nil,
36
+ request_options: {}
37
+ )
38
+ end
39
+
40
+ # @api private
41
+ sig { params(client: ContextDev::Client).returns(T.attached_class) }
42
+ def self.new(client:)
43
+ end
44
+ end
45
+ end
46
+ end
@@ -10,29 +10,13 @@ module ContextDev
10
10
  body: ContextDev::Internal::FileInput,
11
11
  client: String,
12
12
  extension: ContextDev::ParseHandleParams::Extension::OrSymbol,
13
- include_images:
14
- T.any(
15
- T::Boolean,
16
- ContextDev::ParseHandleParams::IncludeImages::OrSymbol
17
- ),
18
- include_links:
19
- T.any(
20
- T::Boolean,
21
- ContextDev::ParseHandleParams::IncludeLinks::OrSymbol
22
- ),
23
- ocr: T.any(T::Boolean, ContextDev::ParseHandleParams::Ocr::OrSymbol),
13
+ include_images: T::Boolean,
14
+ include_links: T::Boolean,
15
+ ocr: T::Boolean,
24
16
  pdf: ContextDev::ParseHandleParams::Pdf::OrHash,
25
- shorten_base64_images:
26
- T.any(
27
- T::Boolean,
28
- ContextDev::ParseHandleParams::ShortenBase64Images::OrSymbol
29
- ),
17
+ shorten_base64_images: T::Boolean,
30
18
  tags: T::Array[String],
31
- use_main_content_only:
32
- T.any(
33
- T::Boolean,
34
- ContextDev::ParseHandleParams::UseMainContentOnly::OrSymbol
35
- ),
19
+ use_main_content_only: T::Boolean,
36
20
  zdr: ContextDev::ParseHandleParams::Zdr::OrSymbol,
37
21
  request_options: ContextDev::RequestOptions::OrHash
38
22
  ).returns(ContextDev::Models::ParseHandleResponse)
@@ -3,10 +3,11 @@
3
3
  module ContextDev
4
4
  module Resources
5
5
  class Utility
6
- # Signal that you may fetch brand data soon to improve latency. The type field
7
- # selects what to prefetch (currently only 'brand') and identifier carries exactly
8
- # one lookup key: a domain, or an email whose domain is extracted and validated
9
- # (free email providers and disposable email addresses are not allowed).
6
+ # Signal that you may fetch data soon to improve latency. The type field selects
7
+ # what to prefetch ('brand' queues a brand data fetch, 'styleguide' queues a
8
+ # styleguide extraction) and identifier carries exactly one lookup key: a domain,
9
+ # or an email whose domain is extracted and validated (free email providers and
10
+ # disposable email addresses are not allowed).
10
11
  sig do
11
12
  params(
12
13
  identifier:
@@ -21,9 +22,10 @@ module ContextDev
21
22
  ).returns(ContextDev::Models::UtilityPrefetchResponse)
22
23
  end
23
24
  def prefetch(
24
- # Identifier of the brand to prefetch. Provide exactly one of domain or email.
25
+ # Identifier of the target to prefetch. Provide exactly one of domain or email.
25
26
  identifier:,
26
- # What to prefetch. Currently only 'brand' is supported.
27
+ # What to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the
28
+ # styleguide cache.
27
29
  type:,
28
30
  # Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
29
31
  tags: nil,
@@ -190,17 +190,14 @@ module ContextDev
190
190
  # Capture a screenshot of a website.
191
191
  sig do
192
192
  params(
193
+ clear_popups: T::Boolean,
193
194
  color_scheme: ContextDev::WebScreenshotParams::ColorScheme::OrSymbol,
194
195
  country: ContextDev::WebScreenshotParams::Country::OrSymbol,
195
196
  direct_url: String,
196
197
  domain: String,
197
198
  full_screenshot:
198
199
  ContextDev::WebScreenshotParams::FullScreenshot::OrSymbol,
199
- handle_cookie_popup:
200
- T.any(
201
- T::Boolean,
202
- ContextDev::WebScreenshotParams::HandleCookiePopup::OrSymbol
203
- ),
200
+ handle_cookie_popup: T::Boolean,
204
201
  max_age_ms: T.nilable(Integer),
205
202
  page: ContextDev::WebScreenshotParams::Page::OrSymbol,
206
203
  scroll_offset: T.nilable(Integer),
@@ -213,6 +210,12 @@ module ContextDev
213
210
  ).returns(ContextDev::Models::WebScreenshotResponse)
214
211
  end
215
212
  def screenshot(
213
+ # Optional parameter for comprehensive popup cleanup. If 'true', the browser
214
+ # dismisses detected cookie/consent UI and clears other detected obstructive
215
+ # popups and overlays before capture. If 'false' or not provided, this parameter
216
+ # requests no cleanup; handleCookiePopup can still request cookie/consent handling
217
+ # independently.
218
+ clear_popups: nil,
216
219
  # Optional parameter to choose the site's visual theme in the screenshot. Use
217
220
  # 'light' or 'dark' when the site offers both appearances.
218
221
  color_scheme: nil,
@@ -439,26 +442,14 @@ module ContextDev
439
442
  country: ContextDev::WebWebScrapeHTMLParams::Country::OrSymbol,
440
443
  exclude_selectors: T.nilable(T::Array[String]),
441
444
  headers: T::Hash[Symbol, String],
442
- include_frames:
443
- T.any(
444
- T::Boolean,
445
- ContextDev::WebWebScrapeHTMLParams::IncludeFrames::OrSymbol
446
- ),
445
+ include_frames: T::Boolean,
447
446
  include_selectors: T.nilable(T::Array[String]),
448
447
  max_age_ms: T.nilable(Integer),
449
448
  pdf: ContextDev::WebWebScrapeHTMLParams::Pdf::OrHash,
450
- settle_animations:
451
- T.any(
452
- T::Boolean,
453
- ContextDev::WebWebScrapeHTMLParams::SettleAnimations::OrSymbol
454
- ),
449
+ settle_animations: T::Boolean,
455
450
  tags: T::Array[String],
456
451
  timeout_ms: Integer,
457
- use_main_content_only:
458
- T.any(
459
- T::Boolean,
460
- ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly::OrSymbol
461
- ),
452
+ use_main_content_only: T::Boolean,
462
453
  wait_for_ms: T.nilable(Integer),
463
454
  zdr: ContextDev::WebWebScrapeHTMLParams::Zdr::OrSymbol,
464
455
  request_options: ContextDev::RequestOptions::OrHash
@@ -539,11 +530,7 @@ module ContextDev
539
530
  )
540
531
  ]
541
532
  ),
542
- dedupe:
543
- T.any(
544
- T::Boolean,
545
- ContextDev::WebWebScrapeImagesParams::Dedupe::OrSymbol
546
- ),
533
+ dedupe: T::Boolean,
547
534
  enrichment:
548
535
  T.nilable(ContextDev::WebWebScrapeImagesParams::Enrichment::OrHash),
549
536
  headers: T::Hash[Symbol, String],
@@ -609,17 +596,17 @@ module ContextDev
609
596
  #
610
597
  # ### Billing & errors
611
598
  #
612
- # | HTTP status | Billed? | Meaning |
613
- # | ----------- | ----------------------------------------- | ---------------------------------------------------------------------------------------- |
614
- # | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing |
615
- # | 400 | No | Invalid input, skipped PDF, or the page could not be scraped |
616
- # | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code |
617
- # | 404 | No | Target page returned or fingerprinted as not found |
618
- # | 408 | No | Request timed out |
619
- # | 413 | No | Target content exceeds the maximum supported size (20 MB) |
620
- # | 415 | No | Unsupported content type |
621
- # | 429 | No | Per-minute rate limit exceeded; honor Retry-After |
622
- # | 500 | No | Internal error |
599
+ # | HTTP status | Billed? | Meaning |
600
+ # | ----------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
601
+ # | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing |
602
+ # | 400 | No | Invalid input, skipped PDF, or the page could not be scraped. error_code WEBSITE_BLOCKED specifically means the site answered with an anti-bot challenge, CAPTCHA wall, or login shell instead of the page (even when the site returned HTTP 200) — retrying later or from another country sometimes succeeds |
603
+ # | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code |
604
+ # | 404 | No | Target page returned or fingerprinted as not found |
605
+ # | 408 | No | Request timed out |
606
+ # | 413 | No | Target content exceeds the maximum supported size (20 MB) |
607
+ # | 415 | No | Unsupported content type |
608
+ # | 429 | No | Per-minute rate limit exceeded; honor Retry-After |
609
+ # | 500 | No | Internal error |
623
610
  sig do
624
611
  params(
625
612
  url: String,
@@ -635,41 +622,18 @@ module ContextDev
635
622
  country: ContextDev::WebWebScrapeMdParams::Country::OrSymbol,
636
623
  exclude_selectors: T.nilable(T::Array[String]),
637
624
  headers: T::Hash[Symbol, String],
638
- include_frames:
639
- T.any(
640
- T::Boolean,
641
- ContextDev::WebWebScrapeMdParams::IncludeFrames::OrSymbol
642
- ),
643
- include_images:
644
- T.any(
645
- T::Boolean,
646
- ContextDev::WebWebScrapeMdParams::IncludeImages::OrSymbol
647
- ),
648
- include_links:
649
- T.any(
650
- T::Boolean,
651
- ContextDev::WebWebScrapeMdParams::IncludeLinks::OrSymbol
652
- ),
625
+ include_frames: T::Boolean,
626
+ include_html: T::Boolean,
627
+ include_images: T::Boolean,
628
+ include_links: T::Boolean,
653
629
  include_selectors: T.nilable(T::Array[String]),
654
630
  max_age_ms: T.nilable(Integer),
655
631
  pdf: ContextDev::WebWebScrapeMdParams::Pdf::OrHash,
656
- settle_animations:
657
- T.any(
658
- T::Boolean,
659
- ContextDev::WebWebScrapeMdParams::SettleAnimations::OrSymbol
660
- ),
661
- shorten_base64_images:
662
- T.any(
663
- T::Boolean,
664
- ContextDev::WebWebScrapeMdParams::ShortenBase64Images::OrSymbol
665
- ),
632
+ settle_animations: T::Boolean,
633
+ shorten_base64_images: T::Boolean,
666
634
  tags: T::Array[String],
667
635
  timeout_ms: Integer,
668
- use_main_content_only:
669
- T.any(
670
- T::Boolean,
671
- ContextDev::WebWebScrapeMdParams::UseMainContentOnly::OrSymbol
672
- ),
636
+ use_main_content_only: T::Boolean,
673
637
  wait_for_ms: T.nilable(Integer),
674
638
  zdr: ContextDev::WebWebScrapeMdParams::Zdr::OrSymbol,
675
639
  request_options: ContextDev::RequestOptions::OrHash
@@ -696,6 +660,10 @@ module ContextDev
696
660
  headers: nil,
697
661
  # When true, the contents of iframes are rendered to Markdown.
698
662
  include_frames: nil,
663
+ # When true, the response also includes an `html` field with the page HTML the
664
+ # Markdown was converted from — the same body the Scrape HTML endpoint returns for
665
+ # the equivalent request.
666
+ include_html: nil,
699
667
  # Include image references in Markdown output
700
668
  include_images: nil,
701
669
  # Preserve hyperlinks in Markdown output
@@ -28,6 +28,8 @@ module ContextDev
28
28
 
29
29
  attr_reader people: ContextDev::Resources::People
30
30
 
31
+ attr_reader news: ContextDev::Resources::News
32
+
31
33
  private def auth_headers: -> ::Hash[String, String]
32
34
 
33
35
  def initialize: (
@@ -129,6 +129,7 @@ module ContextDev
129
129
  canonical_url: String,
130
130
  description: String,
131
131
  favicon: String,
132
+ headings: ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading],
132
133
  image: String,
133
134
  json_ld: ::Array[::Hash[Symbol, top]],
134
135
  keywords: ::Array[String],
@@ -175,6 +176,12 @@ module ContextDev
175
176
 
176
177
  def favicon=: (String) -> String
177
178
 
179
+ attr_reader headings: ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading]?
180
+
181
+ def headings=: (
182
+ ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading]
183
+ ) -> ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading]
184
+
178
185
  attr_reader image: String?
179
186
 
180
187
  def image=: (String) -> String
@@ -234,6 +241,7 @@ module ContextDev
234
241
  ?canonical_url: String,
235
242
  ?description: String,
236
243
  ?favicon: String,
244
+ ?headings: ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading],
237
245
  ?image: String,
238
246
  ?json_ld: ::Array[::Hash[Symbol, top]],
239
247
  ?keywords: ::Array[String],
@@ -256,6 +264,7 @@ module ContextDev
256
264
  canonical_url: String,
257
265
  description: String,
258
266
  favicon: String,
267
+ headings: ::Array[ContextDev::Models::BatchGetResultsResponse::Data::Ok::Metadata::Heading],
259
268
  image: String,
260
269
  json_ld: ::Array[::Hash[Symbol, top]],
261
270
  keywords: ::Array[String],
@@ -312,6 +321,18 @@ module ContextDev
312
321
  }
313
322
  end
314
323
 
324
+ type heading = { level: Integer, text: String }
325
+
326
+ class Heading < ContextDev::Internal::Type::BaseModel
327
+ attr_accessor level: Integer
328
+
329
+ attr_accessor text: String
330
+
331
+ def initialize: (level: Integer, text: String) -> void
332
+
333
+ def to_hash: -> { level: Integer, text: String }
334
+ end
335
+
315
336
  type open_graph = String | ::Array[String]
316
337
 
317
338
  module OpenGraph