webcrawl 1.3.10 → 1.4.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.
- package/dist/bin.js +0 -0
- package/dist/core/local-engine.d.ts +5 -0
- package/dist/core/local-engine.js +21 -5
- package/dist/setup.d.ts +1 -1
- package/dist/setup.js +1 -1
- package/package.json +3 -3
package/dist/bin.js
CHANGED
|
File without changes
|
|
@@ -32,4 +32,9 @@ export interface LocalEngineBackend {
|
|
|
32
32
|
targets(): Promise<Record<string, unknown>>;
|
|
33
33
|
usage(): Promise<Record<string, unknown>>;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Apply `map --filter` / `search` after discovery, then honour `-n` / `limit`.
|
|
37
|
+
* Matching is a case-insensitive substring of the URL. Exported for unit tests.
|
|
38
|
+
*/
|
|
39
|
+
export declare function filterMappedLinks(links: string[], search?: string, limit?: number): string[];
|
|
35
40
|
export declare function createLocalEngineClient(): LocalEngineBackend;
|
|
@@ -29,6 +29,20 @@ function safeDomainOf(url) {
|
|
|
29
29
|
return "";
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Apply `map --filter` / `search` after discovery, then honour `-n` / `limit`.
|
|
34
|
+
* Matching is a case-insensitive substring of the URL. Exported for unit tests.
|
|
35
|
+
*/
|
|
36
|
+
export function filterMappedLinks(links, search, limit = 100) {
|
|
37
|
+
const cap = Math.max(1, limit);
|
|
38
|
+
const needle = search?.trim().toLowerCase();
|
|
39
|
+
const filtered = needle
|
|
40
|
+
? links.filter((l) => l.toLowerCase().includes(needle))
|
|
41
|
+
: links;
|
|
42
|
+
return filtered.slice(0, cap);
|
|
43
|
+
}
|
|
44
|
+
/** How many URLs to discover before applying `--filter`, so a small `-n` cannot hide matches. */
|
|
45
|
+
const MAP_FILTER_DISCOVER_LIMIT = 5000;
|
|
32
46
|
export function createLocalEngineClient() {
|
|
33
47
|
return {
|
|
34
48
|
baseUrl: "local://engine",
|
|
@@ -369,13 +383,15 @@ export function createLocalEngineClient() {
|
|
|
369
383
|
},
|
|
370
384
|
async map(p) {
|
|
371
385
|
const targetUrl = /^https?:\/\//i.test(p.url) ? p.url : `https://${p.url}`;
|
|
386
|
+
const limit = Math.max(1, p.limit ?? 100);
|
|
387
|
+
const needle = p.search?.trim();
|
|
388
|
+
// Discover first (widely when filtering), then apply search and limit so
|
|
389
|
+
// `map --filter webhooks -n 10` can still find /webhooks/* URLs that are
|
|
390
|
+
// not among the first 10 sitemap entries (#11).
|
|
372
391
|
const mapped = await mapWebsiteUrls(targetUrl, {
|
|
373
|
-
limit:
|
|
392
|
+
limit: needle ? Math.max(limit, MAP_FILTER_DISCOVER_LIMIT) : limit,
|
|
374
393
|
});
|
|
375
|
-
const
|
|
376
|
-
const links = needle
|
|
377
|
-
? mapped.links.filter((l) => l.toLowerCase().includes(needle))
|
|
378
|
-
: mapped.links;
|
|
394
|
+
const links = filterMappedLinks(mapped.links, needle, limit);
|
|
379
395
|
return {
|
|
380
396
|
success: true,
|
|
381
397
|
mode: "local",
|
package/dist/setup.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface AgentTarget {
|
|
|
6
6
|
skillPath: (home: string, cwd: string) => string;
|
|
7
7
|
}
|
|
8
8
|
export declare const SUPPORTED_AGENTS: AgentTarget[];
|
|
9
|
-
export declare const WEBCRAWL_SKILL_MD = "---\nname: webcrawl-anything\ndescription: Crawl, search, and extract structured evidence from any website, SPA, PDF, Office file, YouTube video, GitHub repo, ArXiv paper, shopping offer, travel fare, or CVE advisory.\n---\n\n# Webcrawl Anything \u2014 Agent Investigation Workflow\n\nUse **Webcrawl Anything** (`webcrawl` CLI or `webcrawl` MCP tools) whenever you need live web search, anti-bot page scraping, document/video parsing, or structured vertical extraction with provenance.\n\n## 1. Choose the Right Tool or Target\n\n1. **Structured Search (`web_search` / `webcrawl search`)**:\n - Pass `category` when the query belongs to a vertical:\n - `shopping`: Multi-retailer product prices, stock availability, ratings, shipping.\n - `flights`: IATA routes, fares, airlines, stops, cabin class.\n - `hotels`: Nightly rates, star ratings, guest reviews, amenities.\n - `real-estate`: Property listings (`subcategory: \"buy\" | \"rent\" | \"sold\"`).\n - `business`: Local businesses, clinics, phone numbers, hours, ratings.\n - `security`: CVE / GHSA records with CVSS scores, CWEs, affected/fixed versions, and CISA KEV status.\n - `academic`: ArXiv and research papers.\n - `tech` / `news` / `general`: General and developer search.\n2. **Page & Developer Target Inspection (`
|
|
9
|
+
export declare const WEBCRAWL_SKILL_MD = "---\nname: webcrawl-anything\ndescription: Crawl, search, and extract structured evidence from any website, SPA, PDF, Office file, YouTube video, GitHub repo, ArXiv paper, shopping offer, travel fare, or CVE advisory.\n---\n\n# Webcrawl Anything \u2014 Agent Investigation Workflow\n\nUse **Webcrawl Anything** (`webcrawl` CLI or `webcrawl` MCP tools) whenever you need live web search, anti-bot page scraping, document/video parsing, or structured vertical extraction with provenance.\n\n## 1. Choose the Right Tool or Target\n\n1. **Structured Search (`web_search` / `webcrawl search`)**:\n - Pass `category` when the query belongs to a vertical:\n - `shopping`: Multi-retailer product prices, stock availability, ratings, shipping.\n - `flights`: IATA routes, fares, airlines, stops, cabin class.\n - `hotels`: Nightly rates, star ratings, guest reviews, amenities.\n - `real-estate`: Property listings (`subcategory: \"buy\" | \"rent\" | \"sold\"`).\n - `business`: Local businesses, clinics, phone numbers, hours, ratings.\n - `security`: CVE / GHSA records with CVSS scores, CWEs, affected/fixed versions, and CISA KEV status.\n - `academic`: ArXiv and research papers.\n - `tech` / `news` / `general`: General and developer search.\n2. **Page & Developer Target Inspection (`web_read` / `webcrawl scrape <url>`)**:\n - Works on any website, client-rendered SPA, GitHub repository/issue/release, ArXiv abstract page, or `llms.txt` manifest.\n3. **Binary Documents & Media (`web_parse` / `webcrawl scrape <pdf-or-youtube-url>`)**:\n - Reads PDFs (native text + automatic OCR on scanned pages), Word (`.docx`), Excel (`.xlsx`), PowerPoint (`.pptx`), and YouTube URLs (timestamped transcripts).\n4. **Site Discovery & Multi-Page Crawl (`web_map` & `web_crawl`)**:\n - Always run `web_map` first on unfamiliar domains to inspect available URLs before running `web_crawl` (capped at 25 pages).\n5. **Scheduled Web Monitors (`web_monitor` / `webcrawl monitor`)**:\n - Watch a single page (`page`), a list of URLs (`urls`), or a whole website section (`site`) on a schedule with natural-language `watch_for` goals, trigger `condition` rules (e.g. `price < 50`, `content contains \"In Stock\"`, `added_urls_count > 0`), and email or webhook alerts.\n\n## 2. Verify Evidence & Provenance\n\n- Check the returned `evidence` block (`targetId`, `tier`, `contentHash`, `matchedSignals`, `limitations`) before stating claims as fact.\n- If `limitations` notes that a page was a client-rendered shell or blocked by a challenge in static mode, escalate to stealth browser or `webcrawl.app` cloud (`webcrawl login`).\n";
|
|
10
10
|
export interface SetupOptions {
|
|
11
11
|
agents?: SupportedAgentId[];
|
|
12
12
|
schemaProfile?: "compact" | "full";
|
package/dist/setup.js
CHANGED
|
@@ -61,7 +61,7 @@ Use **Webcrawl Anything** (\`webcrawl\` CLI or \`webcrawl\` MCP tools) whenever
|
|
|
61
61
|
- \`security\`: CVE / GHSA records with CVSS scores, CWEs, affected/fixed versions, and CISA KEV status.
|
|
62
62
|
- \`academic\`: ArXiv and research papers.
|
|
63
63
|
- \`tech\` / \`news\` / \`general\`: General and developer search.
|
|
64
|
-
2. **Page & Developer Target Inspection (\`
|
|
64
|
+
2. **Page & Developer Target Inspection (\`web_read\` / \`webcrawl scrape <url>\`)**:
|
|
65
65
|
- Works on any website, client-rendered SPA, GitHub repository/issue/release, ArXiv abstract page, or \`llms.txt\` manifest.
|
|
66
66
|
3. **Binary Documents & Media (\`web_parse\` / \`webcrawl scrape <pdf-or-youtube-url>\`)**:
|
|
67
67
|
- Reads PDFs (native text + automatic OCR on scanned pages), Word (\`.docx\`), Excel (\`.xlsx\`), PowerPoint (\`.pptx\`), and YouTube URLs (timestamped transcripts).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webcrawl",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Webcrawl Anything CLI & Core Engine — crawl, search, and extract structured evidence from any website, SPA, PDF, Office file, YouTube video, GitHub repo, ArXiv paper, or CVE",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -127,8 +127,8 @@
|
|
|
127
127
|
"@ai-sdk/gateway": "^4.0.123",
|
|
128
128
|
"@firecrawl/pdf-inspector": "^1.25.2",
|
|
129
129
|
"@vercel/sandbox": "^1.0.0",
|
|
130
|
-
"@webcrawl/client": "^1.
|
|
131
|
-
"@webcrawl/curl-impersonate": "^1.
|
|
130
|
+
"@webcrawl/client": "^1.4.1",
|
|
131
|
+
"@webcrawl/curl-impersonate": "^1.4.1",
|
|
132
132
|
"ai": "^7.0.150",
|
|
133
133
|
"impit": "^0.14.7",
|
|
134
134
|
"mammoth": "^1.13.0",
|