@@ -11,7 +11,9 @@ module ContextDev
1111 )
1212 end
1313
14- # Raw HTML content of the page
14+ # The scraped content of the page. For normal pages this is the raw HTML. When the
15+ # page is a sitemap or feed served behind an XSL stylesheet (which browsers render
16+ # into HTML), this is the underlying XML instead — see the `type` field.
1517 sig { returns ( String ) }
1618 attr_accessor :html
1719
@@ -23,6 +25,15 @@ module ContextDev
2325 end
2426 attr_accessor :success
2527
28+ # Detected content type of the returned `html` field. Sitemaps and feeds are
29+ # surfaced as `xml`; ordinary pages are `html`.
30+ sig do
31+ returns (
32+ ContextDev ::Models ::WebWebScrapeHTMLResponse ::Type ::TaggedSymbol
33+ )
34+ end
35+ attr_accessor :type
36+
2637 # The URL that was scraped
2738 sig { returns ( String ) }
2839 attr_accessor :url
@@ -32,14 +43,20 @@ module ContextDev
3243 html : String ,
3344 success :
3445 ContextDev ::Models ::WebWebScrapeHTMLResponse ::Success ::OrBoolean ,
46+ type : ContextDev ::Models ::WebWebScrapeHTMLResponse ::Type ::OrSymbol ,
3547 url : String
3648 ) . returns ( T . attached_class )
3749 end
3850 def self . new (
39- # Raw HTML content of the page
51+ # The scraped content of the page. For normal pages this is the raw HTML. When the
52+ # page is a sitemap or feed served behind an XSL stylesheet (which browsers render
53+ # into HTML), this is the underlying XML instead — see the `type` field.
4054 html :,
4155 # Indicates success
4256 success :,
57+ # Detected content type of the returned `html` field. Sitemaps and feeds are
58+ # surfaced as `xml`; ordinary pages are `html`.
59+ type :,
4360 # The URL that was scraped
4461 url :
4562 )
@@ -51,6 +68,8 @@ module ContextDev
5168 html : String ,
5269 success :
5370 ContextDev ::Models ::WebWebScrapeHTMLResponse ::Success ::TaggedBoolean ,
71+ type :
72+ ContextDev ::Models ::WebWebScrapeHTMLResponse ::Type ::TaggedSymbol ,
5473 url : String
5574 }
5675 )
@@ -87,6 +106,69 @@ module ContextDev
87106 def self . values
88107 end
89108 end
109+
110+ # Detected content type of the returned `html` field. Sitemaps and feeds are
111+ # surfaced as `xml`; ordinary pages are `html`.
112+ module Type
113+ extend ContextDev ::Internal ::Type ::Enum
114+
115+ TaggedSymbol =
116+ T . type_alias do
117+ T . all ( Symbol , ContextDev ::Models ::WebWebScrapeHTMLResponse ::Type )
118+ end
119+ OrSymbol = T . type_alias { T . any ( Symbol , String ) }
120+
121+ HTML =
122+ T . let (
123+ :html ,
124+ ContextDev ::Models ::WebWebScrapeHTMLResponse ::Type ::TaggedSymbol
125+ )
126+ XML =
127+ T . let (
128+ :xml ,
129+ ContextDev ::Models ::WebWebScrapeHTMLResponse ::Type ::TaggedSymbol
130+ )
131+ JSON =
132+ T . let (
133+ :json ,
134+ ContextDev ::Models ::WebWebScrapeHTMLResponse ::Type ::TaggedSymbol
135+ )
136+ TEXT =
137+ T . let (
138+ :text ,
139+ ContextDev ::Models ::WebWebScrapeHTMLResponse ::Type ::TaggedSymbol
140+ )
141+ CSV =
142+ T . let (
143+ :csv ,
144+ ContextDev ::Models ::WebWebScrapeHTMLResponse ::Type ::TaggedSymbol
145+ )
146+ MARKDOWN =
147+ T . let (
148+ :markdown ,
149+ ContextDev ::Models ::WebWebScrapeHTMLResponse ::Type ::TaggedSymbol
150+ )
151+ SVG =
152+ T . let (
153+ :svg ,
154+ ContextDev ::Models ::WebWebScrapeHTMLResponse ::Type ::TaggedSymbol
155+ )
156+ PDF =
157+ T . let (
158+ :pdf ,
159+ ContextDev ::Models ::WebWebScrapeHTMLResponse ::Type ::TaggedSymbol
160+ )
161+
162+ sig do
163+ override . returns (
164+ T ::Array [
165+ ContextDev ::Models ::WebWebScrapeHTMLResponse ::Type ::TaggedSymbol
166+ ]
167+ )
168+ end
169+ def self . values
170+ end
171+ end
90172 end
91173 end
92174end
0 commit comments