Skip to content

Commit e9b3454

Browse files
feat(api): api update
1 parent d9b903c commit e9b3454

3 files changed

Lines changed: 31 additions & 2 deletions

File tree

‎.stats.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 25
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-4903d5902cec6a80f42b9adaa9cf0defa9805ff22d7ae96970d209a4f867e195.yml
3-
openapi_spec_hash: 1097891c23530dfe0155f23170daf973
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-00c5b8f1ebfe212bc8fb46204f5c05507630afa55b10f77e3a43c66d21edbb77.yml
3+
openapi_spec_hash: 8bf4489b9bce0e52a89480109ffc5257
44
config_hash: c7b0cdaba3b9797b77efd89e1754d803

‎pkg/cmd/web.go‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ var webScreenshot = requestflag.WithInnerFlags(cli.Command{
209209
Usage: "Capture a screenshot of a website.",
210210
Suggest: true,
211211
Flags: []cli.Flag{
212+
&requestflag.Flag[string]{
213+
Name: "country",
214+
Usage: "Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country.",
215+
QueryPath: "country",
216+
},
212217
&requestflag.Flag[string]{
213218
Name: "direct-url",
214219
Usage: "A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both.",
@@ -391,6 +396,11 @@ var webWebCrawlMd = requestflag.WithInnerFlags(cli.Command{
391396
Required: true,
392397
BodyPath: "url",
393398
},
399+
&requestflag.Flag[string]{
400+
Name: "country",
401+
Usage: "Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country.",
402+
BodyPath: "country",
403+
},
394404
&requestflag.Flag[[]string]{
395405
Name: "exclude-selector",
396406
Usage: `CSS selectors to remove before each crawled page is converted to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]".`,
@@ -515,6 +525,11 @@ var webWebScrapeHTML = requestflag.WithInnerFlags(cli.Command{
515525
Required: true,
516526
QueryPath: "url",
517527
},
528+
&requestflag.Flag[string]{
529+
Name: "country",
530+
Usage: "Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country.",
531+
QueryPath: "country",
532+
},
518533
&requestflag.Flag[[]string]{
519534
Name: "exclude-selector",
520535
Usage: `CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]".`,
@@ -663,6 +678,11 @@ var webWebScrapeMd = requestflag.WithInnerFlags(cli.Command{
663678
Required: true,
664679
QueryPath: "url",
665680
},
681+
&requestflag.Flag[string]{
682+
Name: "country",
683+
Usage: "Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country.",
684+
QueryPath: "country",
685+
},
666686
&requestflag.Flag[[]string]{
667687
Name: "exclude-selector",
668688
Usage: `CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]".`,

‎pkg/cmd/web_test.go‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ func TestWebScreenshot(t *testing.T) {
141141
t,
142142
"--api-key", "string",
143143
"web", "screenshot",
144+
"--country", "de",
144145
"--direct-url", "https://example.com",
145146
"--domain", "domain",
146147
"--full-screenshot", "true",
@@ -163,6 +164,7 @@ func TestWebScreenshot(t *testing.T) {
163164
t,
164165
"--api-key", "string",
165166
"web", "screenshot",
167+
"--country", "de",
166168
"--direct-url", "https://example.com",
167169
"--domain", "domain",
168170
"--full-screenshot", "true",
@@ -264,6 +266,7 @@ func TestWebWebCrawlMd(t *testing.T) {
264266
"--api-key", "string",
265267
"web", "web-crawl-md",
266268
"--url", "https://example.com",
269+
"--country", "de",
267270
"--exclude-selector", "string",
268271
"--follow-subdomains=true",
269272
"--include-frames=true",
@@ -293,6 +296,7 @@ func TestWebWebCrawlMd(t *testing.T) {
293296
"--api-key", "string",
294297
"web", "web-crawl-md",
295298
"--url", "https://example.com",
299+
"--country", "de",
296300
"--exclude-selector", "string",
297301
"--follow-subdomains=true",
298302
"--include-frames=true",
@@ -318,6 +322,7 @@ func TestWebWebCrawlMd(t *testing.T) {
318322
// Test piping YAML data over stdin
319323
pipeData := []byte("" +
320324
"url: https://example.com\n" +
325+
"country: de\n" +
321326
"excludeSelectors:\n" +
322327
" - string\n" +
323328
"followSubdomains: true\n" +
@@ -355,6 +360,7 @@ func TestWebWebScrapeHTML(t *testing.T) {
355360
"--api-key", "string",
356361
"web", "web-scrape-html",
357362
"--url", "https://example.com",
363+
"--country", "de",
358364
"--exclude-selector", "string",
359365
"--headers", "{foo: J!}",
360366
"--include-frames=true",
@@ -377,6 +383,7 @@ func TestWebWebScrapeHTML(t *testing.T) {
377383
"--api-key", "string",
378384
"web", "web-scrape-html",
379385
"--url", "https://example.com",
386+
"--country", "de",
380387
"--exclude-selector", "string",
381388
"--headers", "{foo: J!}",
382389
"--include-frames=true",
@@ -438,6 +445,7 @@ func TestWebWebScrapeMd(t *testing.T) {
438445
"--api-key", "string",
439446
"web", "web-scrape-md",
440447
"--url", "https://example.com",
448+
"--country", "de",
441449
"--exclude-selector", "string",
442450
"--headers", "{foo: J!}",
443451
"--include-frames=true",
@@ -463,6 +471,7 @@ func TestWebWebScrapeMd(t *testing.T) {
463471
"--api-key", "string",
464472
"web", "web-scrape-md",
465473
"--url", "https://example.com",
474+
"--country", "de",
466475
"--exclude-selector", "string",
467476
"--headers", "{foo: J!}",
468477
"--include-frames=true",

0 commit comments

Comments
 (0)