Overview
Lightpanda is a purpose-built browser for AI and automation workflows. It is 10x faster, uses 10x less RAM than Chrome headless. Here are a few examples of how to use Lightpanda with Trigger.dev.WEB SCRAPING: When web scraping, you MUST use a proxy to comply with our terms of service. Direct scraping of third-party websites without the site owner’s permission using Trigger.dev Cloud is prohibited and will result in account suspension. See this example which uses a proxy.
Limitations
- Lightpanda does not support the
puppeteer
screenshot feature.
Using Lightpanda Cloud
Prerequisites
- A Lightpanda cloud token
Get links from a website
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. Make sure to addLIGHTPANDA_TOKEN
to your Trigger.dev dashboard on the Environment Variables page:
trigger/lightpanda-cloud-puppeteer.ts
Proxies
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.datacenter
accepts an optional country
query string parameter which is an ISO 3166-1 alpha-2 country code.
Session
A session is alive until you close it or the connection is closed. The max duration of a session is 15 minutes.Using Lightpanda browser directly
Prerequisites
- Setup the Lightpanda build extension
Get the HTML of a webpage
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.trigger/lightpanda-fetch.ts
Lightpanda CDP with Puppeteer
This task initializes a Lightpanda CDP server and uses it withpuppeteer-core
to scrape a provided URL.
trigger/lightpanda-cdp.ts