felo-ai 0.2.7 → 0.2.9

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.
@@ -1,200 +1,204 @@
1
- ---
2
- name: felo-web-fetch
3
- description: "Fetch web page content from a URL using Felo Web Extract API. Use when users ask to scrape/capture/fetch webpage content, get article text from URL, convert page to markdown/text, or when explicit commands like /felo-web-fetch are used. Supports html, text, markdown output and readability mode."
4
- ---
5
-
6
- # Felo Web Fetch Skill
7
-
8
- ## When to Use
9
-
10
- Trigger this skill when the user wants to:
11
-
12
- - Fetch or scrape content from a webpage URL
13
- - Get article/main text from a link
14
- - Convert a webpage to Markdown or plain text
15
- - Capture readable content from a URL for summarization or processing
16
-
17
- Trigger keywords (examples):
18
-
19
- - fetch webpage, scrape URL, fetch page content, web fetch, url to markdown
20
- - Explicit: `/felo-web-fetch`, "use felo web fetch"
21
- - Same intent in other languages (e.g. 网页抓取, 提取网页内容) also triggers this skill
22
-
23
- Do NOT use for:
24
-
25
- - Real-time search or Q&A (use `felo-search`)
26
- - Generating slides (use `felo-slides`)
27
- - Local file content (read files directly)
28
-
29
- ## Setup
30
-
31
- ### 1. Get API key
32
-
33
- 1. Visit [felo.ai](https://felo.ai)
34
- 2. Open Settings -> API Keys
35
- 3. Create and copy your API key
36
-
37
- ### 2. Configure environment variable
38
-
39
- Linux/macOS:
40
-
41
- ```bash
42
- export FELO_API_KEY="your-api-key-here"
43
- ```
44
-
45
- Windows PowerShell:
46
-
47
- ```powershell
48
- $env:FELO_API_KEY="your-api-key-here"
49
- ```
50
-
51
- ## How to Execute
52
-
53
- ### Option A: Use the bundled script or packaged CLI
54
-
55
- **Script** (from repo):
56
-
57
- ```bash
58
- node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com/article" [options]
59
- ```
60
-
61
- **Packaged CLI** (after `npm install -g felo-ai`): same options, with short forms allowed:
62
-
63
- ```bash
64
- felo web-fetch -u "https://example.com" [options]
65
- # Short forms: -u (url), -f (format), -t (timeout, seconds), -j (json)
66
- ```
67
-
68
- Options:
69
-
70
- | Option | Default | Description |
71
- |--------|---------|-------------|
72
- | `--url` | (required) | Webpage URL to fetch |
73
- | `--format` | markdown | Output format: `html`, `text`, `markdown` |
74
- | `--target-selector` | - | CSS selector: fetch only this element (e.g. `article.main`, `#content`) |
75
- | `--wait-for-selector` | - | Wait for this selector before fetching (e.g. dynamic content) |
76
- | `--readability` | false | Enable readability processing (main content only) |
77
- | `--crawl-mode` | fast | `fast` or `fine` |
78
- | `--timeout` | 60000 (script) / 60 (CLI) | Request timeout: script uses **milliseconds**, CLI uses **seconds** (e.g. `-t 90`) |
79
- | `--json` / `-j` | false | Print full API response as JSON |
80
-
81
- ### How to write instructions (target_selector + output_format)
82
-
83
- When the user wants a **specific part** of the page or a **specific output format**, phrase the command like this:
84
-
85
- - **Output format**: "Fetch as **text**" / "Get **markdown**" / "Return **html**" → use `--format text`, `--format markdown`, or `--format html`.
86
- - **Target one element**: "Only the **main article**" / "Just the **content inside** `#main`" / "Fetch only **article.main-content**" → use `--target-selector "article.main"` or the selector they give (e.g. `#main`, `.main-content`, `article .post`).
87
-
88
- Examples of user intents and equivalent commands:
89
-
90
- | User intent | Command |
91
- |-------------|---------|
92
- | "Fetch this page as plain text" | `--url "..." --format text` |
93
- | "Get only the main content area" | `--url "..." --target-selector "main"` or `article` |
94
- | "Fetch the div with id=content as markdown" | `--url "..." --target-selector "#content" --format markdown` |
95
- | "Just the article body, as HTML" | `--url "..." --target-selector "article .body" --format html` |
96
-
97
- Examples:
98
-
99
- ```bash
100
- # Basic: fetch as Markdown
101
- node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com"
102
-
103
- # Article-style with readability
104
- node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com/article" --readability --format markdown
105
-
106
- # Raw HTML
107
- node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com" --format html --json
108
-
109
- # Only the element matching a CSS selector (e.g. main article)
110
- node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com" --target-selector "article.main" --format markdown
111
-
112
- # Specific output format + target selector
113
- node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com" --target-selector "#content" --format text
114
- ```
115
-
116
- ### Option B: Call API with curl
117
-
118
- ```bash
119
- curl -X POST "https://openapi.felo.ai/v2/web/extract" \
120
- -H "Authorization: Bearer $FELO_API_KEY" \
121
- -H "Content-Type: application/json" \
122
- -d '{"url": "https://example.com", "output_format": "markdown", "with_readability": true}'
123
- ```
124
-
125
- ## API Reference (summary)
126
-
127
- - **Endpoint**: `POST /v2/web/extract`
128
- - **Base URL**: `https://openapi.felo.ai`. Override with `FELO_API_BASE` env if needed.
129
- - **Auth**: `Authorization: Bearer YOUR_API_KEY`
130
-
131
- ### Request body (JSON)
132
-
133
- | Parameter | Type | Required | Default | Description |
134
- |-----------|------|----------|---------|-------------|
135
- | url | string | Yes | - | Webpage URL to fetch |
136
- | crawl_mode | string | No | fast | `fast` or `fine` |
137
- | output_format | string | No | html | `html`, `text`, `markdown` |
138
- | with_readability | boolean | No | - | Use readability (main content) |
139
- | with_links_summary | boolean | No | - | Include links summary |
140
- | with_images_summary | boolean | No | - | Include images summary |
141
- | target_selector | string | No | - | CSS selector for target element |
142
- | wait_for_selector | string | No | - | Wait for selector before fetch |
143
- | timeout | integer | No | - | Timeout in milliseconds |
144
- | with_cache | boolean | No | true | Use cache |
145
-
146
- ### Response
147
-
148
- Success (200):
149
-
150
- ```json
151
- {
152
- "code": 0,
153
- "message": "success",
154
- "data": {
155
- "content": { ... }
156
- }
157
- }
158
- ```
159
-
160
- Fetched content is in `data.content`; structure depends on `output_format`.
161
-
162
- ### Error codes
163
-
164
- | HTTP | Code | Description |
165
- |------|------|-------------|
166
- | 400 | - | Parameter validation failed |
167
- | 401 | INVALID_API_KEY | API key invalid or revoked |
168
- | 500/502 | WEB_EXTRACT_FAILED | Fetch failed (server or page error) |
169
-
170
- ## Output Format
171
-
172
- On success (script without `--json`):
173
-
174
- - Print the fetched content only (for direct use or piping).
175
-
176
- With `--json`:
177
-
178
- - Print full API response including `code`, `message`, `data`.
179
-
180
- Error response to user:
181
-
182
- ```markdown
183
- ## Web Fetch Failed
184
-
185
- - Error: <code or message>
186
- - URL: <requested url>
187
- - Suggestion: <e.g. check URL, retry, or use --timeout>
188
- ```
189
-
190
- ## Important Notes
191
-
192
- - Always check `FELO_API_KEY` before calling; if missing, return setup instructions.
193
- - For long articles or slow sites, consider `--timeout` or `timeout` in request body.
194
- - Use `output_format: "markdown"` and `with_readability: true` for clean article text.
195
- - API may cache results; use `with_cache: false` in body only when fresh content is required (script does not expose this by default).
196
-
197
- ## References
198
-
199
- - [Felo Web Extract API](https://openapi.felo.ai/docs/api-reference/v2/web-extract.html)
200
- - [Felo Open Platform](https://openapi.felo.ai/docs/)
1
+ ---
2
+ name: felo-web-fetch
3
+ description: "Extract webpage content with Felo Web Extract API. Use for turning URLs into html/markdown/text, selecting specific page areas with CSS selectors, and controlling extraction options like crawl mode, cookies, user-agent, and timeout."
4
+ ---
5
+
6
+ # Felo Web Fetch Skill
7
+
8
+ ## When to Use
9
+
10
+ Trigger this skill when users want to extract or convert webpage content from a URL:
11
+
12
+ - Fetch or scrape content from a webpage URL
13
+ - Convert webpage content to `html`, `markdown`, or `text`
14
+ - Extract specific blocks using CSS selector
15
+ - Get article/main text from a link with readability mode
16
+ - Tune extraction behavior with crawl mode (`fast`/`fine`)
17
+ - Pass request details such as cookies, user-agent, timeout
18
+
19
+ Trigger keywords (examples):
20
+
21
+ - fetch webpage, scrape URL, fetch page content, web fetch, url to markdown
22
+ - Explicit: `/felo-web-fetch`, "use felo web fetch", "extract this URL with felo"
23
+ - Same intent in other languages (e.g. 网页抓取, 提取网页内容) also triggers this skill
24
+
25
+ Do NOT use this skill for:
26
+
27
+ - Real-time Q&A search summaries (use `felo-search`)
28
+ - Slide generation tasks (use `felo-slides`)
29
+ - Local file parsing in current workspace
30
+
31
+ ## Setup
32
+
33
+ ### 1. Get API key
34
+
35
+ 1. Visit [felo.ai](https://felo.ai)
36
+ 2. Open Settings -> API Keys
37
+ 3. Create and copy your API key
38
+
39
+ ### 2. Configure environment variable
40
+
41
+ Linux/macOS:
42
+ ```bash
43
+ export FELO_API_KEY="your-api-key-here"
44
+ ```
45
+
46
+ Windows PowerShell:
47
+ ```powershell
48
+ $env:FELO_API_KEY="your-api-key-here"
49
+ ```
50
+
51
+ ## How to Execute
52
+
53
+ ### Option A: Use the bundled script or packaged CLI
54
+
55
+ **Script** (from repo):
56
+
57
+ ```bash
58
+ node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com/article" [options]
59
+ ```
60
+
61
+ **Packaged CLI** (after `npm install -g felo-ai`): same options, with short forms allowed:
62
+
63
+ ```bash
64
+ felo web-fetch -u "https://example.com" [options]
65
+ # Short forms: -u (url), -f (format), -t (timeout, seconds), -j (json)
66
+ ```
67
+
68
+ Required parameter:
69
+ - `--url`
70
+
71
+ Core optional parameters:
72
+ - `--output-format html|markdown|text`
73
+ - `--crawl-mode fast|fine`
74
+ - `--target-selector "article.main-content"`
75
+ - `--wait-for-selector ".content-ready"`
76
+
77
+ Other key optional parameters:
78
+ - `--cookie "session_id=xxx"` (repeatable)
79
+ - `--set-cookies-json '[{"name":"sid","value":"xxx","domain":"example.com"}]'`
80
+ - `--user-agent "Mozilla/5.0 ..."`
81
+ - `--timeout 60` (HTTP request timeout in seconds)
82
+ - `--request-timeout-ms 15000` (API payload `timeout` in ms)
83
+ - `--with-readability true`
84
+ - `--with-links-summary true`
85
+ - `--with-images-summary true`
86
+ - `--with-images-readability true`
87
+ - `--with-images true`
88
+ - `--with-links true`
89
+ - `--ignore-empty-text-image true`
90
+ - `--with-cache false`
91
+ - `--with-stypes true`
92
+ - `--json` (print full JSON response)
93
+
94
+ ### How to write instructions (target_selector + output_format)
95
+
96
+ When the user wants a **specific part** of the page or a **specific output format**, phrase the command like this:
97
+
98
+ - **Output format**: "Fetch as **text**" / "Get **markdown**" / "Return **html**" → use `--output-format text`, `--output-format markdown`, or `--output-format html`.
99
+ - **Target one element**: "Only the **main article**" / "Just the **content inside** `#main`" / "Fetch only **article.main-content**" → use `--target-selector "article.main"` or the selector they give.
100
+
101
+ Examples:
102
+
103
+ ```bash
104
+ # Basic: fetch as Markdown
105
+ node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com" --output-format markdown
106
+
107
+ # Article-style with readability
108
+ node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com/article" --with-readability true --output-format markdown
109
+
110
+ # Only the element matching a CSS selector
111
+ node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com" --target-selector "article.main" --output-format markdown
112
+
113
+ # With cookies and custom user-agent
114
+ node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com/private" --cookie "session_id=abc123" --with-readability true --json
115
+
116
+ # Full JSON response
117
+ node felo-web-fetch/scripts/run_web_fetch.mjs --url "https://example.com" --output-format text --json
118
+ ```
119
+
120
+ ### Option B: Call API with curl
121
+
122
+ ```bash
123
+ curl -X POST "https://openapi.felo.ai/v2/web/extract" \
124
+ -H "Authorization: Bearer $FELO_API_KEY" \
125
+ -H "Content-Type: application/json" \
126
+ -d '{"url": "https://example.com", "output_format": "markdown", "with_readability": true}'
127
+ ```
128
+
129
+ ## API Reference (summary)
130
+
131
+ - **Endpoint**: `POST /v2/web/extract`
132
+ - **Base URL**: `https://openapi.felo.ai`. Override with `FELO_API_BASE` env if needed.
133
+ - **Auth**: `Authorization: Bearer YOUR_API_KEY`
134
+
135
+ ### Request body (JSON)
136
+
137
+ | Parameter | Type | Required | Default | Description |
138
+ |-----------|------|----------|---------|-------------|
139
+ | url | string | Yes | - | Webpage URL to fetch |
140
+ | crawl_mode | string | No | fast | `fast` or `fine` |
141
+ | output_format | string | No | html | `html`, `text`, `markdown` |
142
+ | with_readability | boolean | No | - | Use readability (main content) |
143
+ | with_links_summary | boolean | No | - | Include links summary |
144
+ | with_images_summary | boolean | No | - | Include images summary |
145
+ | target_selector | string | No | - | CSS selector for target element |
146
+ | wait_for_selector | string | No | - | Wait for selector before fetch |
147
+ | timeout | integer | No | - | Timeout in milliseconds |
148
+ | with_cache | boolean | No | true | Use cache |
149
+ | set_cookies | array | No | - | Cookie entries |
150
+ | user_agent | string | No | - | Custom user-agent |
151
+
152
+ ### Response
153
+
154
+ Success (200):
155
+
156
+ ```json
157
+ {
158
+ "code": 0,
159
+ "message": "success",
160
+ "data": {
161
+ "content": { ... }
162
+ }
163
+ }
164
+ ```
165
+
166
+ Fetched content is in `data.content`; structure depends on `output_format`.
167
+
168
+ ### Error codes
169
+
170
+ | HTTP | Code | Description |
171
+ |------|------|-------------|
172
+ | 400 | - | Parameter validation failed |
173
+ | 401 | INVALID_API_KEY | API key invalid or revoked |
174
+ | 500/502 | WEB_EXTRACT_FAILED | Fetch failed (server or page error) |
175
+
176
+ ## Output Format
177
+
178
+ - Default output is extracted content only (for direct use or piping).
179
+ - If response content is not a string, script prints JSON.
180
+ - Use `--json` when user needs metadata and full response object.
181
+
182
+ Error response format:
183
+
184
+ ```markdown
185
+ ## Web Fetch Failed
186
+ - Message: <error message>
187
+ - Suggested Action: verify URL/parameters and retry
188
+ ```
189
+
190
+ ## Important Notes
191
+
192
+ - Always require URL before running.
193
+ - Validate enum values:
194
+ - `output_format`: `html`, `markdown`, `text`
195
+ - `crawl_mode`: `fast`, `fine`
196
+ - Use `--target-selector` when users only want a specific part of the page.
197
+ - Use `--request-timeout-ms` for page rendering/extraction wait, and `--timeout` for local HTTP timeout.
198
+ - For long articles or slow sites, consider increasing `--timeout`.
199
+ - API may cache results; use `--with-cache false` only when fresh content is required.
200
+
201
+ ## References
202
+
203
+ - [Web Extract API](https://openapi.felo.ai/docs/api-reference/v2/web-extract.html)
204
+ - [Felo Open Platform](https://openapi.felo.ai/docs/)