Skip to content

Commit 70096c2

Browse files
author
stlc-bot
committed
feat(crawl): add exclude URL regex to crawl and sitemap endpoints (#1982)
Stainless-Generated-From: 1d0af2f2628afa39c837cb2a1d8a5837e5f0d929
1 parent 4dcf7e5 commit 70096c2

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎pkg/cmd/web.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,11 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{
483483
Usage: "Remove matching elements after inclusions. Exclusions take precedence.",
484484
BodyPath: "excludeSelectors",
485485
},
486+
&requestflag.Flag[string]{
487+
Name: "exclude-url-regex",
488+
Usage: "RE2 regex pattern. URLs matching this pattern are never followed or scraped, even when they match urlRegex. The starting URL is always scraped.",
489+
BodyPath: "excludeUrlRegex",
490+
},
486491
&requestflag.Flag[bool]{
487492
Name: "follow-subdomains",
488493
Usage: "When true, follow links on subdomains of the starting URL's domain (e.g. docs.example.com when starting from example.com). www and apex are always treated as equivalent.",

‎pkg/cmd/web_test.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ func TestWebWebCrawlMd(t *testing.T) {
325325
"--url", "https://example.com",
326326
"--country", "de",
327327
"--exclude-selector", "[x]",
328+
"--exclude-url-regex", "/tag/|/author/",
328329
"--follow-subdomains=true",
329330
"--include-frames=true",
330331
"--include-images=true",
@@ -359,6 +360,7 @@ func TestWebWebCrawlMd(t *testing.T) {
359360
"--url", "https://example.com",
360361
"--country", "de",
361362
"--exclude-selector", "[x]",
363+
"--exclude-url-regex", "/tag/|/author/",
362364
"--follow-subdomains=true",
363365
"--include-frames=true",
364366
"--include-images=true",
@@ -392,6 +394,7 @@ func TestWebWebCrawlMd(t *testing.T) {
392394
"country: de\n" +
393395
"excludeSelectors:\n" +
394396
" - x\n" +
397+
"excludeUrlRegex: /tag/|/author/\n" +
395398
"followSubdomains: true\n" +
396399
"includeFrames: true\n" +
397400
"includeImages: true\n" +

0 commit comments

Comments
 (0)