RSS Amplifier

Simon Shine · Dec 4, 2021

Jq Hack 2 Curling the Right Binary on Github

0
Sign in to vote or save

This page cannot be shown here. You can still read it on the original site — the toolbar below keeps your place in the directory.

Something I see quite often is a combination of grep and cut to extract URLs from JSON objects, for example: $ curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest \ | grep browser_download_url \ | cut -d '"' -f 4 \ | grep '\linux-amd64$' \ | wget -i - This is neat because grep and cut are almost always available on Linux. And the approach works for all kinds of plaintext documents…

Something I see quite often is a combination of grep and cut to extract URLs from JSON objects, for example:

$ curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest \
 | grep browser_download_url \
 | cut -d '"' -f 4 \
 | grep '\linux-amd64$' \
 | wget -i -

This is neat because grep and cut are almost always available on Linux. And the approach works for all kinds of plaintext documents with a semi-expectable format, not just JSON, so the approach is worth keeping around. But for JSON in particular, this approach is unnecessarily fragile because of a few unreasonable assumptions:

Read on simonshine.dk

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.