News for hackers. Stuff that matters.
Re:pup: Parsing HTML at the Command Line by turtlebits on Wednesday November 30, 2022 @02:14PM (#33806007)
Will check it out, but would have preferred XPath selectors instead of CSS.
Re:pup: Parsing HTML at the Command Line by wmichelin on Wednesday November 30, 2022 @02:16PM (#33806050)
Why? CSS selectors are the normal web developer way to select content from a document. Even JavaScript adopted the approach.
Re:pup: Parsing HTML at the Command Line by tuukkah on Wednesday November 30, 2022 @03:30PM (#33807188)
XPath supports more complex queries. In JavaScript, XPath is available as document.evaluate
Re:pup: Parsing HTML at the Command Line by undume on Wednesday November 30, 2022 @03:08PM (#33806886)
xmllint can do that:

  curl example.org | xmllint --html --xpath '//some/xpath/selector' -
Re:pup: Parsing HTML at the Command Line by jwilk on Thursday December 01, 2022 @06:32AM (#33814969)
Only if it's good old HTML 4. libxml2's parser doesn't grok HTML 5.
Re:pup: Parsing HTML at the Command Line by BossHogg on Wednesday November 30, 2022 @03:56PM (#33807553)
Re:pup: Parsing HTML at the Command Line by natrys on Wednesday November 30, 2022 @05:22PM (#33808736)
Re:pup: Parsing HTML at the Command Line by curben on Wednesday November 30, 2022 @05:24PM (#33808765)
I'm using xmlstarlet in Alpine as a bare minimum way to scrap a webpage in CI pipeline.
Re:pup: Parsing HTML at the Command Line by ludovicianul on Thursday December 01, 2022 @07:28AM (#33815348)
This has support for both XPath and CSS selectors: https://github.com/ludovicianul/hq