I've been building on lol-html and wanted to share what came out of it: grpc-lol-html, a gRPC server that sits directly on the lol-html streaming rewriter.
It'll stream the HTML in over one connection, and matched elements stream back out as the parser finds them. Like the API, one can declare CSS-selector rules up front; the server compiles them once and emits typed events (elements, text, comments, doctype) with source spans as it parses. As a demo I included three demo clients (Java, Node with a live web viewer, Python).
Over a real socket it sustains ~178 MiB/s, faster than building a DOM in the same process, and the bench harness refuses to print numbers unless the wire stream is byte-identical to in-process lol-html.
https://github.com/ai-pipestream/grpc-lol-html
Run it in a minute:
cargo run --release # listens on 0.0.0.0:50051
# or: docker build -t grpc-lol-html . && docker run -p 50051:50051 grpc-lol-html
# then any demo, e.g.:
cd demos/python-client && ./run.sh ../sample-data/cdata_svg.html "a[href]"
# or the web viewer: cd demos/node-client && npm install && npm start
I'll keep enhancing and maintaining it, and if you host it in your main repo, I can move it to a BSD license.
I've been building on lol-html and wanted to share what came out of it: grpc-lol-html, a gRPC server that sits directly on the lol-html streaming rewriter.
It'll stream the HTML in over one connection, and matched elements stream back out as the parser finds them. Like the API, one can declare CSS-selector rules up front; the server compiles them once and emits typed events (elements, text, comments, doctype) with source spans as it parses. As a demo I included three demo clients (Java, Node with a live web viewer, Python).
Over a real socket it sustains ~178 MiB/s, faster than building a DOM in the same process, and the bench harness refuses to print numbers unless the wire stream is byte-identical to in-process lol-html.
https://github.com/ai-pipestream/grpc-lol-html
Run it in a minute:
I'll keep enhancing and maintaining it, and if you host it in your main repo, I can move it to a BSD license.