Skip to content

Commit 24c5bf9

Browse files
Merge pull request #429 from lightpanda-io/adjust-readme
readme: update download instructions + improve CDP example
2 parents d8fae5b + cdcc5e1 commit 24c5bf9

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,23 @@
77
<p align="center"><a href="https://lightpanda.io/">lightpanda.io</a></p>
88

99
<div align="center">
10-
11-
[![Commit Activity](https://img.shields.io/github/commit-activity/m/lightpanda-io/browser)](https://github.com/lightpanda-io/browser/commits/main)
1210
[![License](https://img.shields.io/github/license/lightpanda-io/browser)](https://github.com/lightpanda-io/browser/blob/main/LICENSE)
1311
[![Twitter Follow](https://img.shields.io/twitter/follow/lightpanda_io)](https://twitter.com/lightpanda_io)
1412
[![GitHub stars](https://img.shields.io/github/stars/lightpanda-io/browser)](https://github.com/lightpanda-io/browser)
1513

1614
</div>
1715

18-
<div align="center">
19-
20-
<a href="https://trendshift.io/repositories/12815" target="_blank"><img src="https://trendshift.io/api/badge/repositories/12815" alt="lightpanda-io%2Fbrowser | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
21-
22-
</div>
23-
2416
Lightpanda is the open-source browser made for headless usage:
2517

2618
- Javascript execution
2719
- Support of Web APIs (partial, WIP)
2820
- Compatible with Playwright, Puppeteer through CDP (WIP)
2921

30-
Fast web automation for AI agents, LLM training, scraping and testing with minimal memory footprint:
22+
Fast web automation for AI agents, LLM training, scraping and testing:
3123

3224
- Ultra-low memory footprint (9x less than Chrome)
33-
- Exceptionally fast execution (11x faster than Chrome) & instant startup
25+
- Exceptionally fast execution (11x faster than Chrome)
26+
- Instant startup
3427

3528
<img width=500px src="https://cdn.lightpanda.io/assets/images/benchmark_2024-12-04.png">
3629

@@ -44,29 +37,24 @@ You can download the last binary from the [nightly
4437
builds](https://github.com/lightpanda-io/browser/releases/tag/nightly) for
4538
Linux x86_64 and MacOS aarch64.
4639

40+
*For linux*
41+
```console
42+
curl -L -o lightpanda https://github.com/lightpanda-io/browser/releases/download/nightly/lightpanda-x86_64-linux && \
43+
chmod a+x ./lightpanda
44+
```
45+
46+
*For MacOS*
4747
```console
48-
# Download the binary
49-
$ wget https://github.com/lightpanda-io/browser/releases/download/nightly/lightpanda-x86_64-linux
50-
$ chmod a+x ./lightpanda-x86_64-linux
51-
$ ./lightpanda-x86_64-linux -h
52-
usage: ./lightpanda-x86_64-linux [options] [URL]
53-
54-
start Lightpanda browser
55-
56-
* if an url is provided the browser will fetch the page and exit
57-
* otherwhise the browser starts a CDP server
58-
59-
-h, --help Print this help message and exit.
60-
--host Host of the CDP server (default "127.0.0.1")
61-
--port Port of the CDP server (default "9222")
62-
--timeout Timeout for incoming connections of the CDP server (in seconds, default "3")
63-
--dump Dump document in stdout (fetch mode only)
48+
curl -L -o lightpanda https://github.com/lightpanda-io/browser/releases/download/nightly/lightpanda-aarch64-macos && \
49+
chmod a+x ./lightpanda
6450
```
6551

6652
### Dump an URL
6753

6854
```console
69-
$ ./lightpanda-x86_64-linux --dump https://lightpanda.io
55+
./lightpanda --dump https://lightpanda.io
56+
```
57+
```console
7058
info(browser): GET https://lightpanda.io/ http.Status.ok
7159
info(browser): fetch script https://api.website.lightpanda.io/js/script.js: http.Status.ok
7260
info(browser): eval remote https://api.website.lightpanda.io/js/script.js: TypeError: Cannot read properties of undefined (reading 'pushState')
@@ -76,7 +64,9 @@ info(browser): eval remote https://api.website.lightpanda.io/js/script.js: TypeE
7664
### Start a CDP server
7765

7866
```console
79-
$ ./lightpanda-x86_64-linux --host 127.0.0.1 --port 9222
67+
./lightpanda --host 127.0.0.1 --port 9222
68+
```
69+
```console
8070
info(websocket): starting blocking worker to listen on 127.0.0.1:9222
8171
info(server): accepting new conn...
8272
```
@@ -98,10 +88,20 @@ const browser = await puppeteer.connect({
9888
const context = await browser.createBrowserContext();
9989
const page = await context.newPage();
10090

91+
// Dump all the links from the page.
10192
await page.goto('https://wikipedia.com/');
10293

94+
const links = await page.evaluate(() => {
95+
return Array.from(document.querySelectorAll('a')).map(row => {
96+
return row.getAttribute('href');
97+
});
98+
});
99+
100+
console.log(links);
101+
103102
await page.close();
104103
await context.close();
104+
await browser.disconnect();
105105
```
106106

107107
## Build from sources

0 commit comments

Comments
 (0)