scrapely 1.2.5 → 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 -97
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,119 +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
- | `Apify_Docs/` | Apify API reference copies, fetched by `getdocs.py` |
25
- | `npm-claim-scrapely/` | Old placeholder for the `scrapely` npm name, now superseded by the SDK itself (1.2.4+). |
26
-
27
- Each package has its own README with install and usage details.
28
-
29
- ## How it fits together
30
-
31
- - 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.
32
- - **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.
33
- - **The autoscaler** adds and removes worker servers based on load. See [docs/autoscaling.md](docs/autoscaling.md).
34
- - **Storage**: run state and storages live in DragonflyDB (Redis-compatible). Accounts, Actors, runs and billing live in SingleStore. Both are backed up to S3.
35
- - **Browsers**: remote browsers come from Evomi over CDP. See [docs/evomi-integration.md](docs/evomi-integration.md).
36
- - **Actor code** imports the SDK, which patches Crawlee storage to go through the platform:
1
+ # Scrapely Node.js SDK
37
2
 
38
- ```ts
39
- import { Actor, PlaywrightCrawler, Dataset } from 'scrapely';
40
- ```
41
-
42
- ```python
43
- from scrapely import Actor
44
- ```
45
-
46
- ## 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.
47
4
 
48
- ### Prerequisites
49
-
50
- - Node.js 22
51
- - Docker
52
- - Doppler CLI with access to the `scrapely` project (all secrets come from Doppler; there are no `.env.example` files)
53
- - Reachable DragonflyDB and SingleStore instances (Doppler `stg` points at staging)
54
-
55
- ### Install
5
+ ## Install
56
6
 
57
7
  ```bash
58
- npm install
59
- cd scrapely-server && npm install
60
- cd ../scrapely-cli && npm install
8
+ npm install scrapely
61
9
  ```
62
10
 
63
- ### Run the API server
64
-
65
- ```bash
66
- cd scrapely-server
67
- doppler run -p scrapely -c stg -- npm run dev
68
- curl http://localhost:3000/health
69
- ```
11
+ ## Quick start
70
12
 
71
- 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';
72
15
 
73
- ### 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
+ ```
74
21
 
75
- 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.
76
23
 
77
- ```bash
78
- make build-runner
79
- ```
24
+ ## Crawling
80
25
 
81
- ### Push and run an Actor
26
+ ```ts
27
+ import { Actor, PlaywrightCrawler } from 'scrapely';
82
28
 
83
- ```bash
84
- scrapely login
85
- cd examples/basic-actor
86
- scrapely push
87
- scrapely run --wait
88
- ```
29
+ await Actor.main(async () => {
30
+ const { startUrls } = await Actor.getInputOrThrow<{ startUrls: string[] }>();
89
31
 
90
- ## 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
+ });
91
38
 
92
- ```bash
93
- npm test # root SDK
94
- cd scrapely-server && npm test
39
+ await crawler.run(startUrls);
40
+ });
95
41
  ```
96
42
 
97
- 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()`.
98
44
 
99
- ## Deploy
45
+ ## What's included
100
46
 
101
- | Command | What it does |
102
- |---------|--------------|
103
- | `npm run prod` | Full production deploy (`scripts/deploy-prod.sh`) |
104
- | `npm run prod:update` | Update-only deploy |
105
- | `npm run setup:server` | Bootstrap a fresh Linux server |
106
- | `npm run setup:gvisor` | Install gVisor on a Linux host |
107
- | `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`
108
56
 
109
- 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
110
58
 
111
- `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
112
62
 
113
- ## Where to look next
63
+ ## License
114
64
 
115
- - [docs/README.md](docs/README.md): documentation index (getting started, SDKs, CLI, webhooks, troubleshooting)
116
- - [scrapely-server/docs/API_ENDPOINTS.md](scrapely-server/docs/API_ENDPOINTS.md): API reference
117
- - [docs/network-architecture.md](docs/network-architecture.md): fleet topology and data path
118
- - `scrapely-server/src/index.ts`: server startup and route wiring
119
- - `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.5",
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": [