Spaces:
Sleeping
Sleeping
Download apps/ruby-sdk/lib/firecrawl/models/scrape_options.rb from s-eto-hub/firecrawl-api: direct link, hf CLI and curl.
- Browser
- Download file 1.58 kB
-
https://huggingface.co/spaces/s-eto-hub/firecrawl-api/resolve/main/apps/ruby-sdk/lib/firecrawl/models/scrape_options.rb
- Command line
-
hf download hf://spaces/s-eto-hub/firecrawl-api/apps/ruby-sdk/lib/firecrawl/models/scrape_options.rb
-
curl -L -o scrape_options.rb https://huggingface.co/spaces/s-eto-hub/firecrawl-api/resolve/main/apps/ruby-sdk/lib/firecrawl/models/scrape_options.rb
1.58 kB
| # frozen_string_literal: true | |
| module Firecrawl | |
| module Models | |
| # Options for scraping a single URL. | |
| class ScrapeOptions | |
| FIELDS = %i[ | |
| formats headers include_tags exclude_tags only_main_content | |
| timeout wait_for mobile parsers actions location | |
| skip_tls_verification remove_base64_images block_ads proxy | |
| max_age store_in_cache lockdown integration | |
| ].freeze | |
| attr_reader(*FIELDS) | |
| def initialize(**kwargs) | |
| FIELDS.each { |f| instance_variable_set(:"@#{f}", kwargs[f]) } | |
| @skip_tls_verification = false if @skip_tls_verification.nil? | |
| end | |
| def to_h | |
| { | |
| "formats" => formats&.map { |fmt| format_value(fmt) }, | |
| "headers" => headers, | |
| "includeTags" => include_tags, | |
| "excludeTags" => exclude_tags, | |
| "onlyMainContent" => only_main_content, | |
| "timeout" => timeout, | |
| "waitFor" => wait_for, | |
| "mobile" => mobile, | |
| "parsers" => parsers, | |
| "actions" => actions, | |
| "location" => location.is_a?(Hash) ? location : location&.to_h, | |
| "skipTlsVerification" => skip_tls_verification, | |
| "removeBase64Images" => remove_base64_images, | |
| "blockAds" => block_ads, | |
| "proxy" => proxy, | |
| "maxAge" => max_age, | |
| "storeInCache" => store_in_cache, | |
| "lockdown" => lockdown, | |
| "integration" => integration, | |
| }.compact | |
| end | |
| private | |
| def format_value(fmt) | |
| fmt.respond_to?(:to_h) ? fmt.to_h : fmt | |
| end | |
| end | |
| end | |
| end | |