scrapely 1.2.6 → 1.2.7

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.
Files changed (2) hide show
  1. package/README.md +43 -96
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,118 +1,65 @@
1
- # Scrapely
2
-
3
- Scrapely is an Actor-based web scraping platform. Developers push an Actor (a scraping program), the platform builds it into a Docker image, runs it with structured input, and keeps its output in datasets, key-value stores and request queues. The API and SDKs follow Apify's shape, so most Apify Actors run with few or no changes.
4
-
5
- This repo holds the platform server, the Actor SDKs, the API clients, the CLI and the MCP servers.
6
-
7
- ## Repo layout
8
-
9
- | Path | What it is |
10
- |------|------------|
11
- | `src/` → `dist/` | Node.js Actor SDK, published as `scrapely`. `dist/` is committed because it is the package output. |
12
- | `scrapely-python/` | Python Actor SDK (`scrapely` on PyPI) |
13
- | `scrapely-server/` | API server, build/run workers, autoscaler, egress proxy |
14
- | `scrapely-cli/` | `scrapely` CLI: login, create/init, push, pull, run, builds, runs, storages, secrets |
15
- | `scrapely-client/` | JavaScript API client (`scrapely-client`, drop-in for `apify-client`) |
16
- | `scrapely-client-python/` | Python API client (`scrapely-client-python`) |
17
- | `scrapely-mcp/` | MCP server (TypeScript) |
18
- | `scrapely-mcp-python/` | MCP server (Python) |
19
- | `docker/` | Runner and Actor base images, Dragonfly compose file, Kaniko patch |
20
- | `docs/` | Platform documentation. Start at [docs/README.md](docs/README.md). |
21
- | `scripts/` | Server setup, deploy, migrations, benchmarks |
22
- | `tests/` | SDK/runtime tests |
23
- | `examples/basic-actor/` | Smallest working Actor |
24
- | `npm-claim-scrapely/` | Old placeholder for the `scrapely` npm name, now superseded by the SDK itself (1.2.4+). |
25
-
26
- Each package has its own README with install and usage details.
27
-
28
- ## How it fits together
29
-
30
- - The **API server** (`scrapely-server/`) serves the Apify-style `/v2` API: auth, Actors and versions, builds, runs, tasks, schedules, webhooks, storages, billing and admin routes.
31
- - **Builds and runs** are queued with BullMQ and picked up by workers. Builds produce Docker images that go to a private registry. Runs execute in Docker on worker servers.
32
- - **The autoscaler** adds and removes worker servers based on load. See [docs/autoscaling.md](docs/autoscaling.md).
33
- - **Storage**: run state and storages live in DragonflyDB (Redis-compatible). Accounts, Actors, runs and billing live in SingleStore. Both are backed up to S3.
34
- - **Browsers**: remote browsers come from Evomi over CDP. See [docs/evomi-integration.md](docs/evomi-integration.md).
35
- - **Actor code** imports the SDK, which patches Crawlee storage to go through the platform:
1
+ # Scrapely Node.js SDK
36
2
 
