Live data from Hacker News

Htmlq: like jq, but for html

github.com

11–20 of 172 posts

Re: Htmlq: like jq, but for html

#13
post #7

brilliant. does this spin up a heavy DOM implementation in the background or do something lighter such as regexp?

You can’t parse HTML with regexps. It’s not a regular language.

https://stackoverflow.com/questions/1732348/regex-match-open...

Re: Htmlq: like jq, but for html

#17

Nice! This is the kind of obvious tool that once it exists, you can’t really grok the fact it did not earlier, and that it took until now to exist.

There are already tools for xpath, but using css selectors is much more aligned with what I write every day, so that's nice.

Re: Htmlq: like jq, but for html

#18
post #10

Nice! This is the kind of obvious tool that once it exists, you can’t really grok the fact it did not earlier, and that it took until now to exist.

> grok A good opportunity to introduce `gron` to those unfamiliar! ▶ gron "https://api.github.com/repos/tomnomnom/gron/commits?per_page=1" | fgrep "commit.author" json[0].commit.author = {}; json[0].commit.author.date = "2016-07-02T10:51:21Z"; json[0].commit.author.email = "mail@tomnomnom.com"; json[0].commit.author.name = "Tom Hudson"; https://github.com/tomnomnom/gron

"A good opportunity to introduce `gron` to those unfamiliar!"

Thank you - appreciated.

I haven't done much work with json but have had reasons recently to do so - and I immediately saw how difficult it was to pipeline to grep ...

But what I still don't understand is that some json outputs I see have multiple values with the exact same name (!) and that still seems "un-grep-able" to me ...

What am I missing ?

Re: Htmlq: like jq, but for html

#20

Nice! This is the kind of obvious tool that once it exists, you can’t really grok the fact it did not earlier, and that it took until now to exist.

There are already tools for xpath, but using css selectors is much more aligned with what I write every day, so that's nice.

Yes, and awk and others. I meant something semantically closer to the need, with css selectors.
Post reply on HN