context.dev 2.10.0 → 2.12.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 +21 -0
- data/README.md +1 -1
- data/lib/context_dev/models/ai_extract_product_response.rb +48 -1
- data/lib/context_dev/models/ai_extract_products_response.rb +48 -1
- data/lib/context_dev/models/brand_retrieve_response.rb +29 -1
- data/lib/context_dev/models/brand_retrieve_simplified_response.rb +30 -1
- data/lib/context_dev/models/news_search_params.rb +1 -0
- data/lib/context_dev/models/news_search_response.rb +68 -22
- data/lib/context_dev/models/web_extract_params.rb +169 -6
- data/lib/context_dev/models/web_extract_response.rb +85 -1
- data/lib/context_dev/models/web_screenshot_params.rb +13 -1
- data/lib/context_dev/models/web_web_crawl_md_params.rb +7 -5
- data/lib/context_dev/models/web_web_scrape_html_params.rb +99 -3
- data/lib/context_dev/models/web_web_scrape_images_params.rb +99 -3
- data/lib/context_dev/models/web_web_scrape_images_response.rb +85 -1
- data/lib/context_dev/models/web_web_scrape_md_params.rb +99 -3
- data/lib/context_dev/resources/web.rb +13 -8
- data/lib/context_dev/version.rb +1 -1
- data/rbi/context_dev/models/ai_extract_product_response.rbi +99 -0
- data/rbi/context_dev/models/ai_extract_products_response.rbi +99 -0
- data/rbi/context_dev/models/brand_retrieve_response.rbi +80 -3
- data/rbi/context_dev/models/brand_retrieve_simplified_response.rbi +80 -3
- data/rbi/context_dev/models/news_search_params.rbi +5 -0
- data/rbi/context_dev/models/news_search_response.rbi +70 -4
- data/rbi/context_dev/models/web_extract_params.rbi +353 -8
- data/rbi/context_dev/models/web_extract_response.rbi +172 -3
- data/rbi/context_dev/models/web_screenshot_params.rbi +19 -0
- data/rbi/context_dev/models/web_web_crawl_md_params.rbi +10 -6
- data/rbi/context_dev/models/web_web_scrape_html_params.rbi +218 -4
- data/rbi/context_dev/models/web_web_scrape_images_params.rbi +218 -4
- data/rbi/context_dev/models/web_web_scrape_images_response.rbi +169 -0
- data/rbi/context_dev/models/web_web_scrape_md_params.rbi +218 -4
- data/rbi/context_dev/resources/web.rbi +38 -10
- data/sig/context_dev/models/ai_extract_product_response.rbs +40 -0
- data/sig/context_dev/models/ai_extract_products_response.rbs +40 -0
- data/sig/context_dev/models/brand_retrieve_response.rbs +33 -3
- data/sig/context_dev/models/brand_retrieve_simplified_response.rbs +33 -3
- data/sig/context_dev/models/news_search_params.rbs +2 -0
- data/sig/context_dev/models/web_extract_params.rbs +117 -0
- data/sig/context_dev/models/web_extract_response.rbs +81 -3
- data/sig/context_dev/models/web_screenshot_params.rbs +7 -0
- data/sig/context_dev/models/web_web_scrape_html_params.rbs +74 -0
- data/sig/context_dev/models/web_web_scrape_images_params.rbs +74 -0
- data/sig/context_dev/models/web_web_scrape_images_response.rbs +78 -0
- data/sig/context_dev/models/web_web_scrape_md_params.rbs +74 -0
- data/sig/context_dev/resources/web.rbs +2 -0
- metadata +2 -2
|
@@ -150,7 +150,9 @@ module ContextDev
|
|
|
150
150
|
sig { params(timeout_ms: Integer).void }
|
|
151
151
|
attr_writer :timeout_ms
|
|
152
152
|
|
|
153
|
-
# Regex pattern. Only URLs matching this pattern will be followed and scraped.
|
|
153
|
+
# Regex pattern. Only URLs matching this pattern will be followed and scraped. An
|
|
154
|
+
# automatic prefix scope in the form ^<starting URL> follows a redirect of the
|
|
155
|
+
# starting page.
|
|
154
156
|
sig { returns(T.nilable(String)) }
|
|
155
157
|
attr_reader :url_regex
|
|
156
158
|
|
|
@@ -165,8 +167,8 @@ module ContextDev
|
|
|
165
167
|
sig { params(use_main_content_only: T::Boolean).void }
|
|
166
168
|
attr_writer :use_main_content_only
|
|
167
169
|
|
|
168
|
-
#
|
|
169
|
-
#
|
|
170
|
+
# Browser wait time in milliseconds after initial page load for each crawled page.
|
|
171
|
+
# Defaults to 3500 (3.5 seconds). Min: 0. Max: 30000 (30 seconds).
|
|
170
172
|
sig { returns(T.nilable(Integer)) }
|
|
171
173
|
attr_reader :wait_for_ms
|
|
172
174
|
|
|
@@ -263,13 +265,15 @@ module ContextDev
|
|
|
263
265
|
# than this value, it will be aborted with a 408 status code. Maximum allowed
|
|
264
266
|
# value is 300000ms (5 minutes).
|
|
265
267
|
timeout_ms: nil,
|
|
266
|
-
# Regex pattern. Only URLs matching this pattern will be followed and scraped.
|
|
268
|
+
# Regex pattern. Only URLs matching this pattern will be followed and scraped. An
|
|
269
|
+
# automatic prefix scope in the form ^<starting URL> follows a redirect of the
|
|
270
|
+
# starting page.
|
|
267
271
|
url_regex: nil,
|
|
268
272
|
# Extract only the main content, stripping headers, footers, sidebars, and
|
|
269
273
|
# navigation
|
|
270
274
|
use_main_content_only: nil,
|
|
271
|
-
#
|
|
272
|
-
#
|
|
275
|
+
# Browser wait time in milliseconds after initial page load for each crawled page.
|
|
276
|
+
# Defaults to 3500 (3.5 seconds). Min: 0. Max: 30000 (30 seconds).
|
|
273
277
|
wait_for_ms: nil,
|
|
274
278
|
# Set to enabled to bypass shared caches and omit request and response content
|
|
275
279
|
# from retained usage logs. Requires zero data retention to be enabled for your
|
|
@@ -27,7 +27,8 @@ module ContextDev
|
|
|
27
27
|
T::Array[
|
|
28
28
|
T.any(
|
|
29
29
|
ContextDev::WebWebScrapeHTMLParams::Action::Wait,
|
|
30
|
-
ContextDev::WebWebScrapeHTMLParams::Action::Perform
|
|
30
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Perform,
|
|
31
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll
|
|
31
32
|
)
|
|
32
33
|
]
|
|
33
34
|
)
|
|
@@ -155,7 +156,8 @@ module ContextDev
|
|
|
155
156
|
T::Array[
|
|
156
157
|
T.any(
|
|
157
158
|
ContextDev::WebWebScrapeHTMLParams::Action::Wait::OrHash,
|
|
158
|
-
ContextDev::WebWebScrapeHTMLParams::Action::Perform::OrHash
|
|
159
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Perform::OrHash,
|
|
160
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::OrHash
|
|
159
161
|
)
|
|
160
162
|
]
|
|
161
163
|
),
|
|
@@ -242,7 +244,8 @@ module ContextDev
|
|
|
242
244
|
T::Array[
|
|
243
245
|
T.any(
|
|
244
246
|
ContextDev::WebWebScrapeHTMLParams::Action::Wait,
|
|
245
|
-
ContextDev::WebWebScrapeHTMLParams::Action::Perform
|
|
247
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Perform,
|
|
248
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll
|
|
246
249
|
)
|
|
247
250
|
]
|
|
248
251
|
),
|
|
@@ -275,7 +278,8 @@ module ContextDev
|
|
|
275
278
|
T.type_alias do
|
|
276
279
|
T.any(
|
|
277
280
|
ContextDev::WebWebScrapeHTMLParams::Action::Wait,
|
|
278
|
-
ContextDev::WebWebScrapeHTMLParams::Action::Perform
|
|
281
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Perform,
|
|
282
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll
|
|
279
283
|
)
|
|
280
284
|
end
|
|
281
285
|
|
|
@@ -331,6 +335,216 @@ module ContextDev
|
|
|
331
335
|
end
|
|
332
336
|
end
|
|
333
337
|
|
|
338
|
+
class Scroll < ContextDev::Internal::Type::BaseModel
|
|
339
|
+
OrHash =
|
|
340
|
+
T.type_alias do
|
|
341
|
+
T.any(
|
|
342
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll,
|
|
343
|
+
ContextDev::Internal::AnyHash
|
|
344
|
+
)
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
sig { returns(Symbol) }
|
|
348
|
+
attr_accessor :do_
|
|
349
|
+
|
|
350
|
+
# Pixels per scroll, one visible viewport, or the current scroll boundary.
|
|
351
|
+
# Defaults to viewport.
|
|
352
|
+
sig do
|
|
353
|
+
returns(
|
|
354
|
+
T.nilable(
|
|
355
|
+
T.any(
|
|
356
|
+
Integer,
|
|
357
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Amount::OrSymbol
|
|
358
|
+
)
|
|
359
|
+
)
|
|
360
|
+
)
|
|
361
|
+
end
|
|
362
|
+
attr_reader :amount
|
|
363
|
+
|
|
364
|
+
sig do
|
|
365
|
+
params(
|
|
366
|
+
amount:
|
|
367
|
+
T.any(
|
|
368
|
+
Integer,
|
|
369
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Amount::OrSymbol
|
|
370
|
+
)
|
|
371
|
+
).void
|
|
372
|
+
end
|
|
373
|
+
attr_writer :amount
|
|
374
|
+
|
|
375
|
+
# CSS selector for the first matching scroll container. Defaults to the page.
|
|
376
|
+
sig { returns(T.nilable(String)) }
|
|
377
|
+
attr_reader :container
|
|
378
|
+
|
|
379
|
+
sig { params(container: String).void }
|
|
380
|
+
attr_writer :container
|
|
381
|
+
|
|
382
|
+
# Direction to scroll. Defaults to down.
|
|
383
|
+
sig do
|
|
384
|
+
returns(
|
|
385
|
+
T.nilable(
|
|
386
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Direction::OrSymbol
|
|
387
|
+
)
|
|
388
|
+
)
|
|
389
|
+
end
|
|
390
|
+
attr_reader :direction
|
|
391
|
+
|
|
392
|
+
sig do
|
|
393
|
+
params(
|
|
394
|
+
direction:
|
|
395
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Direction::OrSymbol
|
|
396
|
+
).void
|
|
397
|
+
end
|
|
398
|
+
attr_writer :direction
|
|
399
|
+
|
|
400
|
+
# Maximum scroll iterations. Stops early when scrolling and scrollable extent stop
|
|
401
|
+
# changing. Defaults to 1.
|
|
402
|
+
sig { returns(T.nilable(Integer)) }
|
|
403
|
+
attr_reader :max_scrolls
|
|
404
|
+
|
|
405
|
+
sig { params(max_scrolls: Integer).void }
|
|
406
|
+
attr_writer :max_scrolls
|
|
407
|
+
|
|
408
|
+
# Scroll the page or a selected scrollable container, waiting adaptively for
|
|
409
|
+
# content and dimensions to settle after each iteration.
|
|
410
|
+
sig do
|
|
411
|
+
params(
|
|
412
|
+
amount:
|
|
413
|
+
T.any(
|
|
414
|
+
Integer,
|
|
415
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Amount::OrSymbol
|
|
416
|
+
),
|
|
417
|
+
container: String,
|
|
418
|
+
direction:
|
|
419
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Direction::OrSymbol,
|
|
420
|
+
max_scrolls: Integer,
|
|
421
|
+
do_: Symbol
|
|
422
|
+
).returns(T.attached_class)
|
|
423
|
+
end
|
|
424
|
+
def self.new(
|
|
425
|
+
# Pixels per scroll, one visible viewport, or the current scroll boundary.
|
|
426
|
+
# Defaults to viewport.
|
|
427
|
+
amount: nil,
|
|
428
|
+
# CSS selector for the first matching scroll container. Defaults to the page.
|
|
429
|
+
container: nil,
|
|
430
|
+
# Direction to scroll. Defaults to down.
|
|
431
|
+
direction: nil,
|
|
432
|
+
# Maximum scroll iterations. Stops early when scrolling and scrollable extent stop
|
|
433
|
+
# changing. Defaults to 1.
|
|
434
|
+
max_scrolls: nil,
|
|
435
|
+
do_: :scroll
|
|
436
|
+
)
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
sig do
|
|
440
|
+
override.returns(
|
|
441
|
+
{
|
|
442
|
+
do_: Symbol,
|
|
443
|
+
amount:
|
|
444
|
+
T.any(
|
|
445
|
+
Integer,
|
|
446
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Amount::OrSymbol
|
|
447
|
+
),
|
|
448
|
+
container: String,
|
|
449
|
+
direction:
|
|
450
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Direction::OrSymbol,
|
|
451
|
+
max_scrolls: Integer
|
|
452
|
+
}
|
|
453
|
+
)
|
|
454
|
+
end
|
|
455
|
+
def to_hash
|
|
456
|
+
end
|
|
457
|
+
|
|
458
|
+
# Pixels per scroll, one visible viewport, or the current scroll boundary.
|
|
459
|
+
# Defaults to viewport.
|
|
460
|
+
module Amount
|
|
461
|
+
extend ContextDev::Internal::Type::Union
|
|
462
|
+
|
|
463
|
+
Variants =
|
|
464
|
+
T.type_alias do
|
|
465
|
+
T.any(
|
|
466
|
+
Integer,
|
|
467
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Amount::TaggedSymbol
|
|
468
|
+
)
|
|
469
|
+
end
|
|
470
|
+
|
|
471
|
+
sig do
|
|
472
|
+
override.returns(
|
|
473
|
+
T::Array[
|
|
474
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Amount::Variants
|
|
475
|
+
]
|
|
476
|
+
)
|
|
477
|
+
end
|
|
478
|
+
def self.variants
|
|
479
|
+
end
|
|
480
|
+
|
|
481
|
+
TaggedSymbol =
|
|
482
|
+
T.type_alias do
|
|
483
|
+
T.all(
|
|
484
|
+
Symbol,
|
|
485
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Amount
|
|
486
|
+
)
|
|
487
|
+
end
|
|
488
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
489
|
+
|
|
490
|
+
VIEWPORT =
|
|
491
|
+
T.let(
|
|
492
|
+
:viewport,
|
|
493
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Amount::TaggedSymbol
|
|
494
|
+
)
|
|
495
|
+
MAX =
|
|
496
|
+
T.let(
|
|
497
|
+
:max,
|
|
498
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Amount::TaggedSymbol
|
|
499
|
+
)
|
|
500
|
+
end
|
|
501
|
+
|
|
502
|
+
# Direction to scroll. Defaults to down.
|
|
503
|
+
module Direction
|
|
504
|
+
extend ContextDev::Internal::Type::Enum
|
|
505
|
+
|
|
506
|
+
TaggedSymbol =
|
|
507
|
+
T.type_alias do
|
|
508
|
+
T.all(
|
|
509
|
+
Symbol,
|
|
510
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Direction
|
|
511
|
+
)
|
|
512
|
+
end
|
|
513
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
514
|
+
|
|
515
|
+
UP =
|
|
516
|
+
T.let(
|
|
517
|
+
:up,
|
|
518
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Direction::TaggedSymbol
|
|
519
|
+
)
|
|
520
|
+
DOWN =
|
|
521
|
+
T.let(
|
|
522
|
+
:down,
|
|
523
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Direction::TaggedSymbol
|
|
524
|
+
)
|
|
525
|
+
LEFT =
|
|
526
|
+
T.let(
|
|
527
|
+
:left,
|
|
528
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Direction::TaggedSymbol
|
|
529
|
+
)
|
|
530
|
+
RIGHT =
|
|
531
|
+
T.let(
|
|
532
|
+
:right,
|
|
533
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Direction::TaggedSymbol
|
|
534
|
+
)
|
|
535
|
+
|
|
536
|
+
sig do
|
|
537
|
+
override.returns(
|
|
538
|
+
T::Array[
|
|
539
|
+
ContextDev::WebWebScrapeHTMLParams::Action::Scroll::Direction::TaggedSymbol
|
|
540
|
+
]
|
|
541
|
+
)
|
|
542
|
+
end
|
|
543
|
+
def self.values
|
|
544
|
+
end
|
|
545
|
+
end
|
|
546
|
+
end
|
|
547
|
+
|
|
334
548
|
sig do
|
|
335
549
|
override.returns(
|
|
336
550
|
T::Array[ContextDev::WebWebScrapeHTMLParams::Action::Variants]
|
|
@@ -27,7 +27,8 @@ module ContextDev
|
|
|
27
27
|
T::Array[
|
|
28
28
|
T.any(
|
|
29
29
|
ContextDev::WebWebScrapeImagesParams::Action::Wait,
|
|
30
|
-
ContextDev::WebWebScrapeImagesParams::Action::Perform
|
|
30
|
+
ContextDev::WebWebScrapeImagesParams::Action::Perform,
|
|
31
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll
|
|
31
32
|
)
|
|
32
33
|
]
|
|
33
34
|
)
|
|
@@ -105,7 +106,8 @@ module ContextDev
|
|
|
105
106
|
T::Array[
|
|
106
107
|
T.any(
|
|
107
108
|
ContextDev::WebWebScrapeImagesParams::Action::Wait::OrHash,
|
|
108
|
-
ContextDev::WebWebScrapeImagesParams::Action::Perform::OrHash
|
|
109
|
+
ContextDev::WebWebScrapeImagesParams::Action::Perform::OrHash,
|
|
110
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::OrHash
|
|
109
111
|
)
|
|
110
112
|
]
|
|
111
113
|
),
|
|
@@ -166,7 +168,8 @@ module ContextDev
|
|
|
166
168
|
T::Array[
|
|
167
169
|
T.any(
|
|
168
170
|
ContextDev::WebWebScrapeImagesParams::Action::Wait,
|
|
169
|
-
ContextDev::WebWebScrapeImagesParams::Action::Perform
|
|
171
|
+
ContextDev::WebWebScrapeImagesParams::Action::Perform,
|
|
172
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll
|
|
170
173
|
)
|
|
171
174
|
]
|
|
172
175
|
),
|
|
@@ -194,7 +197,8 @@ module ContextDev
|
|
|
194
197
|
T.type_alias do
|
|
195
198
|
T.any(
|
|
196
199
|
ContextDev::WebWebScrapeImagesParams::Action::Wait,
|
|
197
|
-
ContextDev::WebWebScrapeImagesParams::Action::Perform
|
|
200
|
+
ContextDev::WebWebScrapeImagesParams::Action::Perform,
|
|
201
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll
|
|
198
202
|
)
|
|
199
203
|
end
|
|
200
204
|
|
|
@@ -250,6 +254,216 @@ module ContextDev
|
|
|
250
254
|
end
|
|
251
255
|
end
|
|
252
256
|
|
|
257
|
+
class Scroll < ContextDev::Internal::Type::BaseModel
|
|
258
|
+
OrHash =
|
|
259
|
+
T.type_alias do
|
|
260
|
+
T.any(
|
|
261
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll,
|
|
262
|
+
ContextDev::Internal::AnyHash
|
|
263
|
+
)
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
sig { returns(Symbol) }
|
|
267
|
+
attr_accessor :do_
|
|
268
|
+
|
|
269
|
+
# Pixels per scroll, one visible viewport, or the current scroll boundary.
|
|
270
|
+
# Defaults to viewport.
|
|
271
|
+
sig do
|
|
272
|
+
returns(
|
|
273
|
+
T.nilable(
|
|
274
|
+
T.any(
|
|
275
|
+
Integer,
|
|
276
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Amount::OrSymbol
|
|
277
|
+
)
|
|
278
|
+
)
|
|
279
|
+
)
|
|
280
|
+
end
|
|
281
|
+
attr_reader :amount
|
|
282
|
+
|
|
283
|
+
sig do
|
|
284
|
+
params(
|
|
285
|
+
amount:
|
|
286
|
+
T.any(
|
|
287
|
+
Integer,
|
|
288
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Amount::OrSymbol
|
|
289
|
+
)
|
|
290
|
+
).void
|
|
291
|
+
end
|
|
292
|
+
attr_writer :amount
|
|
293
|
+
|
|
294
|
+
# CSS selector for the first matching scroll container. Defaults to the page.
|
|
295
|
+
sig { returns(T.nilable(String)) }
|
|
296
|
+
attr_reader :container
|
|
297
|
+
|
|
298
|
+
sig { params(container: String).void }
|
|
299
|
+
attr_writer :container
|
|
300
|
+
|
|
301
|
+
# Direction to scroll. Defaults to down.
|
|
302
|
+
sig do
|
|
303
|
+
returns(
|
|
304
|
+
T.nilable(
|
|
305
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Direction::OrSymbol
|
|
306
|
+
)
|
|
307
|
+
)
|
|
308
|
+
end
|
|
309
|
+
attr_reader :direction
|
|
310
|
+
|
|
311
|
+
sig do
|
|
312
|
+
params(
|
|
313
|
+
direction:
|
|
314
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Direction::OrSymbol
|
|
315
|
+
).void
|
|
316
|
+
end
|
|
317
|
+
attr_writer :direction
|
|
318
|
+
|
|
319
|
+
# Maximum scroll iterations. Stops early when scrolling and scrollable extent stop
|
|
320
|
+
# changing. Defaults to 1.
|
|
321
|
+
sig { returns(T.nilable(Integer)) }
|
|
322
|
+
attr_reader :max_scrolls
|
|
323
|
+
|
|
324
|
+
sig { params(max_scrolls: Integer).void }
|
|
325
|
+
attr_writer :max_scrolls
|
|
326
|
+
|
|
327
|
+
# Scroll the page or a selected scrollable container, waiting adaptively for
|
|
328
|
+
# content and dimensions to settle after each iteration.
|
|
329
|
+
sig do
|
|
330
|
+
params(
|
|
331
|
+
amount:
|
|
332
|
+
T.any(
|
|
333
|
+
Integer,
|
|
334
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Amount::OrSymbol
|
|
335
|
+
),
|
|
336
|
+
container: String,
|
|
337
|
+
direction:
|
|
338
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Direction::OrSymbol,
|
|
339
|
+
max_scrolls: Integer,
|
|
340
|
+
do_: Symbol
|
|
341
|
+
).returns(T.attached_class)
|
|
342
|
+
end
|
|
343
|
+
def self.new(
|
|
344
|
+
# Pixels per scroll, one visible viewport, or the current scroll boundary.
|
|
345
|
+
# Defaults to viewport.
|
|
346
|
+
amount: nil,
|
|
347
|
+
# CSS selector for the first matching scroll container. Defaults to the page.
|
|
348
|
+
container: nil,
|
|
349
|
+
# Direction to scroll. Defaults to down.
|
|
350
|
+
direction: nil,
|
|
351
|
+
# Maximum scroll iterations. Stops early when scrolling and scrollable extent stop
|
|
352
|
+
# changing. Defaults to 1.
|
|
353
|
+
max_scrolls: nil,
|
|
354
|
+
do_: :scroll
|
|
355
|
+
)
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
sig do
|
|
359
|
+
override.returns(
|
|
360
|
+
{
|
|
361
|
+
do_: Symbol,
|
|
362
|
+
amount:
|
|
363
|
+
T.any(
|
|
364
|
+
Integer,
|
|
365
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Amount::OrSymbol
|
|
366
|
+
),
|
|
367
|
+
container: String,
|
|
368
|
+
direction:
|
|
369
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Direction::OrSymbol,
|
|
370
|
+
max_scrolls: Integer
|
|
371
|
+
}
|
|
372
|
+
)
|
|
373
|
+
end
|
|
374
|
+
def to_hash
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
# Pixels per scroll, one visible viewport, or the current scroll boundary.
|
|
378
|
+
# Defaults to viewport.
|
|
379
|
+
module Amount
|
|
380
|
+
extend ContextDev::Internal::Type::Union
|
|
381
|
+
|
|
382
|
+
Variants =
|
|
383
|
+
T.type_alias do
|
|
384
|
+
T.any(
|
|
385
|
+
Integer,
|
|
386
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Amount::TaggedSymbol
|
|
387
|
+
)
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
sig do
|
|
391
|
+
override.returns(
|
|
392
|
+
T::Array[
|
|
393
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Amount::Variants
|
|
394
|
+
]
|
|
395
|
+
)
|
|
396
|
+
end
|
|
397
|
+
def self.variants
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
TaggedSymbol =
|
|
401
|
+
T.type_alias do
|
|
402
|
+
T.all(
|
|
403
|
+
Symbol,
|
|
404
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Amount
|
|
405
|
+
)
|
|
406
|
+
end
|
|
407
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
408
|
+
|
|
409
|
+
VIEWPORT =
|
|
410
|
+
T.let(
|
|
411
|
+
:viewport,
|
|
412
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Amount::TaggedSymbol
|
|
413
|
+
)
|
|
414
|
+
MAX =
|
|
415
|
+
T.let(
|
|
416
|
+
:max,
|
|
417
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Amount::TaggedSymbol
|
|
418
|
+
)
|
|
419
|
+
end
|
|
420
|
+
|
|
421
|
+
# Direction to scroll. Defaults to down.
|
|
422
|
+
module Direction
|
|
423
|
+
extend ContextDev::Internal::Type::Enum
|
|
424
|
+
|
|
425
|
+
TaggedSymbol =
|
|
426
|
+
T.type_alias do
|
|
427
|
+
T.all(
|
|
428
|
+
Symbol,
|
|
429
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Direction
|
|
430
|
+
)
|
|
431
|
+
end
|
|
432
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
433
|
+
|
|
434
|
+
UP =
|
|
435
|
+
T.let(
|
|
436
|
+
:up,
|
|
437
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Direction::TaggedSymbol
|
|
438
|
+
)
|
|
439
|
+
DOWN =
|
|
440
|
+
T.let(
|
|
441
|
+
:down,
|
|
442
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Direction::TaggedSymbol
|
|
443
|
+
)
|
|
444
|
+
LEFT =
|
|
445
|
+
T.let(
|
|
446
|
+
:left,
|
|
447
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Direction::TaggedSymbol
|
|
448
|
+
)
|
|
449
|
+
RIGHT =
|
|
450
|
+
T.let(
|
|
451
|
+
:right,
|
|
452
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Direction::TaggedSymbol
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
sig do
|
|
456
|
+
override.returns(
|
|
457
|
+
T::Array[
|
|
458
|
+
ContextDev::WebWebScrapeImagesParams::Action::Scroll::Direction::TaggedSymbol
|
|
459
|
+
]
|
|
460
|
+
)
|
|
461
|
+
end
|
|
462
|
+
def self.values
|
|
463
|
+
end
|
|
464
|
+
end
|
|
465
|
+
end
|
|
466
|
+
|
|
253
467
|
sig do
|
|
254
468
|
override.returns(
|
|
255
469
|
T::Array[ContextDev::WebWebScrapeImagesParams::Action::Variants]
|