Fork me on GitHub
#babashka
<
2024-01-18
>
steveb8n22:01:55

Q: I want to parse html i.e. not well formed xml. is there something like jsoup that works with bb?

borkdude22:01:48

probably bootleg is your best best: https://github.com/babashka/pod-registry/blob/master/examples/bootleg.clj else I'd go for #nbb + any of the Node.js html libs

steveb8n22:01:36

thanks. I know the answer is always yes 😉

steveb8n22:01:05

I’ll report back if neither option works or with any non-obvious learnings

steveb8n23:01:17

ok. bootleg works but it needs the html on a single line i.e. can’t handle newlines. with a single line it returns hiccup which I can walk

borkdude23:01:45

that sounds weird to me that it doesn't support newlines, but I believe you

borkdude23:01:29

typically html documents contain many newslines right

borkdude23:01:18

perhaps @U1QQJJK89 can add his knowledge about bootleg, I'm 💤 now

steveb8n23:01:11

I have a solution by concat’ing the line-seq so I don’t need more help. providing feedback in case it’s useful for anyone in future

steveb8n23:01:28

sleep well

🙏 1
Omer ZAK23:01:21

I am developing a babashka script which will run under Linux. I would like to let it check if it is running as superuser and alter its behavior accordingly. Is there an elegant way to do it in babashka besides

(= (-> (clojure.java.shell/sh "whoami")
       (:out)
       (clojure.string/trim))
    "root")

1
Nundrum23:01:21

Try (System/getProperty "user.name")

🙌 1
💡 1
Omer ZAK00:01:55

Thanks!

👍 1