37
- ```ts
38
- import { Actor, PlaywrightCrawler, Dataset } from 'scrapely';
39
- ```
40
-
41
- ```python
42
- from scrapely import Actor
43
- ```
44
-
45
- ## Local development
3
+ Build JavaScript and TypeScript Actors for the [Scrapely](https://scrape.ly) platform. The SDK gives you the Actor lifecycle, input and output, datasets, key-value stores and request queues, Crawlee crawlers, remote browsers over CDP, platform events, run control, webhooks and pay-per-event charging.
46
4
 
47
- ### Prerequisites
48
-
49
- - Node.js 22
50
- - Docker
51
- - Doppler CLI with access to the `scrapely` project (all secrets come from Doppler; there are no `.env.example` files)
52
- - Reachable DragonflyDB and SingleStore instances (Doppler `stg` points at staging)
53
-
54
- ### Install
5
+ ## Install
55
6
 
56
7
  ```bash
57
- npm install
58
- cd scrapely-server && npm install
59
- cd ../scrapely-cli && npm install
8
+ npm install scrapely
60
9
  ```
61
10
 
62
- ### Run the API server
63
-
64
- ```bash
65
- cd scrapely-server
66
- doppler run -p scrapely -c stg -- npm run dev
67
- curl http://localhost:3000/health
68
- ```
11
+ ## Quick start
69
12
 
70
- To run a local Dragonfly instead of staging: `docker compose -f docker/docker-compose.dragonfly.yml up -d`.
13
+ ```ts
14
+ import { Actor } from 'scrapely';
71
15
 
72
- ### Build the runner image
16
+ await Actor.main(async () => {
17
+ const input = await Actor.getInputOrThrow<{ url: string }>();
18
+ await Actor.pushData({ url: input.url, status: 'processed' });
19
+ });
20
+ ```
73
21
 
74
- Needed before the server can run Actors locally:
22
+ `Actor.main()` initializes the Actor, awaits your function, closes events and storage, and exits the process. Always `await` writes so they reach the platform before the process ends.
75
23
 
76
- ```bash
77
- make build-runner
78
- ```
24
+ ## Crawling
79
25
 
80
- ### Push and run an Actor
26
+ ```ts
27
+ import { Actor, PlaywrightCrawler } from 'scrapely';
81
28
 
82
- ```bash
83
- scrapely login
84
- cd examples/basic-actor
85
- scrapely push
86
- scrapely run --wait
87
- ```
29
+ await Actor.main(async () => {
30
+ const { startUrls } = await Actor.getInputOrThrow<{ startUrls: string[] }>();
88
31
 
89
- ## Tests
32
+ const crawler = new PlaywrightCrawler({
33
+ maxConcurrency: 5,
34
+ async requestHandler({ request, page }) {
35
+ await Actor.pushData({ url: request.url, title: await page.title() });
36
+ },
37
+ });
90
38
 
91
- ```bash
92
- npm test # root SDK
93
- cd scrapely-server && npm test
39
+ await crawler.run(startUrls);
40
+ });
94
41
  ```
95
42
 
96
- Both packages have many more targeted `test:*` scripts in their `package.json`. Most tests are integration-style, and some need a valid `CDP_URL` or live services.
43
+ On the platform, browser crawlers connect to a remote Chromium over CDP instead of launching a local browser. Locally, they launch a normal browser unless you set `CDP_URL` or call `setCdpUrl()`.
97
44
 
98
- ## Deploy
45
+ ## What's included
99
46
 
100
- | Command | What it does |
101
- |---------|--------------|
102
- | `npm run prod` | Full production deploy (`scripts/deploy-prod.sh`) |
103
- | `npm run prod:update` | Update-only deploy |
104
- | `npm run setup:server` | Bootstrap a fresh Linux server |
105
- | `npm run setup:gvisor` | Install gVisor on a Linux host |
106
- | `npm run migrate` | Run a SingleStore migration |
47
+ - **Actor lifecycle:** `Actor.main()`, `init()`, `exit()`, `fail()`, status messages, reboot, metamorph and abort
48
+ - **Input and output:** `getInput()`, `getInputOrThrow()`, `pushData()`, `getValue()`, `setValue()`
49
+ - **Storage:** `Dataset`, `KeyValueStore` and `RequestQueue`, backed by the Scrapely API on the platform and by local files during development
50
+ - **Crawlers:** `PlaywrightCrawler`, `PuppeteerCrawler`, `CheerioCrawler`, `HttpCrawler`, `BasicCrawler`, `BrowserCrawler`, `JSDOMCrawler` and `LinkeDOMCrawler`
51
+ - **Remote browsers:** automatic CDP wiring through `CDP_URL`, or `setCdpUrl()`
52
+ - **Events:** state persistence, migration and graceful shutdown
53
+ - **Run control:** `Actor.call()`, `Actor.callTask()`, `Actor.start()` and ad-hoc webhooks
54
+ - **Charging:** `Actor.charge()`, `ChargingManager` and `pushDataAndCharge()` for pay-per-event Actors
55
+ - **Logging and utilities:** `log`, `utils` and `enqueueLinks`
107
56
 
108
- The main server uses `scrapely-server/docker-compose.yml` and workers use `docker-compose.worker.yml`. Secrets are injected at container start with `doppler run`.
57
+ ## Related packages
109
58
 
110
- `make start` / `stop` / `restart` / `logs` wrap the server compose stack.
59
+ - [`scrapely-client`](https://www.npmjs.com/package/scrapely-client): JavaScript API client
60
+ - [`scrapely-cli`](https://www.npmjs.com/package/scrapely-cli): create, run and push Actors from your terminal
61
+ - [`scrapely-python`](https://pypi.org/project/scrapely-python/): the Python SDK
111
62
 
112
- ## Where to look next
63
+ ## License
113
64
 
114
- - [docs/README.md](docs/README.md): documentation index (getting started, SDKs, CLI, webhooks, troubleshooting)
115
- - [scrapely-server/docs/API_ENDPOINTS.md](scrapely-server/docs/API_ENDPOINTS.md): API reference
116
- - [docs/network-architecture.md](docs/network-architecture.md): fleet topology and data path
117
- - `scrapely-server/src/index.ts`: server startup and route wiring
118
- - `src/actor.ts`: Node SDK Actor runtime
65
+ ISC
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "scrapely",
3
- "version": "1.2.6",
4
- "description": "Apify-like scraping platform using Evomi browser infrastructure",
3
+ "version": "1.2.7",
4
+ "description": "Scrapely SDK for building JavaScript and TypeScript Actors",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [