Htmlq: Like Jq, but for HTML(github.com)
github.com
Htmlq: Like Jq, but for HTML
https://github.com/mgdm/htmlq
11 comments
Why not xpath, I just open Chrome Dev tool And click Copy as Xpath
This uses CSS selectors and can be run from the commandline.
[deleted]
Tagsoup + xpath for the win.
Jq is a nice tool, but...
Jq is a nice tool, but...
Nice. I've used Cheerio for this in the past: https://github.com/cheeriojs/cheerio?tab=readme-ov-file#sele...
here's an alternative I've used in the past:
pup
https://github.com/ericchiang/pup
Isn't parsing html not like xml? I recall you need a special and weird algorithm to parse html properly. Was a long time ago though, dunno if that was "fixed".
That's largely correct. HTML5 changed the status quo from "eh, it should be XML but every browser applies its own weird hacks" to "well, the hacks still apply but at least they're defined by the standard now". The proper solution would have been XHTML, but we can't have nice things.
This seems to use html5ever[0], which is a "proper" HTML browser also used by the Servo browser.
[0]: https://github.com/servo/html5ever
This seems to use html5ever[0], which is a "proper" HTML browser also used by the Servo browser.
[0]: https://github.com/servo/html5ever
So there is a rigorous definition of a brain damage parser for HTML.
Where is this defined already? Does it have a name?
That said, I recall clearly how the major browsers did sabotage xhtml, at the time (a decade ago). The middle-ground would be to go xml-like parsing but for html, namely without xml kludge.
Where is this defined already? Does it have a name?
That said, I recall clearly how the major browsers did sabotage xhtml, at the time (a decade ago). The middle-ground would be to go xml-like parsing but for html, namely without xml kludge.
It's part of the HTML standard itself: https://html.spec.whatwg.org/multipage/parsing.html#parsing
yep, that's the right one: completely brain damaged.
I guess if I ever write an HTML parser (noscript), I'll do it xml like.
I guess if I ever write an HTML parser (noscript), I'll do it xml like.
You should’ve called it jq.select it’d be both appropriate and very confusing.
Could be implemented by processing the output of jq
[deleted]
great, now I can stop using regex...
[deleted]