You are not logged in.
Pages: 1
Hi,
I try to get three value from json output :
curl -sH 'Snap-Device-Series: 16' http://api.snapcraft.io/v2/snaps/info/spotify | jq -r '.[] | .[] | select(.channel.name == "edge") | .download."sha3-384", .download.url, .version'
a6ed06cd37b20b54ef7fb31b91f01a26c89231388529f6b3eab717a8fc299252949760af8668e47179ef592a9a14a2f7
https://api.snapcraft.io/api/v1/snaps/download/pOBIoZ2LrCB3rDohMxoYGnbN14EHOgD7_62.snap
1.1.99.878.g1e4ccc6e
jq: error (at <stdin>:1): Cannot iterate over null (null)
As you can see, I have this error jq: error (at <stdin>:1): Cannot iterate over null (null).
The only way I found to avoid it, it is to add 2>/dev/null like this :
curl -sH 'Snap-Device-Series: 16' http://api.snapcraft.io/v2/snaps/info/spotify | jq -r '.[] | .[] | select(.channel.name == "edge") | .download."sha3-384", .download.url, .version' 2>/dev/null
a6ed06cd37b20b54ef7fb31b91f01a26c89231388529f6b3eab717a8fc299252949760af8668e47179ef592a9a14a2f7
https://api.snapcraft.io/api/v1/snaps/download/pOBIoZ2LrCB3rDohMxoYGnbN14EHOgD7_62.snap
1.1.99.878.g1e4ccc6e
But may be, do you have a better solution, more clean ?
Thank you so much
Last edited by SupKurtJ (2022-12-16 14:02:39)
Offline
try this:
curl -sH 'Snap-Device-Series: 16' http://api.snapcraft.io/v2/snaps/info/spotify \
| jq -r '."channel-map"[] | select(.channel.name == "edge") | .download."sha3-384", .download.url, .version'
a6ed06cd37b20b54ef7fb31b91f01a26c89231388529f6b3eab717a8fc299252949760af8668e47179ef592a9a14a2f7
https://api.snapcraft.io/api/v1/snaps/download/pOBIoZ2LrCB3rDohMxoYGnbN14EHOgD7_62.snap
1.1.99.878.g1e4ccc6e
Offline
Oh thanks !!!
It work
Offline
try this:
curl -sH 'Snap-Device-Series: 16' http://api.snapcraft.io/v2/snaps/info/spotify \ | jq -r '."channel-map"[] | select(.channel.name == "edge") | .download."sha3-384", .download.url, .version' a6ed06cd37b20b54ef7fb31b91f01a26c89231388529f6b3eab717a8fc299252949760af8668e47179ef592a9a14a2f7 https://api.snapcraft.io/api/v1/snaps/download/pOBIoZ2LrCB3rDohMxoYGnbN14EHOgD7_62.snap 1.1.99.878.g1e4ccc6e
Thank You
Layanan Aplikasi Sisko Terbaik | Aplikasi Ujian Online
Offline
try this:
curl -sH 'Snap-Device-Series: 16' http://api.snapcraft.io/v2/snaps/info/spotify \ | jq -r '."channel-map"[] | select(.channel.name == "edge") | .download."sha3-384", .download.url, .version' a6ed06cd37b20b54ef7fb31b91f01a26c89231388529f6b3eab717a8fc299252949760af8668e47179ef592a9a14a2f7 https://api.snapcraft.io/api/v1/snaps/download/pOBIoZ2LrCB3rDohMxoYGnbN14EHOgD7_62.snap 1.1.99.878.g1e4ccc6e
Nice..thank You
Layanan Hosting Indonesia Terbaik | Hosting Terbaik Indonesia
Offline
Pages: 1