Skip to content

Commit 72786c8

Browse files
authored
Merge pull request #17 from ScrapeGraphAI/v2-api-migration
feat!: migrate to ScrapeGraphAI v2 API (1.0.0)
2 parents 45678d0 + c30db5c commit 72786c8

42 files changed

Lines changed: 2186 additions & 1501 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish to npm
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
id-token: write
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: pnpm/action-setup@v4
18+
with:
19+
version: 9
20+
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
registry-url: 'https://registry.npmjs.org'
25+
cache: pnpm
26+
27+
- run: pnpm install --frozen-lockfile
28+
29+
- run: pnpm build
30+
31+
- run: pnpm exec eslint -c .eslintrc.prepublish.js nodes credentials package.json
32+
33+
- run: npm publish --provenance --access public
34+
env:
35+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

README.md

Lines changed: 53 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,65 @@
44
<img src="./nodes/scrapegraphAI.svg" width="250" alt="ScrapegraphAI Logo">
55
</p>
66

7-
This is the official node for [ScrapegraphAI](https://scrapegraphai.com) for n8n. It allows you to use ScrapegraphAI's powerful web scraping and data extraction capabilities within your n8n workflows.
7+
The official [ScrapeGraphAI](https://scrapegraphai.com) node for n8n. Hits the v2 API at `https://v2-api.scrapegraphai.com/api`.
88

9-
## Installation
10-
11-
You can install this node in your n8n instance as follows:
12-
13-
1. Go to **Settings** in your n8n instance
14-
2. Select the **Community Nodes** tab
15-
3. Click on **Install**
16-
4. Enter `n8n-nodes-scrapegraphai` in the "npm package name" field
17-
5. Click **Install**
9+
> **1.0.0 is a breaking release.** v1 endpoints (`/v1/smartscraper`, `/v1/markdownify`, `/v1/agentic-scrapper`, `/v1/toonify`) are gone. See **Migrating from 0.x** below.
1810
19-
After installation, you will be able to use the ScrapegraphAI nodes in your workflows.
20-
21-
## Features
22-
23-
This node provides several operations to interact with the ScrapegraphAI API:
11+
## Installation
2412

25-
- Markdownify - Convert a webpage to markdown
26-
- Smart Scraper - Extract specific data from a webpage
27-
- Search Scraper - Extract data from search results
13+
1. In n8n, go to **Settings → Community Nodes → Install**
14+
2. Enter `n8n-nodes-scrapegraphai`
15+
3. Click **Install**
2816

2917
## Credentials
3018

31-
To use this node, you need a ScrapegraphAI API key. You can get one by signing up at [scrapegraphai.com](https://scrapegraphai.com) and visiting your [dashboard](https://dashboard.scrapegraphai.com/dashboard).
32-
33-
<img width="1360" alt="image" src="https://github.com/user-attachments/assets/c4305f4d-a7bd-445a-a495-a1e0314b4f46" />
34-
35-
36-
## Usage
37-
38-
After adding the node to your workflow, you'll need to:
39-
40-
1. Create new credentials and enter your ScrapegraphAI API key
41-
2. Choose the operation you want to perform
42-
3. Configure the required parameters (e.g., website URL, extraction rules)
19+
1. Sign up at [scrapegraphai.com](https://scrapegraphai.com) and grab a key from the [dashboard](https://scrapegraphai.com/dashboard).
20+
2. In n8n, create a new **ScrapegraphAI API** credential and paste the key.
21+
3. n8n will validate the key against `GET /api/credits` — a green check means it's good.
22+
23+
## Resources
24+
25+
| Resource | Operations | What it does |
26+
|----------|------------|--------------|
27+
| **Scrape** | Scrape | Fetch a URL in any combination of formats: markdown, HTML, links, images, summary, JSON extraction, branding, or screenshot. |
28+
| **Extract** | Extract | LLM-powered structured extraction from a URL, raw HTML, or markdown. Optional JSON schema. |
29+
| **Search** | Search | Web search with content fetched inline. Optional AI rollup across all results. |
30+
| **Crawl** | Start, Get Status, Stop, Resume, Delete | Async multi-page crawl with include/exclude URL patterns. |
31+
| **Monitor** | Create, Get, Get Many, Get Activity, Update, Pause, Resume, Delete | Cron-scheduled fetches with change detection and webhooks. |
32+
| **History** | Get, Get Many | Look up past requests by ID — including the formatted content of crawled pages via each `scrapeRefId`. |
33+
| **Credit** | Get | Remaining credits, plan, and crawl/monitor quotas. |
34+
35+
Every fetch-based resource shares the same **Fetch Config** options: `mode` (auto / fast / js), `stealth`, `scrolls`, `wait`, `timeout`, `country`, custom `headers`, custom `cookies`.
36+
37+
## Migrating from 0.x
38+
39+
Three resources were removed in v2 — the API endpoints behind them are gone:
40+
41+
| Removed in 1.0.0 | Replacement |
42+
|------------------|-------------|
43+
| Markdownify | **Scrape** with format `markdown` |
44+
| Agentic Scraper | **Extract** with `Fetch Config → Mode = JS` and `Stealth = true` for hard pages, or **Crawl** for multi-page flows |
45+
| Toonify | The open-source [`toonify`](https://github.com/ScrapeGraphAI/toonify) package — TOON is no longer an API endpoint |
46+
47+
Field renames (top-level → v2):
48+
49+
| 0.x field | 1.0.0 location |
50+
|-----------|----------------|
51+
| `website_url` | `url` |
52+
| `user_prompt` | `prompt` (extract) / `query` (search) |
53+
| `output_schema` | `schema` |
54+
| `render_heavy_js` | `Fetch Config → Mode = JS` |
55+
| `stealth` | `Fetch Config → Stealth` |
56+
| `wait_ms` | `Fetch Config → Wait (Ms)` |
57+
| `number_of_scrolls` | `Fetch Config → Scrolls` |
58+
| `country_code` | `Fetch Config → Country` (most) / `Location (Country Code)` (search) |
59+
| `time_range` | `Time Range` (search) |
60+
61+
Removed without replacement:
62+
63+
- `total_pages` — use the **Crawl** resource for multi-page work.
64+
- `mock` — gone in v2; mock at the n8n / HTTP layer if you need it.
65+
- `cache_website`, `same_domain_only`, `breadth` (crawl) — use `includePatterns` / `excludePatterns` / `maxLinksPerPage` / `maxDepth` instead.
4366

4467
## License
4568

credentials/ScrapegraphAIAPi.credentials.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@ export class ScrapegraphAIApi implements ICredentialType {
3333

3434
test: ICredentialTestRequest = {
3535
request: {
36-
baseURL: 'https://api.scrapegraphai.com/v1',
37-
url: '/validate',
36+
baseURL: 'https://v2-api.scrapegraphai.com/api',
37+
url: '/credits',
3838
method: 'GET',
3939
headers: {
40-
'Content-Type': 'application/json',
4140
'SGAI-APIKEY': '={{$credentials.apiKey}}',
4241
'User-Agent': 'n8n',
43-
}
42+
},
4443
},
4544
};
4645
}

nodes/AgenticscraperDescription.ts

Lines changed: 0 additions & 150 deletions
This file was deleted.

nodes/MarkdownifyDescription.ts

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)