crawlberg 1.1.3 → 1.2.1
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/ext/crawlberg_rb/native/Cargo.lock +55 -54
- data/ext/crawlberg_rb/native/Cargo.toml +2 -2
- data/ext/crawlberg_rb/src/lib.rs +311 -52
- data/lib/crawlberg/native.rb +110 -1
- data/lib/crawlberg/version.rb +2 -2
- data/lib/crawlberg.rb +1 -1
- data/lib/crawlberg_rb.so +0 -0
- data/sig/types.rbs +23 -6
- metadata +2 -2
data/ext/crawlberg_rb/src/lib.rs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file is auto-generated by alef. DO NOT EDIT.
|
|
2
|
-
// alef:hash:
|
|
2
|
+
// alef:hash:0ce4d753fdb4854e44358639dcbaebee3449a4afa142dbc4f0a72aa72c214648
|
|
3
3
|
// Re-generate with: alef generate
|
|
4
4
|
#![allow(dead_code, unused_imports, unused_variables)]
|
|
5
5
|
#![allow(
|
|
@@ -557,6 +557,7 @@ impl BrowserConfig {
|
|
|
557
557
|
pub struct CrawlConfig {
|
|
558
558
|
max_depth: Option<usize>,
|
|
559
559
|
max_pages: Option<usize>,
|
|
560
|
+
max_links_per_page: Option<usize>,
|
|
560
561
|
max_concurrent: Option<usize>,
|
|
561
562
|
respect_robots_txt: bool,
|
|
562
563
|
soft_http_errors: bool,
|
|
@@ -591,10 +592,13 @@ pub struct CrawlConfig {
|
|
|
591
592
|
download_documents: bool,
|
|
592
593
|
document_max_size: Option<usize>,
|
|
593
594
|
document_mime_types: Vec<String>,
|
|
595
|
+
document_output_dir: Option<String>,
|
|
596
|
+
document_content_encoding: Option<DocumentContentEncoding>,
|
|
594
597
|
warc_output: Option<String>,
|
|
595
598
|
browser_profile: Option<String>,
|
|
596
599
|
save_browser_profile: bool,
|
|
597
600
|
ssrf: SsrfPolicy,
|
|
601
|
+
ssrf_deny_private_explicit: Option<bool>,
|
|
598
602
|
}
|
|
599
603
|
|
|
600
604
|
unsafe impl IntoValueFromNative for CrawlConfig {}
|
|
@@ -644,6 +648,9 @@ impl CrawlConfig {
|
|
|
644
648
|
max_pages: kwargs
|
|
645
649
|
.get(ruby.to_symbol("max_pages"))
|
|
646
650
|
.and_then(|v| usize::try_convert(v).ok()),
|
|
651
|
+
max_links_per_page: kwargs
|
|
652
|
+
.get(ruby.to_symbol("max_links_per_page"))
|
|
653
|
+
.and_then(|v| usize::try_convert(v).ok()),
|
|
647
654
|
max_concurrent: kwargs
|
|
648
655
|
.get(ruby.to_symbol("max_concurrent"))
|
|
649
656
|
.and_then(|v| usize::try_convert(v).ok()),
|
|
@@ -765,6 +772,12 @@ impl CrawlConfig {
|
|
|
765
772
|
.get(ruby.to_symbol("document_mime_types"))
|
|
766
773
|
.and_then(|v| <Vec<String>>::try_convert(v).ok())
|
|
767
774
|
.unwrap_or_default(),
|
|
775
|
+
document_output_dir: kwargs
|
|
776
|
+
.get(ruby.to_symbol("document_output_dir"))
|
|
777
|
+
.and_then(|v| String::try_convert(v).ok()),
|
|
778
|
+
document_content_encoding: kwargs
|
|
779
|
+
.get(ruby.to_symbol("document_content_encoding"))
|
|
780
|
+
.and_then(|v| DocumentContentEncoding::try_convert(v).ok()),
|
|
768
781
|
warc_output: kwargs
|
|
769
782
|
.get(ruby.to_symbol("warc_output"))
|
|
770
783
|
.and_then(|v| String::try_convert(v).ok()),
|
|
@@ -779,6 +792,9 @@ impl CrawlConfig {
|
|
|
779
792
|
.get(ruby.to_symbol("ssrf"))
|
|
780
793
|
.and_then(|v| SsrfPolicy::try_convert(v).ok())
|
|
781
794
|
.unwrap_or_default(),
|
|
795
|
+
ssrf_deny_private_explicit: kwargs
|
|
796
|
+
.get(ruby.to_symbol("ssrf_deny_private_explicit"))
|
|
797
|
+
.and_then(|v| bool::try_convert(v).ok()),
|
|
782
798
|
})
|
|
783
799
|
}
|
|
784
800
|
|
|
@@ -790,6 +806,10 @@ impl CrawlConfig {
|
|
|
790
806
|
self.max_pages
|
|
791
807
|
}
|
|
792
808
|
|
|
809
|
+
fn max_links_per_page(&self) -> Option<usize> {
|
|
810
|
+
self.max_links_per_page
|
|
811
|
+
}
|
|
812
|
+
|
|
793
813
|
fn max_concurrent(&self) -> Option<usize> {
|
|
794
814
|
self.max_concurrent
|
|
795
815
|
}
|
|
@@ -922,6 +942,14 @@ impl CrawlConfig {
|
|
|
922
942
|
self.document_mime_types.clone()
|
|
923
943
|
}
|
|
924
944
|
|
|
945
|
+
fn document_output_dir(&self) -> Option<String> {
|
|
946
|
+
self.document_output_dir.clone()
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
fn document_content_encoding(&self) -> Option<DocumentContentEncoding> {
|
|
950
|
+
self.document_content_encoding.clone()
|
|
951
|
+
}
|
|
952
|
+
|
|
925
953
|
fn warc_output(&self) -> Option<String> {
|
|
926
954
|
self.warc_output.clone()
|
|
927
955
|
}
|
|
@@ -938,6 +966,10 @@ impl CrawlConfig {
|
|
|
938
966
|
self.ssrf.clone()
|
|
939
967
|
}
|
|
940
968
|
|
|
969
|
+
fn ssrf_deny_private_explicit(&self) -> Option<bool> {
|
|
970
|
+
self.ssrf_deny_private_explicit
|
|
971
|
+
}
|
|
972
|
+
|
|
941
973
|
fn validate(&self) -> Result<(), Error> {
|
|
942
974
|
#[allow(clippy::needless_update)]
|
|
943
975
|
let core_self = crawlberg::CrawlConfig {
|
|
@@ -945,6 +977,8 @@ impl CrawlConfig {
|
|
|
945
977
|
|
|
946
978
|
max_pages: self.max_pages,
|
|
947
979
|
|
|
980
|
+
max_links_per_page: self.max_links_per_page,
|
|
981
|
+
|
|
948
982
|
max_concurrent: self.max_concurrent,
|
|
949
983
|
|
|
950
984
|
respect_robots_txt: self.respect_robots_txt,
|
|
@@ -1016,6 +1050,10 @@ impl CrawlConfig {
|
|
|
1016
1050
|
|
|
1017
1051
|
document_mime_types: self.document_mime_types.clone(),
|
|
1018
1052
|
|
|
1053
|
+
document_output_dir: self.document_output_dir.clone().map(Into::into),
|
|
1054
|
+
|
|
1055
|
+
document_content_encoding: self.document_content_encoding.clone().map(Into::into),
|
|
1056
|
+
|
|
1019
1057
|
warc_output: self.warc_output.clone().map(Into::into),
|
|
1020
1058
|
|
|
1021
1059
|
browser_profile: self.browser_profile.clone(),
|
|
@@ -1024,6 +1062,8 @@ impl CrawlConfig {
|
|
|
1024
1062
|
|
|
1025
1063
|
ssrf: self.ssrf.clone().into(),
|
|
1026
1064
|
|
|
1065
|
+
ssrf_deny_private_explicit: self.ssrf_deny_private_explicit,
|
|
1066
|
+
|
|
1027
1067
|
..Default::default()
|
|
1028
1068
|
};
|
|
1029
1069
|
let result = core_self.validate().map_err(|e| {
|
|
@@ -1123,6 +1163,9 @@ pub struct DownloadedDocument {
|
|
|
1123
1163
|
filename: Option<String>,
|
|
1124
1164
|
content_hash: String,
|
|
1125
1165
|
headers: HashMap<String, String>,
|
|
1166
|
+
truncated: bool,
|
|
1167
|
+
content_path: Option<String>,
|
|
1168
|
+
content_base64: Option<String>,
|
|
1126
1169
|
}
|
|
1127
1170
|
|
|
1128
1171
|
unsafe impl IntoValueFromNative for DownloadedDocument {}
|
|
@@ -1189,6 +1232,16 @@ impl DownloadedDocument {
|
|
|
1189
1232
|
.get(ruby.to_symbol("headers"))
|
|
1190
1233
|
.and_then(|v| <HashMap<String, String>>::try_convert(v).ok())
|
|
1191
1234
|
.unwrap_or_default(),
|
|
1235
|
+
truncated: kwargs
|
|
1236
|
+
.get(ruby.to_symbol("truncated"))
|
|
1237
|
+
.and_then(|v| bool::try_convert(v).ok())
|
|
1238
|
+
.unwrap_or_default(),
|
|
1239
|
+
content_path: kwargs
|
|
1240
|
+
.get(ruby.to_symbol("content_path"))
|
|
1241
|
+
.and_then(|v| String::try_convert(v).ok()),
|
|
1242
|
+
content_base64: kwargs
|
|
1243
|
+
.get(ruby.to_symbol("content_base64"))
|
|
1244
|
+
.and_then(|v| String::try_convert(v).ok()),
|
|
1192
1245
|
})
|
|
1193
1246
|
}
|
|
1194
1247
|
|
|
@@ -1215,6 +1268,18 @@ impl DownloadedDocument {
|
|
|
1215
1268
|
fn headers(&self) -> HashMap<String, String> {
|
|
1216
1269
|
self.headers.clone()
|
|
1217
1270
|
}
|
|
1271
|
+
|
|
1272
|
+
fn truncated(&self) -> bool {
|
|
1273
|
+
self.truncated
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
fn content_path(&self) -> Option<String> {
|
|
1277
|
+
self.content_path.clone()
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
fn content_base64(&self) -> Option<String> {
|
|
1281
|
+
self.content_base64.clone()
|
|
1282
|
+
}
|
|
1218
1283
|
}
|
|
1219
1284
|
|
|
1220
1285
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
@@ -1224,6 +1289,7 @@ pub struct InteractionResult {
|
|
|
1224
1289
|
action_results: Vec<ActionResult>,
|
|
1225
1290
|
final_html: String,
|
|
1226
1291
|
final_url: String,
|
|
1292
|
+
screenshot_base64: Option<String>,
|
|
1227
1293
|
}
|
|
1228
1294
|
|
|
1229
1295
|
unsafe impl IntoValueFromNative for InteractionResult {}
|
|
@@ -1279,6 +1345,9 @@ impl InteractionResult {
|
|
|
1279
1345
|
.get(ruby.to_symbol("final_url"))
|
|
1280
1346
|
.and_then(|v| String::try_convert(v).ok())
|
|
1281
1347
|
.unwrap_or_default(),
|
|
1348
|
+
screenshot_base64: kwargs
|
|
1349
|
+
.get(ruby.to_symbol("screenshot_base64"))
|
|
1350
|
+
.and_then(|v| String::try_convert(v).ok()),
|
|
1282
1351
|
})
|
|
1283
1352
|
}
|
|
1284
1353
|
|
|
@@ -1293,6 +1362,10 @@ impl InteractionResult {
|
|
|
1293
1362
|
fn final_url(&self) -> String {
|
|
1294
1363
|
self.final_url.clone()
|
|
1295
1364
|
}
|
|
1365
|
+
|
|
1366
|
+
fn screenshot_base64(&self) -> Option<String> {
|
|
1367
|
+
self.screenshot_base64.clone()
|
|
1368
|
+
}
|
|
1296
1369
|
}
|
|
1297
1370
|
|
|
1298
1371
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
@@ -1419,6 +1492,7 @@ pub struct ScrapeResult {
|
|
|
1419
1492
|
markdown: Option<MarkdownResult>,
|
|
1420
1493
|
extracted_data: Option<String>,
|
|
1421
1494
|
extraction_meta: Option<ExtractionMeta>,
|
|
1495
|
+
screenshot_base64: Option<String>,
|
|
1422
1496
|
downloaded_document: Option<DownloadedDocument>,
|
|
1423
1497
|
browser: Option<BrowserExtras>,
|
|
1424
1498
|
}
|
|
@@ -1561,6 +1635,9 @@ impl ScrapeResult {
|
|
|
1561
1635
|
extraction_meta: kwargs
|
|
1562
1636
|
.get(ruby.to_symbol("extraction_meta"))
|
|
1563
1637
|
.and_then(|v| ExtractionMeta::try_convert(v).ok()),
|
|
1638
|
+
screenshot_base64: kwargs
|
|
1639
|
+
.get(ruby.to_symbol("screenshot_base64"))
|
|
1640
|
+
.and_then(|v| String::try_convert(v).ok()),
|
|
1564
1641
|
downloaded_document: kwargs
|
|
1565
1642
|
.get(ruby.to_symbol("downloaded_document"))
|
|
1566
1643
|
.and_then(|v| DownloadedDocument::try_convert(v).ok()),
|
|
@@ -1674,6 +1751,10 @@ impl ScrapeResult {
|
|
|
1674
1751
|
self.extraction_meta.clone()
|
|
1675
1752
|
}
|
|
1676
1753
|
|
|
1754
|
+
fn screenshot_base64(&self) -> Option<String> {
|
|
1755
|
+
self.screenshot_base64.clone()
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1677
1758
|
fn downloaded_document(&self) -> Option<DownloadedDocument> {
|
|
1678
1759
|
self.downloaded_document.clone()
|
|
1679
1760
|
}
|
|
@@ -4358,6 +4439,7 @@ impl BatchCrawlResults {
|
|
|
4358
4439
|
#[magnus::wrap(class = "Crawlberg::SsrfPolicy")]
|
|
4359
4440
|
pub struct SsrfPolicy {
|
|
4360
4441
|
deny_private: bool,
|
|
4442
|
+
allowlist: Vec<HostMatcher>,
|
|
4361
4443
|
max_redirects: u8,
|
|
4362
4444
|
}
|
|
4363
4445
|
|
|
@@ -4406,6 +4488,10 @@ impl SsrfPolicy {
|
|
|
4406
4488
|
.get(ruby.to_symbol("deny_private"))
|
|
4407
4489
|
.and_then(|v| bool::try_convert(v).ok())
|
|
4408
4490
|
.unwrap_or(true),
|
|
4491
|
+
allowlist: kwargs
|
|
4492
|
+
.get(ruby.to_symbol("allowlist"))
|
|
4493
|
+
.and_then(|v| <Vec<HostMatcher>>::try_convert(v).ok())
|
|
4494
|
+
.unwrap_or_default(),
|
|
4409
4495
|
max_redirects: kwargs
|
|
4410
4496
|
.get(ruby.to_symbol("max_redirects"))
|
|
4411
4497
|
.and_then(|v| u8::try_convert(v).ok())
|
|
@@ -4417,6 +4503,10 @@ impl SsrfPolicy {
|
|
|
4417
4503
|
self.deny_private
|
|
4418
4504
|
}
|
|
4419
4505
|
|
|
4506
|
+
fn allowlist(&self) -> Vec<HostMatcher> {
|
|
4507
|
+
self.allowlist.clone()
|
|
4508
|
+
}
|
|
4509
|
+
|
|
4420
4510
|
fn max_redirects(&self) -> u8 {
|
|
4421
4511
|
self.max_redirects
|
|
4422
4512
|
}
|
|
@@ -4557,6 +4647,45 @@ impl magnus::TryConvert for BrowserBackend {
|
|
|
4557
4647
|
unsafe impl IntoValueFromNative for BrowserBackend {}
|
|
4558
4648
|
unsafe impl TryConvertOwned for BrowserBackend {}
|
|
4559
4649
|
|
|
4650
|
+
#[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
|
|
4651
|
+
#[serde(rename_all = "snake_case")]
|
|
4652
|
+
pub enum DocumentContentEncoding {
|
|
4653
|
+
Base64,
|
|
4654
|
+
}
|
|
4655
|
+
|
|
4656
|
+
impl Default for DocumentContentEncoding {
|
|
4657
|
+
fn default() -> Self {
|
|
4658
|
+
Self::Base64
|
|
4659
|
+
}
|
|
4660
|
+
}
|
|
4661
|
+
|
|
4662
|
+
impl magnus::IntoValue for DocumentContentEncoding {
|
|
4663
|
+
fn into_value_with(self, handle: &Ruby) -> magnus::Value {
|
|
4664
|
+
let sym = match self {
|
|
4665
|
+
DocumentContentEncoding::Base64 => "base64",
|
|
4666
|
+
};
|
|
4667
|
+
handle.to_symbol(sym).into_value_with(handle)
|
|
4668
|
+
}
|
|
4669
|
+
}
|
|
4670
|
+
|
|
4671
|
+
impl magnus::TryConvert for DocumentContentEncoding {
|
|
4672
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
4673
|
+
let s: String = magnus::TryConvert::try_convert(val)?;
|
|
4674
|
+
// Accept the serde wire name (snake_case), the PascalCase Rust variant name,
|
|
4675
|
+
// and a lowercase fallback so fixtures written in any of those styles work.
|
|
4676
|
+
match s.as_str() {
|
|
4677
|
+
"base64" | "Base64" => Ok(DocumentContentEncoding::Base64),
|
|
4678
|
+
other => Err(magnus::Error::new(
|
|
4679
|
+
unsafe { Ruby::get_unchecked() }.exception_arg_error(),
|
|
4680
|
+
format!("invalid DocumentContentEncoding value: {other}"),
|
|
4681
|
+
)),
|
|
4682
|
+
}
|
|
4683
|
+
}
|
|
4684
|
+
}
|
|
4685
|
+
|
|
4686
|
+
unsafe impl IntoValueFromNative for DocumentContentEncoding {}
|
|
4687
|
+
unsafe impl TryConvertOwned for DocumentContentEncoding {}
|
|
4688
|
+
|
|
4560
4689
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
4561
4690
|
#[serde(tag = "type")]
|
|
4562
4691
|
pub enum AuthConfig {
|
|
@@ -5020,6 +5149,68 @@ impl magnus::TryConvert for ScrollDirection {
|
|
|
5020
5149
|
unsafe impl IntoValueFromNative for ScrollDirection {}
|
|
5021
5150
|
unsafe impl TryConvertOwned for ScrollDirection {}
|
|
5022
5151
|
|
|
5152
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
5153
|
+
#[serde(tag = "type")]
|
|
5154
|
+
#[serde(rename_all = "snake_case")]
|
|
5155
|
+
pub enum HostMatcher {
|
|
5156
|
+
Exact { value: String },
|
|
5157
|
+
Suffix { value: String },
|
|
5158
|
+
Cidr { value: String },
|
|
5159
|
+
}
|
|
5160
|
+
|
|
5161
|
+
impl Default for HostMatcher {
|
|
5162
|
+
fn default() -> Self {
|
|
5163
|
+
Self::Exact {
|
|
5164
|
+
value: Default::default(),
|
|
5165
|
+
}
|
|
5166
|
+
}
|
|
5167
|
+
}
|
|
5168
|
+
|
|
5169
|
+
impl magnus::IntoValue for HostMatcher {
|
|
5170
|
+
fn into_value_with(self, handle: &Ruby) -> magnus::Value {
|
|
5171
|
+
match serde_json::to_value(&self) {
|
|
5172
|
+
Ok(v) => json_to_ruby(handle, v),
|
|
5173
|
+
Err(_) => handle.qnil().into_value_with(handle),
|
|
5174
|
+
}
|
|
5175
|
+
}
|
|
5176
|
+
}
|
|
5177
|
+
|
|
5178
|
+
impl magnus::TryConvert for HostMatcher {
|
|
5179
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
5180
|
+
// For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
|
|
5181
|
+
// For unit enums or when passed as a string, fall back to string-based conversion.
|
|
5182
|
+
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
5183
|
+
s
|
|
5184
|
+
} else {
|
|
5185
|
+
val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
5186
|
+
magnus::Error::new(
|
|
5187
|
+
unsafe { Ruby::get_unchecked() }.exception_type_error(),
|
|
5188
|
+
format!("no implicit conversion into HostMatcher: {}", e),
|
|
5189
|
+
)
|
|
5190
|
+
})?
|
|
5191
|
+
};
|
|
5192
|
+
// Try deserializing as JSON first (handles JSON strings like "\"markdown\"" or "{\"click\":{\"selector\":\"...\"}}\"")
|
|
5193
|
+
// For internally-tagged enums, a bare variant string is wrapped as {"<tag>": value}.
|
|
5194
|
+
// If that fails, try treating it as a plain string value and wrap in quotes
|
|
5195
|
+
// If both fail, try as Custom variant (for untagged enum support)
|
|
5196
|
+
serde_json::from_str(&json_str)
|
|
5197
|
+
.or_else(|_| serde_json::from_value(serde_json::json!({ "type": json_str })))
|
|
5198
|
+
.or_else(|_| serde_json::from_str(&format!("\"{json_str}\"")))
|
|
5199
|
+
.or_else(|_| {
|
|
5200
|
+
// Try as a JSON string for Custom variant (untagged enums accept any remaining value)
|
|
5201
|
+
match serde_json::to_value(&json_str) {
|
|
5202
|
+
Ok(val) => serde_json::from_value(val),
|
|
5203
|
+
Err(e) => Err(e),
|
|
5204
|
+
}
|
|
5205
|
+
})
|
|
5206
|
+
.map_err(|e| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_type_error(), e.to_string()))
|
|
5207
|
+
}
|
|
5208
|
+
}
|
|
5209
|
+
|
|
5210
|
+
unsafe impl IntoValueFromNative for HostMatcher {}
|
|
5211
|
+
unsafe impl TryConvertOwned for HostMatcher {}
|
|
5212
|
+
impl HostMatcher {}
|
|
5213
|
+
|
|
5023
5214
|
fn generate_citations(markdown: String) -> CitationResult {
|
|
5024
5215
|
crawlberg::generate_citations(&markdown).into()
|
|
5025
5216
|
}
|
|
@@ -5279,7 +5470,6 @@ fn batch_crawl_stream(engine: CrawlEngineHandle, req: BatchCrawlStreamRequest) -
|
|
|
5279
5470
|
}
|
|
5280
5471
|
|
|
5281
5472
|
#[allow(clippy::needless_update)]
|
|
5282
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
5283
5473
|
impl From<ExtractionMeta> for crawlberg::ExtractionMeta {
|
|
5284
5474
|
fn from(val: ExtractionMeta) -> Self {
|
|
5285
5475
|
Self {
|
|
@@ -5293,7 +5483,7 @@ impl From<ExtractionMeta> for crawlberg::ExtractionMeta {
|
|
|
5293
5483
|
}
|
|
5294
5484
|
}
|
|
5295
5485
|
|
|
5296
|
-
#[allow(clippy::redundant_closure
|
|
5486
|
+
#[allow(clippy::redundant_closure)]
|
|
5297
5487
|
impl From<crawlberg::ExtractionMeta> for ExtractionMeta {
|
|
5298
5488
|
fn from(val: crawlberg::ExtractionMeta) -> Self {
|
|
5299
5489
|
Self {
|
|
@@ -5307,7 +5497,6 @@ impl From<crawlberg::ExtractionMeta> for ExtractionMeta {
|
|
|
5307
5497
|
}
|
|
5308
5498
|
|
|
5309
5499
|
#[allow(clippy::needless_update)]
|
|
5310
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
5311
5500
|
impl From<ProxyConfig> for crawlberg::ProxyConfig {
|
|
5312
5501
|
fn from(val: ProxyConfig) -> Self {
|
|
5313
5502
|
Self {
|
|
@@ -5319,7 +5508,7 @@ impl From<ProxyConfig> for crawlberg::ProxyConfig {
|
|
|
5319
5508
|
}
|
|
5320
5509
|
}
|
|
5321
5510
|
|
|
5322
|
-
#[allow(clippy::redundant_closure
|
|
5511
|
+
#[allow(clippy::redundant_closure)]
|
|
5323
5512
|
impl From<crawlberg::ProxyConfig> for ProxyConfig {
|
|
5324
5513
|
fn from(val: crawlberg::ProxyConfig) -> Self {
|
|
5325
5514
|
Self {
|
|
@@ -5331,7 +5520,6 @@ impl From<crawlberg::ProxyConfig> for ProxyConfig {
|
|
|
5331
5520
|
}
|
|
5332
5521
|
|
|
5333
5522
|
#[allow(clippy::needless_update)]
|
|
5334
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
5335
5523
|
impl From<ContentConfig> for crawlberg::ContentConfig {
|
|
5336
5524
|
fn from(val: ContentConfig) -> Self {
|
|
5337
5525
|
Self {
|
|
@@ -5352,7 +5540,6 @@ impl From<ContentConfig> for crawlberg::ContentConfig {
|
|
|
5352
5540
|
}
|
|
5353
5541
|
}
|
|
5354
5542
|
|
|
5355
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
5356
5543
|
impl From<crawlberg::ContentConfig> for ContentConfig {
|
|
5357
5544
|
fn from(val: crawlberg::ContentConfig) -> Self {
|
|
5358
5545
|
Self {
|
|
@@ -5373,7 +5560,7 @@ impl From<crawlberg::ContentConfig> for ContentConfig {
|
|
|
5373
5560
|
}
|
|
5374
5561
|
|
|
5375
5562
|
#[allow(clippy::needless_update)]
|
|
5376
|
-
#[allow(clippy::
|
|
5563
|
+
#[allow(clippy::useless_conversion)]
|
|
5377
5564
|
impl From<BrowserConfig> for crawlberg::BrowserConfig {
|
|
5378
5565
|
fn from(val: BrowserConfig) -> Self {
|
|
5379
5566
|
Self {
|
|
@@ -5423,6 +5610,7 @@ impl From<CrawlConfig> for crawlberg::CrawlConfig {
|
|
|
5423
5610
|
Self {
|
|
5424
5611
|
max_depth: val.max_depth,
|
|
5425
5612
|
max_pages: val.max_pages,
|
|
5613
|
+
max_links_per_page: val.max_links_per_page,
|
|
5426
5614
|
max_concurrent: val.max_concurrent,
|
|
5427
5615
|
respect_robots_txt: val.respect_robots_txt,
|
|
5428
5616
|
soft_http_errors: val.soft_http_errors,
|
|
@@ -5460,10 +5648,13 @@ impl From<CrawlConfig> for crawlberg::CrawlConfig {
|
|
|
5460
5648
|
download_documents: val.download_documents,
|
|
5461
5649
|
document_max_size: val.document_max_size,
|
|
5462
5650
|
document_mime_types: val.document_mime_types.into_iter().collect(),
|
|
5651
|
+
document_output_dir: val.document_output_dir.map(Into::into),
|
|
5652
|
+
document_content_encoding: val.document_content_encoding.map(Into::into),
|
|
5463
5653
|
warc_output: val.warc_output.map(Into::into),
|
|
5464
5654
|
browser_profile: val.browser_profile,
|
|
5465
5655
|
save_browser_profile: val.save_browser_profile,
|
|
5466
5656
|
ssrf: val.ssrf.into(),
|
|
5657
|
+
ssrf_deny_private_explicit: val.ssrf_deny_private_explicit,
|
|
5467
5658
|
..Default::default()
|
|
5468
5659
|
}
|
|
5469
5660
|
}
|
|
@@ -5475,6 +5666,7 @@ impl From<crawlberg::CrawlConfig> for CrawlConfig {
|
|
|
5475
5666
|
Self {
|
|
5476
5667
|
max_depth: val.max_depth,
|
|
5477
5668
|
max_pages: val.max_pages,
|
|
5669
|
+
max_links_per_page: val.max_links_per_page,
|
|
5478
5670
|
max_concurrent: val.max_concurrent,
|
|
5479
5671
|
respect_robots_txt: val.respect_robots_txt,
|
|
5480
5672
|
soft_http_errors: val.soft_http_errors,
|
|
@@ -5512,10 +5704,13 @@ impl From<crawlberg::CrawlConfig> for CrawlConfig {
|
|
|
5512
5704
|
download_documents: val.download_documents,
|
|
5513
5705
|
document_max_size: val.document_max_size,
|
|
5514
5706
|
document_mime_types: val.document_mime_types.into_iter().collect(),
|
|
5707
|
+
document_output_dir: val.document_output_dir.map(|p| p.to_string_lossy().to_string()),
|
|
5708
|
+
document_content_encoding: val.document_content_encoding.map(Into::into),
|
|
5515
5709
|
warc_output: val.warc_output.map(|p| p.to_string_lossy().to_string()),
|
|
5516
5710
|
browser_profile: val.browser_profile.map(|v| v.to_string()),
|
|
5517
5711
|
save_browser_profile: val.save_browser_profile,
|
|
5518
5712
|
ssrf: val.ssrf.into(),
|
|
5713
|
+
ssrf_deny_private_explicit: val.ssrf_deny_private_explicit,
|
|
5519
5714
|
}
|
|
5520
5715
|
}
|
|
5521
5716
|
}
|
|
@@ -5533,7 +5728,7 @@ impl From<BrowserExtras> for crawlberg::BrowserExtras {
|
|
|
5533
5728
|
}
|
|
5534
5729
|
}
|
|
5535
5730
|
|
|
5536
|
-
#[allow(clippy::
|
|
5731
|
+
#[allow(clippy::useless_conversion)]
|
|
5537
5732
|
impl From<crawlberg::BrowserExtras> for BrowserExtras {
|
|
5538
5733
|
fn from(val: crawlberg::BrowserExtras) -> Self {
|
|
5539
5734
|
Self {
|
|
@@ -5555,6 +5750,9 @@ impl From<DownloadedDocument> for crawlberg::DownloadedDocument {
|
|
|
5555
5750
|
filename: val.filename.map(Into::into),
|
|
5556
5751
|
content_hash: val.content_hash.into(),
|
|
5557
5752
|
headers: val.headers.into_iter().map(|(k, v)| (k.into(), v.into())).collect(),
|
|
5753
|
+
truncated: val.truncated,
|
|
5754
|
+
content_path: val.content_path,
|
|
5755
|
+
content_base64: val.content_base64,
|
|
5558
5756
|
..Default::default()
|
|
5559
5757
|
}
|
|
5560
5758
|
}
|
|
@@ -5570,18 +5768,22 @@ impl From<crawlberg::DownloadedDocument> for DownloadedDocument {
|
|
|
5570
5768
|
filename: val.filename.as_ref().map(|v| v.to_string()),
|
|
5571
5769
|
content_hash: val.content_hash.to_string(),
|
|
5572
5770
|
headers: val.headers.into_iter().map(|(k, v)| (k.into(), v.into())).collect(),
|
|
5771
|
+
truncated: val.truncated,
|
|
5772
|
+
content_path: val.content_path.map(|v| v.to_string()),
|
|
5773
|
+
content_base64: val.content_base64.map(|v| v.to_string()),
|
|
5573
5774
|
}
|
|
5574
5775
|
}
|
|
5575
5776
|
}
|
|
5576
5777
|
|
|
5577
5778
|
#[allow(clippy::needless_update)]
|
|
5578
|
-
#[allow(clippy::
|
|
5779
|
+
#[allow(clippy::useless_conversion)]
|
|
5579
5780
|
impl From<InteractionResult> for crawlberg::InteractionResult {
|
|
5580
5781
|
fn from(val: InteractionResult) -> Self {
|
|
5581
5782
|
Self {
|
|
5582
5783
|
action_results: val.action_results.into_iter().map(Into::into).collect(),
|
|
5583
5784
|
final_html: val.final_html,
|
|
5584
5785
|
final_url: val.final_url,
|
|
5786
|
+
screenshot_base64: val.screenshot_base64,
|
|
5585
5787
|
..Default::default()
|
|
5586
5788
|
}
|
|
5587
5789
|
}
|
|
@@ -5594,6 +5796,7 @@ impl From<crawlberg::InteractionResult> for InteractionResult {
|
|
|
5594
5796
|
action_results: val.action_results.into_iter().map(Into::into).collect(),
|
|
5595
5797
|
final_html: val.final_html.to_string(),
|
|
5596
5798
|
final_url: val.final_url.to_string(),
|
|
5799
|
+
screenshot_base64: val.screenshot_base64.map(|v| v.to_string()),
|
|
5597
5800
|
}
|
|
5598
5801
|
}
|
|
5599
5802
|
}
|
|
@@ -5613,7 +5816,7 @@ impl From<ActionResult> for crawlberg::ActionResult {
|
|
|
5613
5816
|
}
|
|
5614
5817
|
}
|
|
5615
5818
|
|
|
5616
|
-
#[allow(clippy::redundant_closure
|
|
5819
|
+
#[allow(clippy::redundant_closure)]
|
|
5617
5820
|
impl From<crawlberg::ActionResult> for ActionResult {
|
|
5618
5821
|
fn from(val: crawlberg::ActionResult) -> Self {
|
|
5619
5822
|
Self {
|
|
@@ -5657,6 +5860,7 @@ impl From<ScrapeResult> for crawlberg::ScrapeResult {
|
|
|
5657
5860
|
markdown: val.markdown.map(Into::into),
|
|
5658
5861
|
extracted_data: val.extracted_data.as_ref().and_then(|s| serde_json::from_str(s).ok()),
|
|
5659
5862
|
extraction_meta: val.extraction_meta.map(Into::into),
|
|
5863
|
+
screenshot_base64: val.screenshot_base64,
|
|
5660
5864
|
downloaded_document: val.downloaded_document.map(Into::into),
|
|
5661
5865
|
browser: val.browser.map(Into::into),
|
|
5662
5866
|
..Default::default()
|
|
@@ -5694,6 +5898,7 @@ impl From<crawlberg::ScrapeResult> for ScrapeResult {
|
|
|
5694
5898
|
markdown: val.markdown.map(Into::into),
|
|
5695
5899
|
extracted_data: val.extracted_data.as_ref().map(ToString::to_string),
|
|
5696
5900
|
extraction_meta: val.extraction_meta.map(Into::into),
|
|
5901
|
+
screenshot_base64: val.screenshot_base64.map(|v| v.to_string()),
|
|
5697
5902
|
downloaded_document: val.downloaded_document.map(Into::into),
|
|
5698
5903
|
browser: val.browser.map(Into::into),
|
|
5699
5904
|
}
|
|
@@ -5761,7 +5966,7 @@ impl From<crawlberg::CrawlPageResult> for CrawlPageResult {
|
|
|
5761
5966
|
}
|
|
5762
5967
|
|
|
5763
5968
|
#[allow(clippy::needless_update)]
|
|
5764
|
-
#[allow(clippy::
|
|
5969
|
+
#[allow(clippy::useless_conversion)]
|
|
5765
5970
|
impl From<CrawlResult> for crawlberg::CrawlResult {
|
|
5766
5971
|
fn from(val: CrawlResult) -> Self {
|
|
5767
5972
|
Self {
|
|
@@ -5795,7 +6000,6 @@ impl From<crawlberg::CrawlResult> for CrawlResult {
|
|
|
5795
6000
|
}
|
|
5796
6001
|
|
|
5797
6002
|
#[allow(clippy::needless_update)]
|
|
5798
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
5799
6003
|
impl From<SitemapUrl> for crawlberg::SitemapUrl {
|
|
5800
6004
|
fn from(val: SitemapUrl) -> Self {
|
|
5801
6005
|
Self {
|
|
@@ -5808,7 +6012,7 @@ impl From<SitemapUrl> for crawlberg::SitemapUrl {
|
|
|
5808
6012
|
}
|
|
5809
6013
|
}
|
|
5810
6014
|
|
|
5811
|
-
#[allow(clippy::redundant_closure
|
|
6015
|
+
#[allow(clippy::redundant_closure)]
|
|
5812
6016
|
impl From<crawlberg::SitemapUrl> for SitemapUrl {
|
|
5813
6017
|
fn from(val: crawlberg::SitemapUrl) -> Self {
|
|
5814
6018
|
Self {
|
|
@@ -5821,7 +6025,7 @@ impl From<crawlberg::SitemapUrl> for SitemapUrl {
|
|
|
5821
6025
|
}
|
|
5822
6026
|
|
|
5823
6027
|
#[allow(clippy::needless_update)]
|
|
5824
|
-
#[allow(clippy::
|
|
6028
|
+
#[allow(clippy::useless_conversion)]
|
|
5825
6029
|
impl From<MapResult> for crawlberg::MapResult {
|
|
5826
6030
|
fn from(val: MapResult) -> Self {
|
|
5827
6031
|
Self {
|
|
@@ -5831,7 +6035,7 @@ impl From<MapResult> for crawlberg::MapResult {
|
|
|
5831
6035
|
}
|
|
5832
6036
|
}
|
|
5833
6037
|
|
|
5834
|
-
#[allow(clippy::
|
|
6038
|
+
#[allow(clippy::useless_conversion)]
|
|
5835
6039
|
impl From<crawlberg::MapResult> for MapResult {
|
|
5836
6040
|
fn from(val: crawlberg::MapResult) -> Self {
|
|
5837
6041
|
Self {
|
|
@@ -5841,7 +6045,7 @@ impl From<crawlberg::MapResult> for MapResult {
|
|
|
5841
6045
|
}
|
|
5842
6046
|
|
|
5843
6047
|
#[allow(clippy::needless_update)]
|
|
5844
|
-
#[allow(clippy::redundant_closure
|
|
6048
|
+
#[allow(clippy::redundant_closure)]
|
|
5845
6049
|
impl From<MarkdownResult> for crawlberg::MarkdownResult {
|
|
5846
6050
|
fn from(val: MarkdownResult) -> Self {
|
|
5847
6051
|
Self {
|
|
@@ -5863,7 +6067,7 @@ impl From<MarkdownResult> for crawlberg::MarkdownResult {
|
|
|
5863
6067
|
}
|
|
5864
6068
|
}
|
|
5865
6069
|
|
|
5866
|
-
#[allow(clippy::redundant_closure
|
|
6070
|
+
#[allow(clippy::redundant_closure)]
|
|
5867
6071
|
impl From<crawlberg::MarkdownResult> for MarkdownResult {
|
|
5868
6072
|
fn from(val: crawlberg::MarkdownResult) -> Self {
|
|
5869
6073
|
Self {
|
|
@@ -5878,7 +6082,7 @@ impl From<crawlberg::MarkdownResult> for MarkdownResult {
|
|
|
5878
6082
|
}
|
|
5879
6083
|
|
|
5880
6084
|
#[allow(clippy::needless_update)]
|
|
5881
|
-
#[allow(clippy::
|
|
6085
|
+
#[allow(clippy::useless_conversion)]
|
|
5882
6086
|
impl From<LinkInfo> for crawlberg::LinkInfo {
|
|
5883
6087
|
fn from(val: LinkInfo) -> Self {
|
|
5884
6088
|
Self {
|
|
@@ -5906,7 +6110,7 @@ impl From<crawlberg::LinkInfo> for LinkInfo {
|
|
|
5906
6110
|
}
|
|
5907
6111
|
|
|
5908
6112
|
#[allow(clippy::needless_update)]
|
|
5909
|
-
#[allow(clippy::
|
|
6113
|
+
#[allow(clippy::useless_conversion)]
|
|
5910
6114
|
impl From<ImageInfo> for crawlberg::ImageInfo {
|
|
5911
6115
|
fn from(val: ImageInfo) -> Self {
|
|
5912
6116
|
Self {
|
|
@@ -5934,7 +6138,7 @@ impl From<crawlberg::ImageInfo> for ImageInfo {
|
|
|
5934
6138
|
}
|
|
5935
6139
|
|
|
5936
6140
|
#[allow(clippy::needless_update)]
|
|
5937
|
-
#[allow(clippy::
|
|
6141
|
+
#[allow(clippy::useless_conversion)]
|
|
5938
6142
|
impl From<FeedInfo> for crawlberg::FeedInfo {
|
|
5939
6143
|
fn from(val: FeedInfo) -> Self {
|
|
5940
6144
|
Self {
|
|
@@ -5958,7 +6162,6 @@ impl From<crawlberg::FeedInfo> for FeedInfo {
|
|
|
5958
6162
|
}
|
|
5959
6163
|
|
|
5960
6164
|
#[allow(clippy::needless_update)]
|
|
5961
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
5962
6165
|
impl From<JsonLdEntry> for crawlberg::JsonLdEntry {
|
|
5963
6166
|
fn from(val: JsonLdEntry) -> Self {
|
|
5964
6167
|
Self {
|
|
@@ -5970,7 +6173,7 @@ impl From<JsonLdEntry> for crawlberg::JsonLdEntry {
|
|
|
5970
6173
|
}
|
|
5971
6174
|
}
|
|
5972
6175
|
|
|
5973
|
-
#[allow(clippy::redundant_closure
|
|
6176
|
+
#[allow(clippy::redundant_closure)]
|
|
5974
6177
|
impl From<crawlberg::JsonLdEntry> for JsonLdEntry {
|
|
5975
6178
|
fn from(val: crawlberg::JsonLdEntry) -> Self {
|
|
5976
6179
|
Self {
|
|
@@ -5982,7 +6185,6 @@ impl From<crawlberg::JsonLdEntry> for JsonLdEntry {
|
|
|
5982
6185
|
}
|
|
5983
6186
|
|
|
5984
6187
|
#[allow(clippy::needless_update)]
|
|
5985
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
5986
6188
|
impl From<CookieInfo> for crawlberg::CookieInfo {
|
|
5987
6189
|
fn from(val: CookieInfo) -> Self {
|
|
5988
6190
|
Self {
|
|
@@ -5995,7 +6197,7 @@ impl From<CookieInfo> for crawlberg::CookieInfo {
|
|
|
5995
6197
|
}
|
|
5996
6198
|
}
|
|
5997
6199
|
|
|
5998
|
-
#[allow(clippy::redundant_closure
|
|
6200
|
+
#[allow(clippy::redundant_closure)]
|
|
5999
6201
|
impl From<crawlberg::CookieInfo> for CookieInfo {
|
|
6000
6202
|
fn from(val: crawlberg::CookieInfo) -> Self {
|
|
6001
6203
|
Self {
|
|
@@ -6008,7 +6210,7 @@ impl From<crawlberg::CookieInfo> for CookieInfo {
|
|
|
6008
6210
|
}
|
|
6009
6211
|
|
|
6010
6212
|
#[allow(clippy::needless_update)]
|
|
6011
|
-
#[allow(clippy::
|
|
6213
|
+
#[allow(clippy::useless_conversion)]
|
|
6012
6214
|
impl From<DownloadedAsset> for crawlberg::DownloadedAsset {
|
|
6013
6215
|
fn from(val: DownloadedAsset) -> Self {
|
|
6014
6216
|
Self {
|
|
@@ -6038,7 +6240,6 @@ impl From<crawlberg::DownloadedAsset> for DownloadedAsset {
|
|
|
6038
6240
|
}
|
|
6039
6241
|
|
|
6040
6242
|
#[allow(clippy::needless_update)]
|
|
6041
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
6042
6243
|
impl From<ArticleMetadata> for crawlberg::ArticleMetadata {
|
|
6043
6244
|
fn from(val: ArticleMetadata) -> Self {
|
|
6044
6245
|
Self {
|
|
@@ -6052,7 +6253,7 @@ impl From<ArticleMetadata> for crawlberg::ArticleMetadata {
|
|
|
6052
6253
|
}
|
|
6053
6254
|
}
|
|
6054
6255
|
|
|
6055
|
-
#[allow(clippy::redundant_closure
|
|
6256
|
+
#[allow(clippy::redundant_closure)]
|
|
6056
6257
|
impl From<crawlberg::ArticleMetadata> for ArticleMetadata {
|
|
6057
6258
|
fn from(val: crawlberg::ArticleMetadata) -> Self {
|
|
6058
6259
|
Self {
|
|
@@ -6066,7 +6267,6 @@ impl From<crawlberg::ArticleMetadata> for ArticleMetadata {
|
|
|
6066
6267
|
}
|
|
6067
6268
|
|
|
6068
6269
|
#[allow(clippy::needless_update)]
|
|
6069
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
6070
6270
|
impl From<HreflangEntry> for crawlberg::HreflangEntry {
|
|
6071
6271
|
fn from(val: HreflangEntry) -> Self {
|
|
6072
6272
|
Self {
|
|
@@ -6077,7 +6277,6 @@ impl From<HreflangEntry> for crawlberg::HreflangEntry {
|
|
|
6077
6277
|
}
|
|
6078
6278
|
}
|
|
6079
6279
|
|
|
6080
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
6081
6280
|
impl From<crawlberg::HreflangEntry> for HreflangEntry {
|
|
6082
6281
|
fn from(val: crawlberg::HreflangEntry) -> Self {
|
|
6083
6282
|
Self {
|
|
@@ -6088,7 +6287,6 @@ impl From<crawlberg::HreflangEntry> for HreflangEntry {
|
|
|
6088
6287
|
}
|
|
6089
6288
|
|
|
6090
6289
|
#[allow(clippy::needless_update)]
|
|
6091
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
6092
6290
|
impl From<FaviconInfo> for crawlberg::FaviconInfo {
|
|
6093
6291
|
fn from(val: FaviconInfo) -> Self {
|
|
6094
6292
|
Self {
|
|
@@ -6101,7 +6299,7 @@ impl From<FaviconInfo> for crawlberg::FaviconInfo {
|
|
|
6101
6299
|
}
|
|
6102
6300
|
}
|
|
6103
6301
|
|
|
6104
|
-
#[allow(clippy::redundant_closure
|
|
6302
|
+
#[allow(clippy::redundant_closure)]
|
|
6105
6303
|
impl From<crawlberg::FaviconInfo> for FaviconInfo {
|
|
6106
6304
|
fn from(val: crawlberg::FaviconInfo) -> Self {
|
|
6107
6305
|
Self {
|
|
@@ -6114,7 +6312,6 @@ impl From<crawlberg::FaviconInfo> for FaviconInfo {
|
|
|
6114
6312
|
}
|
|
6115
6313
|
|
|
6116
6314
|
#[allow(clippy::needless_update)]
|
|
6117
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
6118
6315
|
impl From<HeadingInfo> for crawlberg::HeadingInfo {
|
|
6119
6316
|
fn from(val: HeadingInfo) -> Self {
|
|
6120
6317
|
Self {
|
|
@@ -6125,7 +6322,6 @@ impl From<HeadingInfo> for crawlberg::HeadingInfo {
|
|
|
6125
6322
|
}
|
|
6126
6323
|
}
|
|
6127
6324
|
|
|
6128
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
6129
6325
|
impl From<crawlberg::HeadingInfo> for HeadingInfo {
|
|
6130
6326
|
fn from(val: crawlberg::HeadingInfo) -> Self {
|
|
6131
6327
|
Self {
|
|
@@ -6136,7 +6332,6 @@ impl From<crawlberg::HeadingInfo> for HeadingInfo {
|
|
|
6136
6332
|
}
|
|
6137
6333
|
|
|
6138
6334
|
#[allow(clippy::needless_update)]
|
|
6139
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
6140
6335
|
impl From<ResponseMeta> for crawlberg::ResponseMeta {
|
|
6141
6336
|
fn from(val: ResponseMeta) -> Self {
|
|
6142
6337
|
Self {
|
|
@@ -6152,7 +6347,7 @@ impl From<ResponseMeta> for crawlberg::ResponseMeta {
|
|
|
6152
6347
|
}
|
|
6153
6348
|
}
|
|
6154
6349
|
|
|
6155
|
-
#[allow(clippy::redundant_closure
|
|
6350
|
+
#[allow(clippy::redundant_closure)]
|
|
6156
6351
|
impl From<crawlberg::ResponseMeta> for ResponseMeta {
|
|
6157
6352
|
fn from(val: crawlberg::ResponseMeta) -> Self {
|
|
6158
6353
|
Self {
|
|
@@ -6272,7 +6467,6 @@ impl From<crawlberg::PageMetadata> for PageMetadata {
|
|
|
6272
6467
|
}
|
|
6273
6468
|
|
|
6274
6469
|
#[allow(clippy::needless_update)]
|
|
6275
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
6276
6470
|
impl From<CrawlStreamRequest> for crawlberg::CrawlStreamRequest {
|
|
6277
6471
|
fn from(val: CrawlStreamRequest) -> Self {
|
|
6278
6472
|
Self {
|
|
@@ -6282,7 +6476,6 @@ impl From<CrawlStreamRequest> for crawlberg::CrawlStreamRequest {
|
|
|
6282
6476
|
}
|
|
6283
6477
|
}
|
|
6284
6478
|
|
|
6285
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
6286
6479
|
impl From<crawlberg::CrawlStreamRequest> for CrawlStreamRequest {
|
|
6287
6480
|
fn from(val: crawlberg::CrawlStreamRequest) -> Self {
|
|
6288
6481
|
Self {
|
|
@@ -6292,7 +6485,6 @@ impl From<crawlberg::CrawlStreamRequest> for CrawlStreamRequest {
|
|
|
6292
6485
|
}
|
|
6293
6486
|
|
|
6294
6487
|
#[allow(clippy::needless_update)]
|
|
6295
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
6296
6488
|
impl From<BatchCrawlStreamRequest> for crawlberg::BatchCrawlStreamRequest {
|
|
6297
6489
|
fn from(val: BatchCrawlStreamRequest) -> Self {
|
|
6298
6490
|
Self {
|
|
@@ -6302,7 +6494,6 @@ impl From<BatchCrawlStreamRequest> for crawlberg::BatchCrawlStreamRequest {
|
|
|
6302
6494
|
}
|
|
6303
6495
|
}
|
|
6304
6496
|
|
|
6305
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
6306
6497
|
impl From<crawlberg::BatchCrawlStreamRequest> for BatchCrawlStreamRequest {
|
|
6307
6498
|
fn from(val: crawlberg::BatchCrawlStreamRequest) -> Self {
|
|
6308
6499
|
Self {
|
|
@@ -6312,7 +6503,7 @@ impl From<crawlberg::BatchCrawlStreamRequest> for BatchCrawlStreamRequest {
|
|
|
6312
6503
|
}
|
|
6313
6504
|
|
|
6314
6505
|
#[allow(clippy::needless_update)]
|
|
6315
|
-
#[allow(clippy::
|
|
6506
|
+
#[allow(clippy::useless_conversion)]
|
|
6316
6507
|
impl From<CitationResult> for crawlberg::CitationResult {
|
|
6317
6508
|
fn from(val: CitationResult) -> Self {
|
|
6318
6509
|
Self {
|
|
@@ -6323,7 +6514,7 @@ impl From<CitationResult> for crawlberg::CitationResult {
|
|
|
6323
6514
|
}
|
|
6324
6515
|
}
|
|
6325
6516
|
|
|
6326
|
-
#[allow(clippy::
|
|
6517
|
+
#[allow(clippy::useless_conversion)]
|
|
6327
6518
|
impl From<crawlberg::CitationResult> for CitationResult {
|
|
6328
6519
|
fn from(val: crawlberg::CitationResult) -> Self {
|
|
6329
6520
|
Self {
|
|
@@ -6334,7 +6525,6 @@ impl From<crawlberg::CitationResult> for CitationResult {
|
|
|
6334
6525
|
}
|
|
6335
6526
|
|
|
6336
6527
|
#[allow(clippy::needless_update)]
|
|
6337
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
6338
6528
|
impl From<CitationReference> for crawlberg::CitationReference {
|
|
6339
6529
|
fn from(val: CitationReference) -> Self {
|
|
6340
6530
|
Self {
|
|
@@ -6346,7 +6536,6 @@ impl From<CitationReference> for crawlberg::CitationReference {
|
|
|
6346
6536
|
}
|
|
6347
6537
|
}
|
|
6348
6538
|
|
|
6349
|
-
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
6350
6539
|
impl From<crawlberg::CitationReference> for CitationReference {
|
|
6351
6540
|
fn from(val: crawlberg::CitationReference) -> Self {
|
|
6352
6541
|
Self {
|
|
@@ -6358,7 +6547,7 @@ impl From<crawlberg::CitationReference> for CitationReference {
|
|
|
6358
6547
|
}
|
|
6359
6548
|
|
|
6360
6549
|
#[allow(clippy::needless_update)]
|
|
6361
|
-
#[allow(clippy::
|
|
6550
|
+
#[allow(clippy::useless_conversion)]
|
|
6362
6551
|
impl From<BatchScrapeResult> for crawlberg::BatchScrapeResult {
|
|
6363
6552
|
fn from(val: BatchScrapeResult) -> Self {
|
|
6364
6553
|
Self {
|
|
@@ -6382,7 +6571,7 @@ impl From<crawlberg::BatchScrapeResult> for BatchScrapeResult {
|
|
|
6382
6571
|
}
|
|
6383
6572
|
|
|
6384
6573
|
#[allow(clippy::needless_update)]
|
|
6385
|
-
#[allow(clippy::
|
|
6574
|
+
#[allow(clippy::useless_conversion)]
|
|
6386
6575
|
impl From<BatchCrawlResult> for crawlberg::BatchCrawlResult {
|
|
6387
6576
|
fn from(val: BatchCrawlResult) -> Self {
|
|
6388
6577
|
Self {
|
|
@@ -6406,7 +6595,7 @@ impl From<crawlberg::BatchCrawlResult> for BatchCrawlResult {
|
|
|
6406
6595
|
}
|
|
6407
6596
|
|
|
6408
6597
|
#[allow(clippy::needless_update)]
|
|
6409
|
-
#[allow(clippy::
|
|
6598
|
+
#[allow(clippy::useless_conversion)]
|
|
6410
6599
|
impl From<BatchScrapeResults> for crawlberg::BatchScrapeResults {
|
|
6411
6600
|
fn from(val: BatchScrapeResults) -> Self {
|
|
6412
6601
|
Self {
|
|
@@ -6419,7 +6608,7 @@ impl From<BatchScrapeResults> for crawlberg::BatchScrapeResults {
|
|
|
6419
6608
|
}
|
|
6420
6609
|
}
|
|
6421
6610
|
|
|
6422
|
-
#[allow(clippy::
|
|
6611
|
+
#[allow(clippy::useless_conversion)]
|
|
6423
6612
|
impl From<crawlberg::BatchScrapeResults> for BatchScrapeResults {
|
|
6424
6613
|
fn from(val: crawlberg::BatchScrapeResults) -> Self {
|
|
6425
6614
|
Self {
|
|
@@ -6432,7 +6621,7 @@ impl From<crawlberg::BatchScrapeResults> for BatchScrapeResults {
|
|
|
6432
6621
|
}
|
|
6433
6622
|
|
|
6434
6623
|
#[allow(clippy::needless_update)]
|
|
6435
|
-
#[allow(clippy::
|
|
6624
|
+
#[allow(clippy::useless_conversion)]
|
|
6436
6625
|
impl From<BatchCrawlResults> for crawlberg::BatchCrawlResults {
|
|
6437
6626
|
fn from(val: BatchCrawlResults) -> Self {
|
|
6438
6627
|
Self {
|
|
@@ -6445,7 +6634,7 @@ impl From<BatchCrawlResults> for crawlberg::BatchCrawlResults {
|
|
|
6445
6634
|
}
|
|
6446
6635
|
}
|
|
6447
6636
|
|
|
6448
|
-
#[allow(clippy::
|
|
6637
|
+
#[allow(clippy::useless_conversion)]
|
|
6449
6638
|
impl From<crawlberg::BatchCrawlResults> for BatchCrawlResults {
|
|
6450
6639
|
fn from(val: crawlberg::BatchCrawlResults) -> Self {
|
|
6451
6640
|
Self {
|
|
@@ -6458,22 +6647,24 @@ impl From<crawlberg::BatchCrawlResults> for BatchCrawlResults {
|
|
|
6458
6647
|
}
|
|
6459
6648
|
|
|
6460
6649
|
#[allow(clippy::needless_update)]
|
|
6461
|
-
#[allow(clippy::
|
|
6650
|
+
#[allow(clippy::useless_conversion)]
|
|
6462
6651
|
impl From<SsrfPolicy> for crawlberg::SsrfPolicy {
|
|
6463
6652
|
fn from(val: SsrfPolicy) -> Self {
|
|
6464
6653
|
Self {
|
|
6465
6654
|
deny_private: val.deny_private,
|
|
6655
|
+
allowlist: val.allowlist.into_iter().map(Into::into).collect(),
|
|
6466
6656
|
max_redirects: val.max_redirects,
|
|
6467
6657
|
..Default::default()
|
|
6468
6658
|
}
|
|
6469
6659
|
}
|
|
6470
6660
|
}
|
|
6471
6661
|
|
|
6472
|
-
#[allow(clippy::
|
|
6662
|
+
#[allow(clippy::useless_conversion)]
|
|
6473
6663
|
impl From<crawlberg::SsrfPolicy> for SsrfPolicy {
|
|
6474
6664
|
fn from(val: crawlberg::SsrfPolicy) -> Self {
|
|
6475
6665
|
Self {
|
|
6476
6666
|
deny_private: val.deny_private,
|
|
6667
|
+
allowlist: val.allowlist.into_iter().map(Into::into).collect(),
|
|
6477
6668
|
max_redirects: val.max_redirects,
|
|
6478
6669
|
}
|
|
6479
6670
|
}
|
|
@@ -6539,6 +6730,22 @@ impl From<crawlberg::BrowserBackend> for BrowserBackend {
|
|
|
6539
6730
|
}
|
|
6540
6731
|
}
|
|
6541
6732
|
|
|
6733
|
+
impl From<DocumentContentEncoding> for crawlberg::DocumentContentEncoding {
|
|
6734
|
+
fn from(val: DocumentContentEncoding) -> Self {
|
|
6735
|
+
match val {
|
|
6736
|
+
DocumentContentEncoding::Base64 => Self::Base64,
|
|
6737
|
+
}
|
|
6738
|
+
}
|
|
6739
|
+
}
|
|
6740
|
+
|
|
6741
|
+
impl From<crawlberg::DocumentContentEncoding> for DocumentContentEncoding {
|
|
6742
|
+
fn from(val: crawlberg::DocumentContentEncoding) -> Self {
|
|
6743
|
+
match val {
|
|
6744
|
+
crawlberg::DocumentContentEncoding::Base64 => Self::Base64,
|
|
6745
|
+
}
|
|
6746
|
+
}
|
|
6747
|
+
}
|
|
6748
|
+
|
|
6542
6749
|
impl From<AuthConfig> for crawlberg::AuthConfig {
|
|
6543
6750
|
fn from(val: AuthConfig) -> Self {
|
|
6544
6751
|
match val {
|
|
@@ -6768,6 +6975,32 @@ impl From<crawlberg::ScrollDirection> for ScrollDirection {
|
|
|
6768
6975
|
}
|
|
6769
6976
|
}
|
|
6770
6977
|
|
|
6978
|
+
impl From<HostMatcher> for crawlberg::HostMatcher {
|
|
6979
|
+
fn from(val: HostMatcher) -> Self {
|
|
6980
|
+
match val {
|
|
6981
|
+
HostMatcher::Exact { value } => Self::Exact { value: value },
|
|
6982
|
+
HostMatcher::Suffix { value } => Self::Suffix { value: value },
|
|
6983
|
+
HostMatcher::Cidr { value } => Self::Cidr { value: value },
|
|
6984
|
+
}
|
|
6985
|
+
}
|
|
6986
|
+
}
|
|
6987
|
+
|
|
6988
|
+
impl From<crawlberg::HostMatcher> for HostMatcher {
|
|
6989
|
+
fn from(val: crawlberg::HostMatcher) -> Self {
|
|
6990
|
+
match val {
|
|
6991
|
+
crawlberg::HostMatcher::Exact { value } => Self::Exact {
|
|
6992
|
+
value: value.to_string(),
|
|
6993
|
+
},
|
|
6994
|
+
crawlberg::HostMatcher::Suffix { value } => Self::Suffix {
|
|
6995
|
+
value: value.to_string(),
|
|
6996
|
+
},
|
|
6997
|
+
crawlberg::HostMatcher::Cidr { value } => Self::Cidr {
|
|
6998
|
+
value: value.to_string(),
|
|
6999
|
+
},
|
|
7000
|
+
}
|
|
7001
|
+
}
|
|
7002
|
+
}
|
|
7003
|
+
|
|
6771
7004
|
/// Convert a `crawlberg::CrawlError` error to a Magnus runtime error.
|
|
6772
7005
|
#[allow(dead_code)]
|
|
6773
7006
|
fn crawl_error_to_magnus_err(e: crawlberg::CrawlError) -> magnus::Error {
|
|
@@ -7049,6 +7282,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
7049
7282
|
|
|
7050
7283
|
class.define_method("max_pages", method!(CrawlConfig::max_pages, 0))?;
|
|
7051
7284
|
|
|
7285
|
+
class.define_method("max_links_per_page", method!(CrawlConfig::max_links_per_page, 0))?;
|
|
7286
|
+
|
|
7052
7287
|
class.define_method("max_concurrent", method!(CrawlConfig::max_concurrent, 0))?;
|
|
7053
7288
|
|
|
7054
7289
|
class.define_method("respect_robots_txt", method!(CrawlConfig::respect_robots_txt, 0))?;
|
|
@@ -7115,6 +7350,13 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
7115
7350
|
|
|
7116
7351
|
class.define_method("document_mime_types", method!(CrawlConfig::document_mime_types, 0))?;
|
|
7117
7352
|
|
|
7353
|
+
class.define_method("document_output_dir", method!(CrawlConfig::document_output_dir, 0))?;
|
|
7354
|
+
|
|
7355
|
+
class.define_method(
|
|
7356
|
+
"document_content_encoding",
|
|
7357
|
+
method!(CrawlConfig::document_content_encoding, 0),
|
|
7358
|
+
)?;
|
|
7359
|
+
|
|
7118
7360
|
class.define_method("warc_output", method!(CrawlConfig::warc_output, 0))?;
|
|
7119
7361
|
|
|
7120
7362
|
class.define_method("browser_profile", method!(CrawlConfig::browser_profile, 0))?;
|
|
@@ -7123,6 +7365,11 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
7123
7365
|
|
|
7124
7366
|
class.define_method("ssrf", method!(CrawlConfig::ssrf, 0))?;
|
|
7125
7367
|
|
|
7368
|
+
class.define_method(
|
|
7369
|
+
"ssrf_deny_private_explicit",
|
|
7370
|
+
method!(CrawlConfig::ssrf_deny_private_explicit, 0),
|
|
7371
|
+
)?;
|
|
7372
|
+
|
|
7126
7373
|
class.define_method("validate", method!(CrawlConfig::validate, 0))?;
|
|
7127
7374
|
|
|
7128
7375
|
let class = module.define_class("BrowserExtras", ruby.class_object())?;
|
|
@@ -7151,6 +7398,12 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
7151
7398
|
|
|
7152
7399
|
class.define_method("headers", method!(DownloadedDocument::headers, 0))?;
|
|
7153
7400
|
|
|
7401
|
+
class.define_method("truncated", method!(DownloadedDocument::truncated, 0))?;
|
|
7402
|
+
|
|
7403
|
+
class.define_method("content_path", method!(DownloadedDocument::content_path, 0))?;
|
|
7404
|
+
|
|
7405
|
+
class.define_method("content_base64", method!(DownloadedDocument::content_base64, 0))?;
|
|
7406
|
+
|
|
7154
7407
|
let class = module.define_class("InteractionResult", ruby.class_object())?;
|
|
7155
7408
|
|
|
7156
7409
|
class.define_singleton_method("new", function!(InteractionResult::new, -1))?;
|
|
@@ -7161,6 +7414,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
7161
7414
|
|
|
7162
7415
|
class.define_method("final_url", method!(InteractionResult::final_url, 0))?;
|
|
7163
7416
|
|
|
7417
|
+
class.define_method("screenshot_base64", method!(InteractionResult::screenshot_base64, 0))?;
|
|
7418
|
+
|
|
7164
7419
|
let class = module.define_class("ActionResult", ruby.class_object())?;
|
|
7165
7420
|
|
|
7166
7421
|
class.define_singleton_method("new", function!(ActionResult::new, -1))?;
|
|
@@ -7231,6 +7486,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
7231
7486
|
|
|
7232
7487
|
class.define_method("extraction_meta", method!(ScrapeResult::extraction_meta, 0))?;
|
|
7233
7488
|
|
|
7489
|
+
class.define_method("screenshot_base64", method!(ScrapeResult::screenshot_base64, 0))?;
|
|
7490
|
+
|
|
7234
7491
|
class.define_method("downloaded_document", method!(ScrapeResult::downloaded_document, 0))?;
|
|
7235
7492
|
|
|
7236
7493
|
class.define_method("browser", method!(ScrapeResult::browser, 0))?;
|
|
@@ -7655,6 +7912,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
7655
7912
|
|
|
7656
7913
|
class.define_method("deny_private", method!(SsrfPolicy::deny_private, 0))?;
|
|
7657
7914
|
|
|
7915
|
+
class.define_method("allowlist", method!(SsrfPolicy::allowlist, 0))?;
|
|
7916
|
+
|
|
7658
7917
|
class.define_method("max_redirects", method!(SsrfPolicy::max_redirects, 0))?;
|
|
7659
7918
|
|
|
7660
7919
|
let class = module.define_class("CrawlStreamIterator", ruby.class_object())?;
|