Class: ContextDev::Models::WebWebScrapeHTMLParams

Inherits:
Internal::Type::BaseModel show all
Extended by:
Internal::Type::RequestParameters::Converter
Includes:
Internal::Type::RequestParameters
Defined in:
lib/context_dev/models/web_web_scrape_html_params.rb,
sig/context_dev/models/web_web_scrape_html_params.rbs

Overview

See Also:

  • ContextDev::Resources::Web#web_scrape_html

Defined Under Namespace

Modules: Action, Country, IncludeFrames, SettleAnimations, UseMainContentOnly, Zdr Classes: Pdf

Constant Summary

Constants included from Internal::Type::RequestParameters

Internal::Type::RequestParameters::ContextDev

Instance Attribute Summary collapse

Attributes included from Internal::Type::RequestParameters

#request_options

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Internal::Type::RequestParameters::Converter

dump_request

Methods included from Internal::Type::RequestParameters

included

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(action:, do_: :perform) ⇒ Object

Resolve and perform one natural-language browser action.

Parameters:

  • action (String)
  • do_ (Symbol, :perform) (defaults to: :perform)


# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 126

Instance Attribute Details

#actionsArray<ContextDev::Models::WebWebScrapeHTMLParams::Action::Wait, ContextDev::Models::WebWebScrapeHTMLParams::Action::Perform>?

Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions.

Parameters:

  • value (::Array[ContextDev::Models::WebWebScrapeHTMLParams::action], nil)

Returns:



22
23
24
# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 22

optional :actions,
-> { ContextDev::Internal::Type::ArrayOf[union: ContextDev::WebWebScrapeHTMLParams::Action] },
nil?: true

#countrySymbol, ...

Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country.



32
# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 32

optional :country, enum: -> { ContextDev::WebWebScrapeHTMLParams::Country }

#exclude_selectorsArray<String>?

CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]".

Parameters:

  • value (::Array[String], nil)

Returns:

  • (Array<String>, nil)


40
# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 40

optional :exclude_selectors, ContextDev::Internal::Type::ArrayOf[String], nil?: true

#headersHash{Symbol=>String}?

Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers=value. When provided, caching is bypassed: the result is neither read from nor written to cache.

Parameters:

  • (::Hash[Symbol, String])

Returns:

  • (Hash{Symbol=>String}, nil)


48
# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 48

optional :headers, ContextDev::Internal::Type::HashOf[String]

#include_framesBoolean, ...

When true, iframes are rendered inline into the returned HTML.



54
# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 54

optional :include_frames, union: -> { ContextDev::WebWebScrapeHTMLParams::IncludeFrames }

#include_selectorsArray<String>?

CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]".

Parameters:

  • value (::Array[String], nil)

Returns:

  • (Array<String>, nil)


62
# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 62

optional :include_selectors, ContextDev::Internal::Type::ArrayOf[String], nil?: true

#max_age_msInteger?

Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh.

Parameters:

  • value (Integer, nil)

Returns:

  • (Integer, nil)


70
# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 70

optional :max_age_ms, Integer, nil?: true

#pdfContextDev::Models::WebWebScrapeHTMLParams::Pdf?

PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range.



77
# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 77

optional :pdf, -> { ContextDev::WebWebScrapeHTMLParams::Pdf }

#settle_animationsBoolean, ...

When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages.



85
# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 85

optional :settle_animations, union: -> { ContextDev::WebWebScrapeHTMLParams::SettleAnimations }

#tagsArray<String>?

Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters.

Parameters:

  • (::Array[String])

Returns:

  • (Array<String>, nil)


93
# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 93

optional :tags, ContextDev::Internal::Type::ArrayOf[String]

#timeout_msInteger?

Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).

Parameters:

  • (Integer)

Returns:

  • (Integer, nil)


101
# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 101

optional :timeout_ms, Integer

#urlString

Full URL to scrape (must include http:// or https:// protocol)

Parameters:

  • value (String)

Returns:

  • (String)


14
# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 14

required :url, String

#use_main_content_onlyBoolean, ...

When true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable.



108
# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 108

optional :use_main_content_only, union: -> { ContextDev::WebWebScrapeHTMLParams::UseMainContentOnly }

#wait_for_msInteger?

Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds).

Parameters:

  • value (Integer, nil)

Returns:

  • (Integer, nil)


115
# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 115

optional :wait_for_ms, Integer, nil?: true

#zdrSymbol, ...

Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.



124
# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 124

optional :zdr, enum: -> { ContextDev::WebWebScrapeHTMLParams::Zdr }

Class Method Details

.valuesArray<Symbol>

Returns:

  • (Array<Symbol>)


# File 'lib/context_dev/models/web_web_scrape_html_params.rb', line 426

Instance Method Details

#to_hash{

Returns:

  • ({)


106
# File 'sig/context_dev/models/web_web_scrape_html_params.rbs', line 106

def to_hash: -> {