lol-html
xidel
Our great sponsors
lol-html | xidel | |
---|---|---|
8 | 18 | |
1,390 | 651 | |
1.9% | - | |
5.7 | 5.6 | |
about 1 month ago | 7 days ago | |
Rust | Pascal | |
BSD 3-clause "New" or "Revised" License | GNU General Public License v3.0 only |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
lol-html
-
Ask HN: A fast, Rust HTML parser that works?
So I'm doing some web scraping in Rust, and so I will need to parse HTML. [scraper](https://docs.rs/scraper/latest/scraper/) (which uses [html5ever](https://github.com/servo/html5ever)) is doing fine except that it's the bottleneck of my application.
So I need a faster parser. I've tried [tl](https://docs.rs/tl/latest/tl/) which would've been perfect except that it doesn't actually work on the HTML I have. When I try to `query_selector` the elements I need, it returns nothing.
[Kuchiki](https://docs.rs/kuchiki/latest/kuchiki/) is abandonded.
I couldn't figure out how to get [lol-html](https://github.com/cloudflare/lol-html) to work for me (it's designed for re-writing HTML, whatever that means). It doesn't seem to have an API to extract the inner text of an element.
[html5gum](https://github.com/untitaker/html5gum) seems to be just an HTML tokenizer, or otherwise just too low-level. I have not yet tried [quick-xml](https://github.com/tafia/quick-xml/) but judging from the README, it's pretty low-level too. I mean, if these are the only options left then I will try them. Otherwise, I would love to use a parser that's faster but as ergonomic as `scraper` or `tl`.
At this point, I would be happy with an Lxml bridge/port of some sort. I don't need to mutate HTML, just parse and read data from it.
-
How much Rust work is actually going on at Cloudflare?
I'm also in the Workers org but I have had a bit of interaction with Rust. There's some Rust in the Workers runtime using lol-html for HTMLRewriter as well as some tooling and there's the full blown workers-rs framework that I work on, but that's about it for the Rust I work on regularly.
- Is there a library for manipulating HTML?
- pup: Parsing HTML at the Command Line
-
Texting Robots: Taming robots.txt with Rust and 34 million tests
Thanks again and happy to answer any questions! My current unreleased Rust projects include a web crawler that uses Tokio + Tokio Console + Reqwest with this crate for robots.txt and a fast text extraction library using lol-html that I am planning to sprinkle with some minimal ML to get Readability.js style intelligent extraction (with training in Python). See Fathom for an example of the ML approach I'll likely take.
-
Like JQ, but for HTML
I’d like to see a tool using lol-html [0] and their CSS selector API as a streaming HTML editor.
[0] https://github.com/cloudflare/lol-html
- Things you can’t do in Rust (and what to do instead)
-
Problems with building a backend app in Rust in 2020
Cloudflare has open sourced lol-html, a "Low output latency streaming HTML parser/rewriter with CSS selector-based API". Is that what you are looking for?
xidel
-
Move over jq I found something easier: fx
You could try Xidel[1]. It supports JSON, XML and HTML using XPath/XQuery 3.1
It has some extensions to the standard that are pretty nice (JSONiq, CSS selectors, html “template” matching), but you can limit it to just standard XPath/XQuery if you like.
I recommend getting the nightly v .99 build if you give it a try, the stable .98 version is pretty old and I’ve had no issues with .99
1. https://www.videlibri.de/xidel.html
-
Batch Win Installer - from a defined list of software, BWI will install software on 64 bit Windows 10/11 x64 machine without prompts ; check what software is installed and offer to install and/or upgrade software and scan program's websites to determine the latest version of the software available
Windows binary of Xidel (https://github.com/benibela/xidel) a commandline tool to download and extract data from HTML pages
- pup: Parsing HTML at the Command Line
- Remove white spaces from last column of CSV
-
What's the best tool to build pipelines from REST APIs?
Xidel for extraction and pagination
-
What are your coolest tools for one-liners ?
Download an entire subreddit to JSON Lines with Xidel:
-
Fetch data from XML
I believe that you can't read from a url with batch alone. you'll need a helper app like xidel https://www.videlibri.de/xidel.html
-
Tutorial: Rapid Script Development with Bash, JC, and JQ (no grep/sed/awk)
I have not played with this, but it looks like xidel might allow you to do this in Bash. jc also has a URL string parser that could be used in such a script.
- Xidel. A tool to query data from anything on the web and extract what you want
-
How to make http request with curl on certain page after being authenticated?
I built Xidel for such authenticated requests:
What are some alternatives?
actor-rust-scraper - Experimental scraper in Rust suited for running locally or on the Apify platform. Inspired by Apify SDK.
jq - Command-line JSON processor [Moved to: https://github.com/jqlang/jq]
tq - Perform a lookup by CSS selector on an HTML input
tools - all-in collection of productivity scripts, CLI tools, utility libraries, fuse filesystems, and also some stuff
yq - Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents
pup - Parsing HTML at the command line
gron - Make JSON greppable!
hq - lightweight command line HTML processor using CSS and XPath selectors
cargo-expand - Subcommand to show result of macro expansion
xmltodict - Python module that makes working with XML feel like you are working with JSON