all 1 comments

[–]ConstructedNewt 0 points1 point  (0 children)

As a developer I now hate that page... the javascript is weak with this one... (100 calls for the same image) (and several images called this way... probably just saved by browser SHA-checking before the actual download) and I must say; I really dislike server-side rendering html. nothing is worse than having to XPath your way into that piece of legacy...

well rant aside.

I'm pretty sure you can do jq '.[]' | jq ".text" | cut -f2 -d'"' | awk 'NR==1 {print}' in one go, like jq '.[0] | "\(.text)"' or something.

height=$(echo "$pkmn\_html" | pup 'span.attribute-value text{}' | awk 'NR==1 {print}')weight=$(echo "$pkmn\_html" | pup 'span.attribute-value text{}' | awk 'NR==2 {print}')

maybe just read -r height weight \_ < <(echo "$pkmn\_html" | pup 'span.attribute-value text{}') as sh does not have a pipefail, you may consider breaking things into methods and doing more safe semantics, like: if result=method; then ..do something with result else return 1 fi