n8n-nodes-scraperapi 0.2.3 → 0.3.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 CHANGED
@@ -1,189 +1,103 @@
1
- # n8n-nodes-scraperapi
1
+ ![Geonode for n8n: Web Scraping & Workflow Automation](assets/banner.svg)
2
2
 
3
- **Get your free API key:** [sign up at geonode.com](https://app.geonode.com/sign-up?utm_source=npm&utm_medium=package&utm_campaign=n8n).
3
+ # Geonode for n8n: Web Scraping & Workflow Automation
4
4
 
5
- Community n8n node package for the **Geonode Scraper API**. Wraps the public REST endpoints (`/v1/extract`, `/v1/map`, `/v1/crawl`, `/v1/webhooks`, `/v1/statistics`) and ships a webhook trigger that registers itself against `/v1/webhooks` automatically.
5
+ Bring web data into self-hosted n8n agents and workflows with Geonode’s community node. Extract pages, crawl sites, discover URLs, search the web and run batches. Use extraction and crawl completion triggers to continue your own AI processing, research or record-update steps.
6
6
 
7
- New credentials default to the production API:
7
+ **[Try Geonode for free](https://app.geonode.com/sign-up)**
8
8
 
9
- ```
10
- https://scraper.geonode.io
11
- ```
12
-
13
- You can point it at another deployment by editing the **Base URL** field on the credential. Use a staging or preprod URL only for intentional testing, with an API key for that environment. Existing saved credentials keep their configured Base URL; update it manually if you want to switch environments.
9
+ [Integrations page](https://geonode.com/integrations/integration-n8n) · [Geonode API docs](https://docs.geonode.com/docs/scraper-api) · [n8n setup guide](https://docs.geonode.com/docs/scraper-api/guides/sdks/n8n) · [View package on npm](https://www.npmjs.com/package/n8n-nodes-scraperapi) · [View source on GitHub](https://github.com/geonodecom/integration-n8n) · [Complete guide](docs/guide.md)
14
10
 
15
- See the [official API reference](https://docs.geonode.com/docs/scraper-api/v1/reference) for the production base URL and authentication details.
11
+ **For self-hosted n8n.** This is a community node, not a verified n8n Cloud node. The npm package name remains `n8n-nodes-scraperapi`.
16
12
 
17
- ---
13
+ <!-- BEGIN README NAV -->
14
+ [Get started](#get-started) · [Build these workflows](#build-these-workflows) · [Example: a URL to a spreadsheet row](#example-a-url-to-a-spreadsheet-row) · [Setup questions](#setup-questions)
15
+ <!-- END README NAV -->
18
16
 
19
- ## Package structure
20
-
21
- ```
22
- n8n-nodes-scraperapi/
23
- ├─ credentials/
24
- │ └─ ScraperApiApi.credentials.ts # X-Api-Key credential, tested against /v1/statistics
25
- ├─ nodes/
26
- │ ├─ ScraperApi/
27
- │ │ ├─ ScraperApi.node.ts # Action node (7 resources, ~20 operations)
28
- │ │ ├─ GenericFunctions.ts # Auth + retry/backoff helpers + polling helper
29
- │ │ ├─ scraperapi.svg # Node icon
30
- │ │ └─ descriptions/
31
- │ │ ├─ ExtractDescription.ts # Form schema for extract: run / getJob / listJobs
32
- │ │ ├─ SearchDescription.ts # Form schema for search: run / getJob / listJobs
33
- │ │ ├─ BatchDescription.ts # Form schema for batch: start / getStatus / listJobs / cancel
34
- │ │ ├─ MapDescription.ts # Form schema for map: discover URLs
35
- │ │ ├─ CrawlDescription.ts # Form schema for crawl: start / getStatus
36
- │ │ ├─ WebhookDescription.ts # Form schema for webhook CRUD + deliveries
37
- │ │ └─ StatisticsDescription.ts # Form schema for statistics: get
38
- │ └─ ScraperApiTrigger/
39
- │ ├─ ScraperApiTrigger.node.ts # Trigger node — auto-registers on activate
40
- │ └─ scraperapi.svg
41
- ├─ docker-compose.n8n.yml # Local n8n that mounts this package as a custom extension
42
- ├─ package.json # n8n entry points -> dist/**
43
- ├─ tsconfig.json # Compiles credentials/** + nodes/** -> dist/
44
- ├─ gulpfile.js # Copies SVG icons into dist/
45
- ├─ .eslintrc.js # eslint-plugin-n8n-nodes-base rules
46
- └─ index.js # Empty — n8n loads via the "n8n" key in package.json
47
- ```
17
+ ## Workflow ideas
48
18
 
49
- ### Component descriptions
19
+ - **Feed a knowledge base.** Extract source pages as Markdown, then connect your own chunking, embedding and storage nodes.
20
+ - **Refresh a website dataset.** Start a bounded crawl and process the returned content after the job completes.
21
+ - **React to completed extraction.** Use Geonode Scraper API Trigger to start follow-up processing for extraction or crawl completion.
50
22
 
51
- #### Credential — `ScraperApiApi`
23
+ ## Get started
52
24
 
53
- **`X-Api-Key: <key>`** — your personal API key, sent on every request.
25
+ 1. In n8n, open **Settings → Community Nodes → Install** and enter `n8n-nodes-scraperapi`.
26
+ 2. Create a **Geonode Scraper API** credential. Paste your Geonode API key and keep the base URL `https://scraper.geonode.io`.
27
+ 3. Add a **Geonode Scraper API** node. Choose **Extract → Run Extraction**, enter a URL, and choose **Markdown** as the output format.
28
+ 4. Execute the step. The result contains the page content in `data.markdown` and its cost in `tokens_charged`.
54
29
 
55
- Credential fields:
30
+ You can obtain a key from **API Keys** in the [Geonode dashboard](https://app.geonode.com/). The credential test checks authenticated usage statistics.
56
31
 
57
- | Field | Default | When to fill |
58
- |----------|----------------------------------------------------|-------------------------------------------------------|
59
- | Base URL | `https://scraper.geonode.io` | Root URL, no trailing slash. |
60
- | API Key | (empty) | Required. Sent as `X-Api-Key`. |
32
+ ## Build these workflows
61
33
 
62
- Clicking **Test** issues `GET {baseUrl}/v1/statistics` with the credentials applied. This endpoint is auth-gated.
34
+ | Workflow | Node capability |
35
+ | --- | --- |
36
+ | Feed a knowledge base | Extract pages as Markdown with optional JavaScript rendering. |
37
+ | Refresh many sources | Start a batch, then wait for or retrieve its results. |
38
+ | Collect a site | Crawl from a seed URL with depth and page limits. |
39
+ | Discover URLs | Map a site's links before choosing pages to extract. |
40
+ | Search the web | Run search jobs with engine and locale controls. |
41
+ | React to completed jobs | Use **Geonode Scraper API Trigger** for extraction or crawl completion. |
42
+ | Monitor usage | Read statistics and manage webhook subscriptions. |
63
43
 
64
- #### Action node — `ScraperApi`
44
+ For long jobs, use asynchronous extraction or a start/status sequence. The [full guide](docs/guide.md) covers polling, webhook signature checks, errors and retries.
65
45
 
66
- One node with seven resources, each exposing the relevant operations:
46
+ <!-- BEGIN SHARED WORKFLOW GUIDE -->
47
+ ## Example: a URL to a spreadsheet row
67
48
 
68
- | Resource | Operation | What it does |
69
- |--------------|-------------------|----------------------------------------------------------------------------------------------------|
70
- | `extract` | Run Extraction | `POST /v1/extract`. Pick formats (html / markdown), JS rendering, sync vs async, proxy, headers. |
71
- | `extract` | Get Job | `GET /v1/extract/{job_id}` — fetch a single async job result. |
72
- | `extract` | List Jobs | `GET /v1/extract/jobs` with filters (status, URL, date range) and pagination. |
73
- | `search` | Run Search | `POST /v1/search` — query plus optional engine, locale, page, safe search and time range. |
74
- | `search` | Get Job | `GET /v1/search/{job_id}` — fetch a single search job. |
75
- | `search` | List Jobs | `GET /v1/search/jobs` with filters (query, status, date range) and pagination. |
76
- | `batch` | Start Batch | `POST /v1/batch` — many URLs in one job; formats, JS rendering, proxy, headers, invalid-URL policy.|
77
- | `batch` | Get Status | `GET /v1/batch/{job_id}` — paginated results; optional client-side polling until terminal status. |
78
- | `batch` | List Jobs | `GET /v1/batch/jobs` with filters (status, date range) and pagination. |
79
- | `batch` | Cancel | `DELETE /v1/batch/{job_id}` — stop a batch that has not finished. |
80
- | `map` | Discover URLs | `POST /v1/map` — sitemap + optional search keyword, returns `links[]`. |
81
- | `crawl` | Start Crawl | `POST /v1/crawl` — seed URL, depth, limit, formats, same-domain / subdomain rules, proxy. |
82
- | `crawl` | Get Status | `GET /v1/crawl/{job_id}` — paginated results; optional client-side polling until terminal status. |
83
- | `webhook` | Create | `POST /v1/webhooks` — register a target URL for an event. |
84
- | `webhook` | Get / List | `GET /v1/webhooks/{id}` and `GET /v1/webhooks` (paginated). |
85
- | `webhook` | Update | `PATCH /v1/webhooks/{id}` — change URL, description, event type, active flag. |
86
- | `webhook` | Delete | `DELETE /v1/webhooks/{id}`. |
87
- | `webhook` | Rotate Secret | `POST /v1/webhooks/{id}/rotate-secret` — issues a new HMAC signing secret. |
88
- | `webhook` | List Deliveries | `GET /v1/webhooks/{id}/deliveries` with status filter and pagination. |
89
- | `statistics` | Get | `GET /v1/statistics` for an optional date range. |
49
+ 1. Supply a URL from a trigger or an Edit Fields node, then add Geonode Scraper API → Extract → Run Extraction.
50
+ 2. Select your Geonode Scraper API credential, map the incoming URL, choose Markdown and keep synchronous processing for the first test.
51
+ 3. Execute the step and inspect data.markdown, metadata.url and tokens_charged in the returned item's JSON.
52
+ 4. Connect a separate Google Sheets node and map those fields into Content, Source URL and Usage columns using n8n's expression editor.
53
+ 5. Test the destination write before activating the workflow. Add a separate AI node if you want a summary rather than the raw Markdown.
90
54
 
91
- When a sync extract returns inline, the response is the raw `{data, ...}` body. For async (`processing_mode=async`) the API returns `{job_id, status, status_url, estimated_tokens}`; if **Wait for Completion** is on, the node polls `status_url` until the job hits `completed | failed | cancelled` and returns that final body.
55
+ **Expected result:** Geonode retrieves the page content. The Sheets or AI node needs its own connection; this recipe does not install or configure those services.
92
56
 
93
- The shared HTTP helper (`GenericFunctions.scraperApiRequest`) handles:
94
- - `X-Api-Key` header injection via the credential
95
- - Up to 5 retries on `429` and `5xx` with exponential backoff
96
- - `Retry-After` header support (seconds or HTTP-date)
97
- - Conversion of non-retryable errors into `NodeApiError` so n8n surfaces them in the UI
57
+ ## Understand output and completion triggers
98
58
 
99
- #### Trigger node — `ScraperApiTrigger`
59
+ Each successful input item produces an output item whose JSON contains the API response. A queued extraction returns job information, while completed extraction returns content. Do not map a job ID as if it were Markdown.
100
60
 
101
- Use this when you want a workflow to run **whenever the Scraper API emits an event** (`extract_completed`, `crawl_completed`).
61
+ Geonode Scraper API Trigger supports extraction and crawl completion. Activation registers a webhook and deactivation removes it. Keep signature verification enabled and use a callback URL reachable by the API.
102
62
 
103
- On workflow activation it:
104
- 1. Calls `POST /v1/webhooks` with n8n's public webhook URL and the chosen event type.
105
- 2. Stashes the returned `id` and `secret` in workflow static data.
63
+ If Continue On Fail is enabled, a failed item can contain an error string. Route those items separately instead of sending them to your normal content destination.
106
64
 
107
- On webhook delivery it (optionally) verifies `X-Webhook-Signature: sha256=<hex>` using HMAC-SHA256 + the stored secret, then emits `{headers, body}` as workflow input.
65
+ ## Setup questions
108
66
 
109
- On deactivation it calls `DELETE /v1/webhooks/{id}` to clean up.
67
+ Can't install on n8n Cloud? This is a self-hosted community node and has not been verified for n8n Cloud. The package name is n8n-nodes-scraperapi.
110
68
 
111
- ---
69
+ No trigger events? Check workflow activation, the reachable webhook URL and signature verification. A successful credential test alone does not prove that callbacks arrive.
112
70
 
113
- ## Running the node
71
+ Need parsed product fields or change alerts? Add your own parsing, storage and comparison nodes after extraction. The content response does not promise those outputs automatically.
114
72
 
115
- A ready-made compose file lives at `docker-compose.n8n.yml` in this directory. It mounts this package into n8n's custom-extensions dir and exposes the editor on `http://localhost:5678`.
116
-
117
- From this directory:
118
-
119
- ```bash
120
- # 1. Install deps and build the package
121
- npm install
122
- npm run build # produces ./dist/ which docker-compose mounts into n8n
123
-
124
- # 2. Start n8n
125
- docker compose -f docker-compose.n8n.yml up -d
126
- ```
73
+ These recipes describe source-supported workflows. They have not been run as authenticated end-to-end examples in this review.
74
+ <!-- END SHARED WORKFLOW GUIDE -->
127
75
 
128
- > The compose file mounts the package directory read-only into `/home/node/.n8n/custom/n8n-nodes-scraperapi`. n8n reads the `n8n` key from `package.json` and loads the compiled JS from `dist/**`, so **`npm run build` must succeed before starting the container** (or before restarting after code changes).
76
+ ## Develop locally
129
77
 
130
- After the container is up:
78
+ Use Node.js 20.15 or newer and npm. Run from this repository root:
131
79
 
132
- 1. Open `http://localhost:5678` and finish the n8n owner setup.
133
- 2. **Credentials → New → Scraper API**.
134
- - Base URL: `https://scraper.geonode.io` (the default).
135
- - API Key: your Geonode Scraper API key for production.
136
- - Click **Test** — sends an authenticated `GET /v1/statistics` request.
137
- 3. New workflow → search **Scraper API** → drop it in.
138
-
139
- To pick up code changes:
140
-
141
- ```bash
80
+ ```sh
81
+ npm ci
142
82
  npm run build
143
- docker compose -f docker-compose.n8n.yml restart n8n
83
+ npm test
84
+ npm run lint
144
85
  ```
145
86
 
146
- To stop / clean up:
87
+ To open a local n8n editor with the built nodes mounted:
147
88
 
148
- ```bash
149
- docker compose -f docker-compose.n8n.yml down # stop, keep data
150
- docker compose -f docker-compose.n8n.yml down -v # also drop the n8n_data volume
89
+ ```sh
90
+ docker compose -f docker-compose.n8n.yml up -d
151
91
  ```
152
92
 
153
- ### Smoke test
154
-
155
- In a workflow, add **Scraper API** → resource `extract` → operation `Run Extraction`:
156
-
157
- ![Creation](./docs/screenshots/node-creating.png)
158
- ![List](./docs/screenshots/nodes-list.png)
93
+ Open `http://localhost:5678`. Rebuild after editing TypeScript, then restart the n8n container. This Compose setup is for local development; webhook triggers require a URL the API can reach.
159
94
 
160
- - URL: `https://example.com`
161
- - Output Formats: `html`
162
- - Render JavaScript: off
163
- - Processing Mode: `Sync (Block Until Done)`
95
+ ## Source and releases
164
96
 
165
- ![Execution](./docs/screenshots/node-execution.png)
97
+ Package names, node identifiers and credential types are kept stable. Maintainers publish releases to npm with the `Publish` workflow in GitHub Actions.
166
98
 
167
- Click **Execute Node** — you should see a JSON output with `data.html` populated.
168
-
169
- Then try the trigger: in a separate workflow add **Scraper API Trigger**, pick `extract_completed`, **save** and **activate**. The node will register a webhook against `/v1/webhooks`. Run an `extract` against the same deployment with `processing_mode=async`; when it finishes, the trigger workflow fires.
170
-
171
- ---
172
-
173
- ## Scripts reference
174
-
175
- ```bash
176
- npm run build # tsc + copy SVG icons into dist/
177
- npm run dev # tsc --watch
178
- npm run lint # eslint with eslint-plugin-n8n-nodes-base
179
- npm run lintfix # eslint --fix
180
- npm run format # prettier on nodes/ and credentials/
181
- ```
99
+ [Contributing](CONTRIBUTING.md) · [Changelog](CHANGELOG.md) · [Contact Geonode](https://geonode.com/contact)
182
100
 
183
- ## Notes specific to this API
101
+ MIT licensed. See [LICENSE](LICENSE).
184
102
 
185
- - **Auth** — `X-Api-Key` header (per-user). See `app/api/security/auth_token_handler.py`. Billing user resolution happens in `app/api/security/user_resolver.py`.
186
- - **Async extract** — `processing_mode=async` returns 202 with `{job_id, status, status_url, estimated_tokens}` (see `app/api/v1/extract/router.py`). The node polls `status_url` when **Wait for Completion** is on.
187
- - **Throttling (HTTP 429)** — `scraperApiRequest` honors `Retry-After` and retries up to 5 times with exponential backoff (also covers transient 5xx).
188
- - **Errors** — surfaced as `NodeApiError`. The API returns `{code, message, correlation_id, retryable}` (see `app/api/v1/extract/schemas.py`).
189
- - **Webhook events** — `extract_completed`, `crawl_completed` (see `app/core/webhooks/event_types.py`).
103
+ **[Try Geonode for free](https://app.geonode.com/sign-up)**
@@ -2,6 +2,7 @@ import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodePro
2
2
  export declare class ScraperApiApi implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
5
+ icon: "file:scraper-geonode.svg";
5
6
  documentationUrl: string;
6
7
  properties: INodeProperties[];
7
8
  authenticate: IAuthenticateGeneric;
@@ -4,7 +4,8 @@ exports.ScraperApiApi = void 0;
4
4
  class ScraperApiApi {
5
5
  constructor() {
6
6
  this.name = 'scraperApiApi';
7
- this.displayName = 'Scraper API';
7
+ this.displayName = 'Geonode Scraper API';
8
+ this.icon = 'file:scraper-geonode.svg';
8
9
  this.documentationUrl = 'https://docs.geonode.com/docs/scraper-api/v1/reference';
9
10
  this.properties = [
10
11
  {
@@ -1 +1 @@
1
- {"version":3,"file":"ScraperApiApi.credentials.js","sourceRoot":"","sources":["../../credentials/ScraperApiApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,aAAa;IAA1B;QACE,SAAI,GAAG,eAAe,CAAC;QACvB,gBAAW,GAAG,aAAa,CAAC;QAC5B,qBAAgB,GAAG,wDAAwD,CAAC;QAE5E,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,4BAA4B;gBACrC,WAAW,EAAE,4BAA4B;gBACzC,WAAW,EAAE,4DAA4D;gBACzE,QAAQ,EAAE,IAAI;aACf;YACD;gBACE,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EACT,+FAA+F;aAClG;SACF,CAAC;QAEF,iBAAY,GAAyB;YACnC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,WAAW,EAAE,0BAA0B;iBACxC;aACF;SACF,CAAC;QAIF,SAAI,GAA2B;YAC7B,OAAO,EAAE;gBACP,OAAO,EAAE,2BAA2B;gBACpC,GAAG,EAAE,gBAAgB;gBACrB,MAAM,EAAE,KAAK;aACd;SACF,CAAC;IACJ,CAAC;CAAA;AA7CD,sCA6CC"}
1
+ {"version":3,"file":"ScraperApiApi.credentials.js","sourceRoot":"","sources":["../../credentials/ScraperApiApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,aAAa;IAA1B;QACE,SAAI,GAAG,eAAe,CAAC;QACvB,gBAAW,GAAG,qBAAqB,CAAC;QACpC,SAAI,GAAG,0BAAmC,CAAC;QAC3C,qBAAgB,GAAG,wDAAwD,CAAC;QAE5E,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,4BAA4B;gBACrC,WAAW,EAAE,4BAA4B;gBACzC,WAAW,EAAE,4DAA4D;gBACzE,QAAQ,EAAE,IAAI;aACf;YACD;gBACE,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EACT,+FAA+F;aAClG;SACF,CAAC;QAEF,iBAAY,GAAyB;YACnC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,WAAW,EAAE,0BAA0B;iBACxC;aACF;SACF,CAAC;QAIF,SAAI,GAA2B;YAC7B,OAAO,EAAE;gBACP,OAAO,EAAE,2BAA2B;gBACpC,GAAG,EAAE,gBAAgB;gBACrB,MAAM,EAAE,KAAK;aACd;SACF,CAAC;IACJ,CAAC;CAAA;AA9CD,sCA8CC"}