Skip to content

Commit 3464e5e

Browse files
committed
update docs
1 parent 067f38a commit 3464e5e

File tree

2 files changed

+39
-46
lines changed

2 files changed

+39
-46
lines changed

docs/config/extensions/lightpanda.mdx

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@ import { lightpanda } from "@trigger.dev/build/extensions/lightpanda";
1717

1818
export default defineConfig({
1919
project: "<project ref>",
20-
// Your other config settings...
2120
build: {
2221
extensions: [lightpanda()],
2322
},
2423
});
2524
```
2625

27-
### Options
26+
## Options
2827

29-
- `version`: The version of the browser to install. Default: `"nightly"`.
28+
- `version`: The version of the browser to install. Default: `"latest"`.
3029
- `disableTelemetry`: Whether to disable telemetry. Default: `false`.
3130

3231
For example:
@@ -48,18 +47,14 @@ export default defineConfig({
4847
});
4948
```
5049

51-
### Environment variables
50+
## Development
5251

53-
The extension sets the following environment variables during the build:
52+
When running in dev, you will first have to download the Lightpanda browser binary and make sure it's in your `PATH`. See [Lightpanda's installation guide](https://lightpanda.io/docs/getting-started/installation).
5453

55-
- `LIGHTPANDA_BROWSER_PATH`: Set to `/usr/bin/lightpanda` so the browser can be found at runtime
54+
## Next steps
5655

57-
#### Development
58-
59-
When running in dev, you will first have to download the Lightpanda browser binary. See [Lightpanda's installation guide](https://lightpanda.io/docs/getting-started/installation).
60-
61-
Then, set the `LIGHTPANDA_BROWSER_PATH` environment variable to the path of the Lightpanda browser binary.
62-
63-
```bash
64-
export LIGHTPANDA_BROWSER_PATH="/usr/local/bin/lightpanda"
65-
```
56+
<CardGroup>
57+
<Card title="Lightpanda" color="#6ac6e2" icon="bolt" href="/guides/examples/lightpanda">
58+
Learn how to use Lightpanda in your project.
59+
</Card>
60+
</CardGroup>

docs/guides/examples/lightpanda.mdx

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: "Get a webpage's content using Lightpanda browser"
2+
title: "Lightpanda"
33
sidebarTitle: "Lightpanda"
4-
description: "In these examples, we will show you how to crawl using Lightpanda browser and Trigger.dev."
4+
description: "These examples demonstrate how to use Lightpanda with Trigger.dev."
55
tag: "v4"
66
---
77

@@ -14,23 +14,26 @@ import UpgradeToV4Note from "/snippets/upgrade-to-v4-note.mdx";
1414

1515
Lightpanda is a purpose-built browser for AI and automation workflows. It is 10x faster, uses 10x less RAM than Chrome headless.
1616

17-
You will find here are a couple of examples of how to use Lightpanda with Trigger.dev.
17+
Here are a few examples of how to use Lightpanda with Trigger.dev.
1818

1919
<ScrapingWarning />
2020

21-
## Prerequisites
21+
## Limitations
2222

23-
- A project with [Trigger.dev initialized](/quick-start)
24-
- A [Lightpanda](https://lightpanda.io/) cloud token (for the 1st example)
23+
- Lightpanda does not support the `puppeteer` screenshot feature.
2524

26-
## Example \#1 - Get links from a website using Lightpanda cloud & Puppeteer
25+
## Using Lightpanda Cloud
2726

28-
In this task, we use Lightpanda browser to get links from a provided URL.
29-
You will have to pass the URL as a payload when triggering the task.
27+
### Prerequisites
28+
29+
- A [Lightpanda](https://lightpanda.io/) cloud token
30+
31+
### Get links from a website
32+
In this task we use Lightpanda browser to get links from a provided URL. You will have to pass the URL as a payload when triggering the task.
3033

31-
Make sure to add `$LIGHTPANDA_TOKEN` to your Trigger.dev dashboard on the Environment Variables page:
34+
Make sure to add `LIGHTPANDA_TOKEN` to your Trigger.dev dashboard on the Environment Variables page:
3235
```bash
33-
LIGHTPANDA_TOKEN: "<your-token>",
36+
LIGHTPANDA_TOKEN="<your-token>"
3437
```
3538

3639
```ts trigger/lightpanda-cloud-puppeteer.ts
@@ -86,30 +89,31 @@ export const lightpandaCloudPuppeteer = task({
8689
},
8790
});
8891
```
92+
8993
### Proxies
9094

9195
Proxies can be used with your browser via the proxy query string parameter. By default, the proxy used is "datacenter" which is a pool of shared datacenter IPs.
92-
`datacenter` accepts an optional `country` query string parameter, an [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code.
93-
94-
_Example using a German IP :_
95-
96-
```wss://cloud.lightpanda.io/ws?proxy=datacenter&country=de&token=TOKEN```
96+
`datacenter` accepts an optional `country` query string parameter which is an [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code.
9797

98+
```bash
99+
# This example will use a German IP
100+
wss://cloud.lightpanda.io/ws?proxy=datacenter&country=de&token=${token}
101+
```
98102

99103
### Session
100-
A session is alive until you close it or the connection is closed. The max time duration of a session is 15 min.
101-
102104

103-
## Example \#2 - Get a webpage using Lightpanda
104-
105-
Using the Lightpanda binary we will dump the HTML for a provided URL.
106-
You will have to pass the URL as a payload when triggering the task.
105+
A session is alive until you close it or the connection is closed. The max duration of a session is 15 minutes.
107106

107+
## Using Lightpanda browser directly
108108

109109
### Prerequisites
110+
110111
- Setup the [Lightpanda build extension](/config/extensions/lightpanda)
111112

112-
### Task
113+
### Get the HTML of a webpage
114+
115+
This task will dump the HTML of a provided URL using the Lightpanda browser binary. You will have to pass the URL as a payload when triggering the task.
116+
113117
```ts trigger/lightpanda-fetch.ts
114118
import { logger, task } from "@trigger.dev/sdk";
115119
import { execSync } from "node:child_process";
@@ -138,15 +142,9 @@ export const lightpandaFetch = task({
138142
});
139143
```
140144

141-
## Example \#3 - Launch and use a Lightpanda CDP server
142-
143-
This task initialises a Lightpanda CDP server to allow you to scrape directly via Trigger.dev.
144-
145-
### Prerequisites
146-
- Setup the [Lightpanda build extension](/config/extensions/lightpanda)
145+
### Lightpanda CDP with Puppeteer
147146

148-
### Task
149-
Your task will have to launch a child process in order to have the websocket available to scrape using Puppeteer.
147+
This task initializes a Lightpanda CDP server and uses it with `puppeteer-core` to scrape a provided URL.
150148

151149
```ts trigger/lightpanda-cdp.ts
152150
import { logger, task } from "@trigger.dev/sdk";

0 commit comments

Comments
 (0)