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.
- package/README.md +43 -97
- 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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
13
|
+
```ts
|
|
14
|
+
import { Actor } from 'scrapely';
|
|
72
15
|
|
|
73
|
-
|
|
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
|
-
|
|
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
|
-
|
|
78
|
-
make build-runner
|
|
79
|
-
```
|
|
24
|
+
## Crawling
|
|
80
25
|
|
|
81
|
-
|
|
26
|
+
```ts
|
|
27
|
+
import { Actor, PlaywrightCrawler } from 'scrapely';
|
|
82
28
|
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
cd scrapely-server && npm test
|
|
39
|
+
await crawler.run(startUrls);
|
|
40
|
+
});
|
|
95
41
|
```
|
|
96
42
|
|
|
97
|
-
|
|
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
|
-
##
|
|
45
|
+
## What's included
|
|
100
46
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
57
|
+
## Related packages
|
|
110
58
|
|
|
111
|
-
|
|
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
|
-
##
|
|
63
|
+
## License
|
|
114
64
|
|
|
115
|
-
|
|
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.
|
|
4
|
-
"description": "
|
|
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": [
|