Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.3.0 - 2026-11-05

Adds `s1 deepcrawl <url>` and `deepcrawl()` / `deepcrawlStatus()` SDK helpers for `POST /deepcrawl` and `GET /deepcrawl/status/{taskId}`: crawl a whole site or section in one task and get every page as Markdown. The command starts the task, waits for it (`--timeout`, default 300 s, polling every 2 s), then prints the stats, one line per page, failed URLs and the result URL. Options: `--type sitemap|all`, `-n/--max-pages` (1-1000), repeatable `--include`/`--exclude` path rules (up to 20 each), `--format json|zip` (the CLI defaults to `json`), `-o/--output` (pages JSON or the ZIP), `--no-wait`, `--json`. `s1 deepcrawl status <taskId>` checks a task for free. 20 credits per task, any page count. Options after a subcommand now belong to that subcommand, so a global `-V` must come before it. The agent skill routes "crawl this whole site" requests to it.

## 2.2.0 - 2026-11-03

Adds `s1 maps "<query>"` and a `maps()` SDK helper for `POST /maps`: one Google Maps page of up to 20 places with category, rating, address, phone, website, open state and Maps link. Options: `-n/--max-results`, `--near <lat,lng>`, `--zoom`, `-p/--page` (page 2+ needs `--near`), `--country`, `-l/--lang`, `--json`. 3 credits per completed page. The agent skill routes "where is / nearby / list of businesses" requests to it.
Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,41 @@ Extract content from a URL.
s1 crawl https://example.com/article
```

### deepcrawl

Crawl a whole site, or one section of it, in a single task and get every page
as Markdown. Each task costs 20 credits, however many pages it crawls. The
command starts the task, waits for it (usually 10-20 seconds for 20 pages,
longer for big sites), then lists each page with its title, URL and length.

```bash
s1 deepcrawl https://hono.dev/docs/ -n 20 --include /docs --exclude /docs/changelog
s1 deepcrawl https://example.com --type all -o pages.json # save every page's Markdown
s1 deepcrawl https://example.com --format zip -o site.zip # one Markdown file per page
s1 deepcrawl https://example.com --no-wait # print the task id and exit
s1 deepcrawl status <taskId> # check it later (free)
s1 deepcrawl status <taskId> -o pages.json --json
```

| Option | Description | Default |
|---|---|---|
| `--type <type>` | `sitemap` reads the site's sitemap.xml; `all` follows the links on the page | `sitemap` |
| `-n, --max-pages <number>` | Pages to crawl (1-1000), taken after the path rules in discovery order | 1000 |
| `--include <path>` | Only crawl URL paths matching this rule; repeat for more (up to 20) | |
| `--exclude <path>` | Skip URL paths matching this rule; repeat for more (up to 20); wins over `--include` | |
| `--format <format>` | `json` returns the pages inline; `zip` packs them as Markdown files behind a download URL | `json` |
| `--no-wait` | Start the task, print its id and exit | |
| `--timeout <seconds>` | How long to wait for the result; the task keeps running after that | 300 |
| `-o, --output <file>` | Save the result: `{ pages, failed }` as JSON, or the ZIP | |
| `--json` | Output the raw status response | |

Path rules match the URL path. A rule without `*` is a prefix on segment
boundaries: `/docs` matches `/docs` and `/docs/api`, not `/docsearch`. A rule
with `*` must match the whole path, and `*` also matches `/`, e.g. `/blog/*`.

`s1 deepcrawl status <taskId>` takes `-o` and `--json` too. When a large JSON
result is not returned inline, `-o` downloads it from the result URL.

### sitemap

Get related links from a website.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "search1api-cli",
"version": "2.2.0",
"description": "CLI tool for Search1API - web search, maps, news, crawl, sitemap, and trending",
"version": "2.3.0",
"description": "CLI tool for Search1API - web search, maps, news, crawl, deepcrawl, sitemap, and trending",
"type": "module",
"exports": {
".": {
Expand Down
32 changes: 31 additions & 1 deletion skills/search1api/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: search1api
description: >
Live web search, agentic search, Google Maps place search, page retrieval, news, sitemap discovery, trending topics, and turning a URL into a reusable Agent Skill — all through the Search1API CLI (`s1`). Use this skill whenever the user wants to search the web, look something up, research a topic, read or summarize a URL, check current news, find businesses or places on a map, explore a site's links, see trending topics, check API balance, or teach an agent a URL so it can be used later. Trigger on phrases like "search for", "look up", "find out about", "what's happening with", "any news on", "coffee shops near", "restaurants in", "what does this link say", "read this page", "summarize this URL", "trending on GitHub", "learn this URL", "learn this site", "turn these docs into a skill", "记住这个链接", "学会这个文档", or when the user shares a bare URL.
Live web search, agentic search, Google Maps place search, page retrieval, whole-site crawling, news, sitemap discovery, trending topics, and turning a URL into a reusable Agent Skill — all through the Search1API CLI (`s1`). Use this skill whenever the user wants to search the web, look something up, research a topic, read or summarize a URL, pull every page of a site or docs section, check current news, find businesses or places on a map, explore a site's links, see trending topics, check API balance, or teach an agent a URL so it can be used later. Trigger on phrases like "search for", "look up", "find out about", "what's happening with", "any news on", "coffee shops near", "restaurants in", "what does this link say", "read this page", "summarize this URL", "crawl this whole site", "get all the pages under /docs", "trending on GitHub", "learn this URL", "learn this site", "turn these docs into a skill", "记住这个链接", "学会这个文档", or when the user shares a bare URL.
---

# Search1API
Expand Down Expand Up @@ -69,6 +69,7 @@ error.
| Wants to search the web | `s1 search "<query>"` |
| Asks a question that spans sources, unsure where to look | `s1 ask "<question>"` |
| Wants the full page behind a search result | `s1 crawl <url>` |
| Wants every page of a site or section as Markdown, now | `s1 deepcrawl <url>` |
| Wants news | `s1 news "<query>"` |
| Wants businesses or places on a map (where is, nearby, a list of shops) | `s1 maps "<what>"` |
| Wants to explore a site's links | `s1 sitemap <url>` |
Expand All @@ -82,6 +83,9 @@ These look similar and are not:

- "What does this page say?", "summarize this link", "read these docs and
answer X" → **`s1 crawl`**. One page, answer now, nothing written to disk.
- "Crawl this whole site", "get every page under /blog", "export these docs as
Markdown" → **`s1 deepcrawl`**. Many pages in one task, returned now or saved
to a file; nothing installed.
- "Learn this URL", "make a skill out of these docs", "记住这个文档" → **`s1 learn`**.
Produces an installable skill directory the user's agent can load later.
- **Scope follows the request.** A single link is one page; a documentation set
Expand Down Expand Up @@ -184,6 +188,32 @@ s1 crawl <url>

Extracts clean content from a URL. Use this whenever the user shares a link.

### deepcrawl

```bash
s1 deepcrawl <url> [--type sitemap|all] [-n 1-1000] [--include <path>]... [--exclude <path>]... [--format json|zip] [-o <file>] [--timeout <s>] [--no-wait] [--json]
s1 deepcrawl status <taskId> [-o <file>] [--json]
```

Crawls many pages of one site in a single task. Costs 20 credits per task
however many pages it crawls, so scope it once instead of re-running: `-n`
caps the pages (default 1000), `--include`/`--exclude` take URL-path rules and
can be repeated (up to 20 each). A rule without `*` is a path prefix on segment
boundaries (`/docs` matches `/docs/api`, not `/docsearch`); with `*` it matches
the whole path (`/blog/*`); exclude wins. `--type all` follows the page's links
when the site has no sitemap.

It waits for the task (about 10-20 s for 20 pages, longer for big sites) and
prints the stats, one line per page (title, URL, length), failed URLs, and the
result URL. Page Markdown is not printed: save it with `-o pages.json`, which
writes `{ pages: [{ url, title, content }], failed }`, or read it with `--json`.
If the wait times out, the task keeps running — run `s1 deepcrawl status
<taskId>` (free) instead of starting a new task. A completed task that found
nothing explains why in its message; adjust the path rules or `--type`.

Use `crawl` for one page and `sitemap` to see a site's URLs before choosing
path rules.

### sitemap

```bash
Expand Down
16 changes: 16 additions & 0 deletions skills/search1api/reference/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,22 @@ s1 search "test" --json
s1 balance --json
```

## Crawling a whole site

Check which URLs the site lists, then crawl one section in a single task
(20 credits) and save every page's Markdown:

```bash
s1 sitemap https://hono.dev/docs/
s1 deepcrawl https://hono.dev/docs/ -n 50 --include /docs/api --exclude /docs/api/presets -o hono-api.json
```

If the wait times out, check the same task instead of starting another:

```bash
s1 deepcrawl status <taskId> -o hono-api.json
```

## Learning a URL into a skill

One page, staged but not installed:
Expand Down
42 changes: 27 additions & 15 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,41 @@ export interface RequestOptions {
signal?: AbortSignal;
}

export async function request<T>(
/** Sends an authenticated request and returns the response, whatever its status. */
export async function send(
path: string,
body: unknown,
init: RequestInit,
options: RequestOptions = {}
): Promise<T> {
): Promise<Response> {
const url = `${API_BASE}${path}`;
const init: RequestInit = {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(body),
signal: options.signal,
};
const res = options.apiKey
? await fetch(url, {
...init,
const withSignal: RequestInit = { ...init, signal: options.signal };
return options.apiKey
? fetch(url, {
...withSignal,
headers: {
...Object.fromEntries(new Headers(init.headers).entries()),
Authorization: `Bearer ${options.apiKey}`,
},
})
: await fetchWithAuth(url, init);
: fetchWithAuth(url, withSignal);
}

export async function request<T>(
path: string,
body: unknown,
options: RequestOptions = {}
): Promise<T> {
const res = await send(
path,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(body),
},
options
);

if (!res.ok) {
const text = await res.text();
Expand Down
Loading
Loading