@search1api/client 0.4.0 → 0.6.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.
- package/README.md +46 -0
- package/dist/client.d.ts +7 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/generated.d.ts +360 -5
- package/dist/generated.d.ts.map +1 -1
- package/dist/index.cjs +33 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +33 -1
- package/dist/index.js.map +2 -2
- package/dist/types.d.ts +99 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -69,6 +69,28 @@ A completed request costs 5 credits. Ask is not available with pay-per-request
|
|
|
69
69
|
payments, and its default timeout is 45 seconds. Use `search` when you already
|
|
70
70
|
know which engine and keywords you want.
|
|
71
71
|
|
|
72
|
+
## Maps
|
|
73
|
+
|
|
74
|
+
`maps` searches Google Maps and returns one page of up to 20 places. Each place
|
|
75
|
+
has a name, place ID and Maps link, plus address, phone, website, rating,
|
|
76
|
+
review count, coordinates and opening hours when available:
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
const places = await client.maps('coffee shops', {
|
|
80
|
+
location: { latitude: 40.7455, longitude: -74.0083, zoom: 15 },
|
|
81
|
+
maxResults: 10,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
for (const place of places.results) {
|
|
85
|
+
console.log(place.name, place.rating, place.address);
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
A completed page costs 3 credits, including a confirmed empty page.
|
|
90
|
+
`maxResults` only trims the page and does not lower the price. Request `page`
|
|
91
|
+
2-6 with the same query and `location` for more places; each page is billed
|
|
92
|
+
separately. Maps is not available with pay-per-request payments.
|
|
93
|
+
|
|
72
94
|
## Deepcrawl
|
|
73
95
|
|
|
74
96
|
`deepcrawl` starts a task and waits for it to finish:
|
|
@@ -78,6 +100,30 @@ const result = await client.deepcrawl('https://example.com', { type: 'all' });
|
|
|
78
100
|
console.log(result.zipUrl);
|
|
79
101
|
```
|
|
80
102
|
|
|
103
|
+
`maxPages` (1-1000, default 1000) caps the crawl after the path rules.
|
|
104
|
+
`includePaths` and `excludePaths` take up to 20 rules each, matched against
|
|
105
|
+
the URL path: a rule without `*` is a path prefix (`/docs` matches `/docs/api`
|
|
106
|
+
but not `/docsearch`), a rule with `*` must match the whole path, and exclusion
|
|
107
|
+
wins. `format: 'json'` returns the pages in the completed status response
|
|
108
|
+
instead of a ZIP:
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
const result = await client.deepcrawl('https://hono.dev/docs/', {
|
|
112
|
+
maxPages: 20,
|
|
113
|
+
includePaths: ['/docs/'],
|
|
114
|
+
excludePaths: ['/docs/changelog'],
|
|
115
|
+
format: 'json',
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
for (const page of result.pages ?? []) {
|
|
119
|
+
console.log(page.url, page.title, page.content.length);
|
|
120
|
+
}
|
|
121
|
+
console.log(result.stats, result.failed);
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`pages` is omitted when the result is larger than 5 MB; download `resultUrl`
|
|
125
|
+
instead. A task costs 20 credits regardless of the page count.
|
|
126
|
+
|
|
81
127
|
Use `startDeepcrawl`, `getDeepcrawlStatus`, and `waitForDeepcrawl` when the
|
|
82
128
|
application needs to control task persistence or polling itself.
|
|
83
129
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AskResponse, BatchResponse, CrawlOptions, CrawlRequest, CrawlResponse, DeepcrawlAcceptedResponse, DeepcrawlOptions, DeepcrawlStatusResponse, ExtractOptions, ExtractResponse, FeedbackOptions, FeedbackResponse, HealthResponse, JsonValue, NewsOptions, NewsRequest, NewsResponse, RequestOptions, Search1APIOptions, SearchOptions, SearchRequest, SearchResponse, ScreenshotOptions, ScreenshotResponse, SitemapOptions, SitemapResponse, TimeRange, TrendingOptions, TrendingResponse, UsageResponse, WaitForDeepcrawlOptions } from './types.js';
|
|
1
|
+
import type { AskResponse, BatchResponse, CrawlOptions, CrawlRequest, CrawlResponse, DeepcrawlAcceptedResponse, DeepcrawlOptions, DeepcrawlStatusResponse, ExtractOptions, ExtractResponse, FeedbackOptions, FeedbackResponse, HealthResponse, JsonValue, MapsOptions, MapsResponse, NewsOptions, NewsRequest, NewsResponse, RequestOptions, Search1APIOptions, SearchOptions, SearchRequest, SearchResponse, ScreenshotOptions, ScreenshotResponse, SitemapOptions, SitemapResponse, TimeRange, TrendingOptions, TrendingResponse, UsageResponse, WaitForDeepcrawlOptions } from './types.js';
|
|
2
2
|
export declare class Search1API {
|
|
3
3
|
readonly apiKey: string;
|
|
4
4
|
readonly baseUrl: string;
|
|
@@ -18,6 +18,12 @@ export declare class Search1API {
|
|
|
18
18
|
* completed request; requires an API key or OAuth token.
|
|
19
19
|
*/
|
|
20
20
|
ask(query: string, requestOptions?: RequestOptions): Promise<AskResponse>;
|
|
21
|
+
/**
|
|
22
|
+
* Google Maps place search: one page of up to 20 businesses and places with
|
|
23
|
+
* addresses, ratings, coordinates and opening hours when available. 3
|
|
24
|
+
* credits per completed page; requires an API key or OAuth token.
|
|
25
|
+
*/
|
|
26
|
+
maps(query: string, options?: MapsOptions, requestOptions?: RequestOptions): Promise<MapsResponse>;
|
|
21
27
|
crawl(url: string, options?: CrawlOptions, requestOptions?: RequestOptions): Promise<CrawlResponse>;
|
|
22
28
|
crawlBatch(requests: CrawlRequest[], requestOptions?: RequestOptions): Promise<CrawlResponse[]>;
|
|
23
29
|
screenshot(url: string, options?: ScreenshotOptions, requestOptions?: RequestOptions): Promise<ScreenshotResponse>;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAEV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,yBAAyB,EACzB,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,uBAAuB,EACxB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"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"}
|
package/dist/generated.d.ts
CHANGED
|
@@ -3,6 +3,34 @@
|
|
|
3
3
|
* Do not make direct changes to the file.
|
|
4
4
|
*/
|
|
5
5
|
export interface paths {
|
|
6
|
+
"/maps": {
|
|
7
|
+
parameters: {
|
|
8
|
+
query?: never;
|
|
9
|
+
header?: never;
|
|
10
|
+
path?: never;
|
|
11
|
+
cookie?: never;
|
|
12
|
+
};
|
|
13
|
+
get?: never;
|
|
14
|
+
put?: never;
|
|
15
|
+
/**
|
|
16
|
+
* Search Google Maps for local businesses and places
|
|
17
|
+
* @description Discover businesses and places with names, place IDs and public Maps links, plus addresses, contact details, ratings, review counts, coordinates and opening hours when available. Optional result fields are omitted when unavailable. Use POST /search for webpages and POST /crawl to read a business website.
|
|
18
|
+
*
|
|
19
|
+
* Each request fetches one Google Maps page of up to 20 places. page is 1-based (1–6); page > 1 requires location coordinates. max_results only truncates that page and does not change the price or carry unused places into the next page. Send the same query, country, language and location with the next page number for another separately billed request. There is no automatic pagination, retry or filling from another engine. Results can change between requests; an empty or short page does not guarantee that no later results exist.
|
|
20
|
+
*
|
|
21
|
+
* The response contains searchParameters and results, following the single-request format of POST /search and POST /news. searchParameters includes the requested page and normalized defaults. Result positions preserve native page order with possible gaps, not a stable SEO rank. A short or empty results array does not assert a total count or a next page.
|
|
22
|
+
*
|
|
23
|
+
* A confirmed empty page is completed and charged. Technical failures return an error and release the credit reservation. GET /usage separately returns the remaining account balance.
|
|
24
|
+
*
|
|
25
|
+
* Account credits only; no batch requests or payment protocols. Unknown fields are rejected; validation failures return 422 with errors entries containing field, message and code. Normal account limits apply (200 requests per minute). Set your client timeout above 20 seconds. SDK and MCP methods are not included in this release. Costs 3 credits per request.
|
|
26
|
+
*/
|
|
27
|
+
post: operations["maps"];
|
|
28
|
+
delete?: never;
|
|
29
|
+
options?: never;
|
|
30
|
+
head?: never;
|
|
31
|
+
patch?: never;
|
|
32
|
+
trace?: never;
|
|
33
|
+
};
|
|
6
34
|
"/feedback": {
|
|
7
35
|
parameters: {
|
|
8
36
|
query?: never;
|
|
@@ -194,7 +222,7 @@ export interface paths {
|
|
|
194
222
|
put?: never;
|
|
195
223
|
/**
|
|
196
224
|
* Deep crawl a website across multiple pages
|
|
197
|
-
* @description Start an asynchronous crawl of an entire site and package the pages as documents. Use it for whole-site ingestion; a single page is POST /crawl. The call returns a task id immediately rather than the result — poll GET /deepcrawl/status/{taskId} until the task reports completion. Costs 20 credits per request.
|
|
225
|
+
* @description Start an asynchronous crawl of an entire site and package the pages as documents. Use it for whole-site ingestion; a single page is POST /crawl. Narrow the crawl with include_paths/exclude_paths and cap it with max_pages; a task costs the same regardless of page count. Set format to "json" to get the pages inline in the status response instead of a ZIP. The call returns a task id immediately rather than the result — poll GET /deepcrawl/status/{taskId} until the task reports completion. Costs 20 credits per request.
|
|
198
226
|
*/
|
|
199
227
|
post: operations["deepcrawl"];
|
|
200
228
|
delete?: never;
|
|
@@ -212,7 +240,7 @@ export interface paths {
|
|
|
212
240
|
};
|
|
213
241
|
/**
|
|
214
242
|
* Check deepcrawl task status
|
|
215
|
-
* @description Poll a deepcrawl task started by POST /deepcrawl. Returns the task's current state and, once it finishes,
|
|
243
|
+
* @description Poll a deepcrawl task started by POST /deepcrawl. Returns the task's current state and, once it finishes, page counts (stats), failed URLs, and the result: zipUrl for format=zip, or the pages inline plus resultUrl for format=json. Safe to call repeatedly. Free to call.
|
|
216
244
|
*/
|
|
217
245
|
get: operations["deepcrawlStatus"];
|
|
218
246
|
put?: never;
|
|
@@ -283,6 +311,10 @@ export interface components {
|
|
|
283
311
|
title?: string;
|
|
284
312
|
status?: number;
|
|
285
313
|
detail?: string;
|
|
314
|
+
/** @description `/crawl` and `/extract`: why the page could not be read, e.g. `NOT_FOUND`, `GONE`, `FORBIDDEN`, `AUTH_REQUIRED`, `BLOCKED`, `RATE_LIMITED`, `DNS_NOT_FOUND`, `TARGET_UNREACHABLE`, `TIMEOUT`, `QUALITY_CHECK`. */
|
|
315
|
+
failureCategory?: string;
|
|
316
|
+
/** @description `/crawl` and `/extract`: the HTTP status the target site itself returned, when it answered. */
|
|
317
|
+
upstreamStatus?: number;
|
|
286
318
|
} & {
|
|
287
319
|
[key: string]: unknown;
|
|
288
320
|
};
|
|
@@ -306,6 +338,81 @@ export interface components {
|
|
|
306
338
|
/** @enum {string} */
|
|
307
339
|
time_range?: "day" | "week" | "month" | "year" | "";
|
|
308
340
|
};
|
|
341
|
+
MapsResponse: {
|
|
342
|
+
searchParameters: {
|
|
343
|
+
/** @description Google Maps search phrase; leading and trailing whitespace is removed. */
|
|
344
|
+
query: string;
|
|
345
|
+
/**
|
|
346
|
+
* @description Two-letter country code, normalized to lowercase. Defaults to us.
|
|
347
|
+
* @default us
|
|
348
|
+
*/
|
|
349
|
+
country: string;
|
|
350
|
+
/**
|
|
351
|
+
* @description Result language, for example en, de or zh-CN. Defaults to en.
|
|
352
|
+
* @default en
|
|
353
|
+
*/
|
|
354
|
+
language: string;
|
|
355
|
+
/** @description Search origin coordinates and map zoom (default 14). Required for page > 1. Latitude must be -90 to 90, longitude -180 to 180, and zoom 3 to 30. Example: {"latitude":40.7455,"longitude":-74.0083,"zoom":15}. */
|
|
356
|
+
location?: {
|
|
357
|
+
latitude: number;
|
|
358
|
+
longitude: number;
|
|
359
|
+
/** @default 14 */
|
|
360
|
+
zoom: number;
|
|
361
|
+
};
|
|
362
|
+
/**
|
|
363
|
+
* @description Page number, 1–6; default 1. Accepts an integer or canonical integer string such as "2". Empty strings use the default. Pages after the first require location.
|
|
364
|
+
* @default 1
|
|
365
|
+
*/
|
|
366
|
+
page: number;
|
|
367
|
+
/**
|
|
368
|
+
* @description Maximum places to return from this page, 1–20; default 20. Accepts an integer or canonical integer string such as "10". Empty strings use the default. Truncation does not reduce the page charge or carry places to the next page.
|
|
369
|
+
* @default 20
|
|
370
|
+
*/
|
|
371
|
+
max_results: number;
|
|
372
|
+
};
|
|
373
|
+
results: {
|
|
374
|
+
/** @description Position in the requested native page, offset by earlier page capacities. Gaps can remain after filtering or deduplication; this is not a stable SEO rank. */
|
|
375
|
+
position: number;
|
|
376
|
+
/** @description Business or place name. */
|
|
377
|
+
name: string;
|
|
378
|
+
/** @description Google Maps place identifier, also used to deduplicate this page. */
|
|
379
|
+
place_id: string;
|
|
380
|
+
/**
|
|
381
|
+
* Format: uri
|
|
382
|
+
* @description Public Google Maps link for this place.
|
|
383
|
+
*/
|
|
384
|
+
maps_url: string;
|
|
385
|
+
address?: string;
|
|
386
|
+
phone?: string;
|
|
387
|
+
/** Format: uri */
|
|
388
|
+
website?: string;
|
|
389
|
+
/** Format: uri */
|
|
390
|
+
thumbnail?: string;
|
|
391
|
+
category?: string;
|
|
392
|
+
categories?: string[];
|
|
393
|
+
rating?: number;
|
|
394
|
+
review_count?: number;
|
|
395
|
+
coordinates?: {
|
|
396
|
+
latitude: number;
|
|
397
|
+
longitude: number;
|
|
398
|
+
};
|
|
399
|
+
/** @description Opening hours by weekday, as displayed by the source; omitted when unavailable. */
|
|
400
|
+
opening_hours?: {
|
|
401
|
+
monday?: string;
|
|
402
|
+
tuesday?: string;
|
|
403
|
+
wednesday?: string;
|
|
404
|
+
thursday?: string;
|
|
405
|
+
friday?: string;
|
|
406
|
+
saturday?: string;
|
|
407
|
+
sunday?: string;
|
|
408
|
+
};
|
|
409
|
+
/** @description Source display text for the current opening state, not a normalized boolean. */
|
|
410
|
+
open_state?: string;
|
|
411
|
+
/** @description Source display text for the business price range, not a numeric amount or normalized currency. */
|
|
412
|
+
price?: string;
|
|
413
|
+
description?: string;
|
|
414
|
+
}[];
|
|
415
|
+
};
|
|
309
416
|
NewsParameters: {
|
|
310
417
|
query: string;
|
|
311
418
|
/** @enum {string} */
|
|
@@ -353,6 +460,17 @@ export interface components {
|
|
|
353
460
|
url: string;
|
|
354
461
|
/** @enum {string} */
|
|
355
462
|
type?: "sitemap" | "all";
|
|
463
|
+
/** @description Maximum number of pages to crawl, 1–1000; default 1000. Applied after include_paths/exclude_paths, in discovery order. */
|
|
464
|
+
max_pages?: number;
|
|
465
|
+
/** @description Only crawl URLs whose path matches one of these rules (up to 20). A rule without * is a path prefix on segment boundaries: "/docs" matches /docs and /docs/api but not /docsearch. A rule with * must match the whole path, and * matches any characters including /, e.g. "/blog/*". Empty or omitted means every discovered URL. */
|
|
466
|
+
include_paths?: string[];
|
|
467
|
+
/** @description Skip URLs whose path matches one of these rules (up to 20), using the same syntax as include_paths. Exclusion wins over inclusion. */
|
|
468
|
+
exclude_paths?: string[];
|
|
469
|
+
/**
|
|
470
|
+
* @description Result format; default "zip". "zip" packages the pages as Markdown files behind zipUrl. "json" returns pages: [{url, title, content}] in the completed status response, plus resultUrl for the same JSON file.
|
|
471
|
+
* @enum {string}
|
|
472
|
+
*/
|
|
473
|
+
format?: "zip" | "json";
|
|
356
474
|
};
|
|
357
475
|
SearchResult: {
|
|
358
476
|
title: string;
|
|
@@ -369,7 +487,7 @@ export interface components {
|
|
|
369
487
|
} & {
|
|
370
488
|
[key: string]: unknown;
|
|
371
489
|
};
|
|
372
|
-
/** @description Optional engine-specific fields. Omitted when none apply. GitHub fields appear on POST /search; Hacker News fields appear on POST /news. */
|
|
490
|
+
/** @description Optional engine-specific fields. Omitted when none apply. GitHub, Reddit and X fields appear on POST /search; Hacker News fields appear on POST /news. */
|
|
373
491
|
SearchResultMetadata: {
|
|
374
492
|
/**
|
|
375
493
|
* @description What a `github` result is: a repository, an issue, a pull request, or a discussion. Only present for `search_service: "github"`.
|
|
@@ -378,9 +496,9 @@ export interface components {
|
|
|
378
496
|
kind?: "repo" | "issue" | "pr" | "discussion";
|
|
379
497
|
/** @description Stargazer count of a `github` repository result (`metadata.kind: "repo"`). */
|
|
380
498
|
stars?: number;
|
|
381
|
-
/** @description Primary language of a `github` repository result (`metadata.kind: "repo"`). Omitted when
|
|
499
|
+
/** @description Primary language of a `github` repository result (`metadata.kind: "repo"`), or the language code X detected for an `x` post. Omitted when none is reported. */
|
|
382
500
|
language?: string;
|
|
383
|
-
/** @description Comment count on a `github` issue, pull request or discussion, or on a `hackernews` thread (POST /news). */
|
|
501
|
+
/** @description Comment count on a `github` issue, pull request or discussion, on a `reddit` post, on an `x` post (replies), or on a `hackernews` thread (POST /news). */
|
|
384
502
|
num_comments?: number;
|
|
385
503
|
/**
|
|
386
504
|
* Format: uri
|
|
@@ -389,6 +507,56 @@ export interface components {
|
|
|
389
507
|
story_url?: string;
|
|
390
508
|
/** @description POST /news with `search_service: "hackernews"` only: upvotes on the thread. */
|
|
391
509
|
points?: number;
|
|
510
|
+
/** @description `search_service: "x"` only: the post id. */
|
|
511
|
+
post_id?: string;
|
|
512
|
+
/** @description `x` only: handle of the account that posted, without the @. */
|
|
513
|
+
author_username?: string;
|
|
514
|
+
/** @description `x` only: display name of the account that posted. */
|
|
515
|
+
author_name?: string;
|
|
516
|
+
/** @description `x` only: numeric user id of the account that posted. */
|
|
517
|
+
author_id?: string;
|
|
518
|
+
/**
|
|
519
|
+
* Format: uri
|
|
520
|
+
* @description `x` only: avatar URL of the account that posted.
|
|
521
|
+
*/
|
|
522
|
+
author_image?: string;
|
|
523
|
+
/** @description `x` only: whether the account shows a verified checkmark. */
|
|
524
|
+
author_verified?: boolean;
|
|
525
|
+
/** @description `x` only: follower count of the account that posted. */
|
|
526
|
+
author_followers?: number;
|
|
527
|
+
/** @description `x` only: likes on the post. */
|
|
528
|
+
like_count?: number;
|
|
529
|
+
/** @description `x` only: reposts of the post. */
|
|
530
|
+
repost_count?: number;
|
|
531
|
+
/** @description `x` only: quotes of the post. */
|
|
532
|
+
quote_count?: number;
|
|
533
|
+
/** @description `x` only: bookmarks of the post. */
|
|
534
|
+
bookmark_count?: number;
|
|
535
|
+
/** @description `x` only: views of the post. Omitted when X reports none, as for older posts. */
|
|
536
|
+
view_count?: number;
|
|
537
|
+
/** @description `x` only: whether the post replies to another post. */
|
|
538
|
+
is_reply?: boolean;
|
|
539
|
+
/** @description `x` only: id of the first post in the thread. */
|
|
540
|
+
conversation_id?: string;
|
|
541
|
+
/** @description `x` only: id of the post this one replies to. Omitted when it is not a reply. */
|
|
542
|
+
in_reply_to_id?: string;
|
|
543
|
+
/** @description `x` only: photos, videos and GIFs attached to the post. Empty when there are none. */
|
|
544
|
+
media?: {
|
|
545
|
+
/** @enum {string} */
|
|
546
|
+
type: "photo" | "video" | "gif";
|
|
547
|
+
/**
|
|
548
|
+
* Format: uri
|
|
549
|
+
* @description Image URL; for a video or GIF, its poster frame.
|
|
550
|
+
*/
|
|
551
|
+
url: string;
|
|
552
|
+
width?: number;
|
|
553
|
+
height?: number;
|
|
554
|
+
/**
|
|
555
|
+
* Format: uri
|
|
556
|
+
* @description Playable MP4 (highest bitrate) for a video or GIF.
|
|
557
|
+
*/
|
|
558
|
+
video_url?: string;
|
|
559
|
+
}[];
|
|
392
560
|
} & {
|
|
393
561
|
[key: string]: unknown;
|
|
394
562
|
};
|
|
@@ -529,6 +697,35 @@ export interface components {
|
|
|
529
697
|
r2Key?: string;
|
|
530
698
|
/** Format: uri */
|
|
531
699
|
zipUrl?: string | null;
|
|
700
|
+
/** @description Page counts for a finished task: discovered links, how many matched the path rules, how many max_pages left out, and how many pages were crawled or failed. */
|
|
701
|
+
stats?: {
|
|
702
|
+
discovered: number;
|
|
703
|
+
matched: number;
|
|
704
|
+
skipped: number;
|
|
705
|
+
crawled: number;
|
|
706
|
+
failed: number;
|
|
707
|
+
};
|
|
708
|
+
/** @enum {string} */
|
|
709
|
+
format?: "zip" | "json";
|
|
710
|
+
/** @description Pages that could not be crawled, with the reason. */
|
|
711
|
+
failed?: {
|
|
712
|
+
/** Format: uri */
|
|
713
|
+
url: string;
|
|
714
|
+
error: string;
|
|
715
|
+
}[];
|
|
716
|
+
/**
|
|
717
|
+
* Format: uri
|
|
718
|
+
* @description format=json only: the JSON result file, {"pages": [...], "failed": [...]}.
|
|
719
|
+
*/
|
|
720
|
+
resultUrl?: string | null;
|
|
721
|
+
/** @description format=json only: the crawled pages in discovery order. Omitted when the result is larger than 5 MB; download resultUrl instead. */
|
|
722
|
+
pages?: {
|
|
723
|
+
/** Format: uri */
|
|
724
|
+
url: string;
|
|
725
|
+
title: string | null;
|
|
726
|
+
/** @description Page body as Markdown. */
|
|
727
|
+
content: string;
|
|
728
|
+
}[];
|
|
532
729
|
} & {
|
|
533
730
|
[key: string]: unknown;
|
|
534
731
|
};
|
|
@@ -559,6 +756,135 @@ export interface components {
|
|
|
559
756
|
}
|
|
560
757
|
export type $defs = Record<string, never>;
|
|
561
758
|
export interface operations {
|
|
759
|
+
maps: {
|
|
760
|
+
parameters: {
|
|
761
|
+
query?: never;
|
|
762
|
+
header?: never;
|
|
763
|
+
path?: never;
|
|
764
|
+
cookie?: never;
|
|
765
|
+
};
|
|
766
|
+
requestBody: {
|
|
767
|
+
content: {
|
|
768
|
+
"application/json": {
|
|
769
|
+
/**
|
|
770
|
+
* @description Google Maps search phrase; leading and trailing whitespace is removed.
|
|
771
|
+
* @example coffee in Manhattan
|
|
772
|
+
*/
|
|
773
|
+
query: string;
|
|
774
|
+
/**
|
|
775
|
+
* @description Two-letter country code, normalized to lowercase. Defaults to us.
|
|
776
|
+
* @default us
|
|
777
|
+
*/
|
|
778
|
+
country?: string;
|
|
779
|
+
/**
|
|
780
|
+
* @description Result language, for example en, de or zh-CN. Defaults to en.
|
|
781
|
+
* @default en
|
|
782
|
+
*/
|
|
783
|
+
language?: string;
|
|
784
|
+
/** @description Search origin coordinates and map zoom (default 14). Required for page > 1. Latitude must be -90 to 90, longitude -180 to 180, and zoom 3 to 30. Example: {"latitude":40.7455,"longitude":-74.0083,"zoom":15}. */
|
|
785
|
+
location?: {
|
|
786
|
+
latitude: number;
|
|
787
|
+
longitude: number;
|
|
788
|
+
/** @default 14 */
|
|
789
|
+
zoom?: number;
|
|
790
|
+
};
|
|
791
|
+
/**
|
|
792
|
+
* @description Page number, 1–6; default 1. Accepts an integer or canonical integer string such as "2". Empty strings use the default. Pages after the first require location.
|
|
793
|
+
* @default 1
|
|
794
|
+
*/
|
|
795
|
+
page?: number;
|
|
796
|
+
/**
|
|
797
|
+
* @description Maximum places to return from this page, 1–20; default 20. Accepts an integer or canonical integer string such as "10". Empty strings use the default. Truncation does not reduce the page charge or carry places to the next page.
|
|
798
|
+
* @default 20
|
|
799
|
+
*/
|
|
800
|
+
max_results?: number;
|
|
801
|
+
};
|
|
802
|
+
};
|
|
803
|
+
};
|
|
804
|
+
responses: {
|
|
805
|
+
/** @description Successful response */
|
|
806
|
+
200: {
|
|
807
|
+
headers: {
|
|
808
|
+
[name: string]: unknown;
|
|
809
|
+
};
|
|
810
|
+
content: {
|
|
811
|
+
"application/json": components["schemas"]["MapsResponse"];
|
|
812
|
+
};
|
|
813
|
+
};
|
|
814
|
+
/** @description Bad Request */
|
|
815
|
+
400: {
|
|
816
|
+
headers: {
|
|
817
|
+
[name: string]: unknown;
|
|
818
|
+
};
|
|
819
|
+
content: {
|
|
820
|
+
"application/json": components["schemas"]["ApiError"];
|
|
821
|
+
};
|
|
822
|
+
};
|
|
823
|
+
/** @description Unauthorized */
|
|
824
|
+
401: {
|
|
825
|
+
headers: {
|
|
826
|
+
[name: string]: unknown;
|
|
827
|
+
};
|
|
828
|
+
content: {
|
|
829
|
+
"application/json": components["schemas"]["ApiError"];
|
|
830
|
+
};
|
|
831
|
+
};
|
|
832
|
+
/** @description Payment Required */
|
|
833
|
+
402: {
|
|
834
|
+
headers: {
|
|
835
|
+
[name: string]: unknown;
|
|
836
|
+
};
|
|
837
|
+
content: {
|
|
838
|
+
"application/problem+json": components["schemas"]["ApiError"];
|
|
839
|
+
};
|
|
840
|
+
};
|
|
841
|
+
/** @description Validation Error */
|
|
842
|
+
422: {
|
|
843
|
+
headers: {
|
|
844
|
+
[name: string]: unknown;
|
|
845
|
+
};
|
|
846
|
+
content: {
|
|
847
|
+
"application/json": components["schemas"]["ApiError"];
|
|
848
|
+
};
|
|
849
|
+
};
|
|
850
|
+
/** @description Too Many Requests */
|
|
851
|
+
429: {
|
|
852
|
+
headers: {
|
|
853
|
+
[name: string]: unknown;
|
|
854
|
+
};
|
|
855
|
+
content: {
|
|
856
|
+
"application/json": components["schemas"]["ApiError"];
|
|
857
|
+
};
|
|
858
|
+
};
|
|
859
|
+
/** @description Internal Server Error */
|
|
860
|
+
500: {
|
|
861
|
+
headers: {
|
|
862
|
+
[name: string]: unknown;
|
|
863
|
+
};
|
|
864
|
+
content: {
|
|
865
|
+
"application/json": components["schemas"]["ApiError"];
|
|
866
|
+
};
|
|
867
|
+
};
|
|
868
|
+
/** @description Bad Gateway */
|
|
869
|
+
502: {
|
|
870
|
+
headers: {
|
|
871
|
+
[name: string]: unknown;
|
|
872
|
+
};
|
|
873
|
+
content: {
|
|
874
|
+
"application/json": components["schemas"]["ApiError"];
|
|
875
|
+
};
|
|
876
|
+
};
|
|
877
|
+
/** @description Service Unavailable */
|
|
878
|
+
503: {
|
|
879
|
+
headers: {
|
|
880
|
+
[name: string]: unknown;
|
|
881
|
+
};
|
|
882
|
+
content: {
|
|
883
|
+
"application/json": components["schemas"]["ApiError"];
|
|
884
|
+
};
|
|
885
|
+
};
|
|
886
|
+
};
|
|
887
|
+
};
|
|
562
888
|
feedback: {
|
|
563
889
|
parameters: {
|
|
564
890
|
query?: never;
|
|
@@ -1513,6 +1839,24 @@ export interface operations {
|
|
|
1513
1839
|
"application/problem+json": components["schemas"]["ApiError"];
|
|
1514
1840
|
};
|
|
1515
1841
|
};
|
|
1842
|
+
/** @description Not Found */
|
|
1843
|
+
404: {
|
|
1844
|
+
headers: {
|
|
1845
|
+
[name: string]: unknown;
|
|
1846
|
+
};
|
|
1847
|
+
content: {
|
|
1848
|
+
"application/json": components["schemas"]["ApiError"];
|
|
1849
|
+
};
|
|
1850
|
+
};
|
|
1851
|
+
/** @description Gone */
|
|
1852
|
+
410: {
|
|
1853
|
+
headers: {
|
|
1854
|
+
[name: string]: unknown;
|
|
1855
|
+
};
|
|
1856
|
+
content: {
|
|
1857
|
+
"application/json": components["schemas"]["ApiError"];
|
|
1858
|
+
};
|
|
1859
|
+
};
|
|
1516
1860
|
/** @description Validation Error */
|
|
1517
1861
|
422: {
|
|
1518
1862
|
headers: {
|
|
@@ -1565,6 +1909,17 @@ export interface operations {
|
|
|
1565
1909
|
url: string;
|
|
1566
1910
|
/** @enum {string} */
|
|
1567
1911
|
type?: "sitemap" | "all";
|
|
1912
|
+
/** @description Maximum number of pages to crawl, 1–1000; default 1000. Applied after include_paths/exclude_paths, in discovery order. */
|
|
1913
|
+
max_pages?: number;
|
|
1914
|
+
/** @description Only crawl URLs whose path matches one of these rules (up to 20). A rule without * is a path prefix on segment boundaries: "/docs" matches /docs and /docs/api but not /docsearch. A rule with * must match the whole path, and * matches any characters including /, e.g. "/blog/*". Empty or omitted means every discovered URL. */
|
|
1915
|
+
include_paths?: string[];
|
|
1916
|
+
/** @description Skip URLs whose path matches one of these rules (up to 20), using the same syntax as include_paths. Exclusion wins over inclusion. */
|
|
1917
|
+
exclude_paths?: string[];
|
|
1918
|
+
/**
|
|
1919
|
+
* @description Result format; default "zip". "zip" packages the pages as Markdown files behind zipUrl. "json" returns pages: [{url, title, content}] in the completed status response, plus resultUrl for the same JSON file.
|
|
1920
|
+
* @enum {string}
|
|
1921
|
+
*/
|
|
1922
|
+
format?: "zip" | "json";
|
|
1568
1923
|
};
|
|
1569
1924
|
};
|
|
1570
1925
|
};
|