Last active
October 22, 2022 20:14
-
-
Save a-gu/0896650fab52928a69e49fbd6307adcf to your computer and use it in GitHub Desktop.
Downloads the lateset PaperMC jarfile (using messy gawk JSON "parsing")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
base='https://papermc.io/api/v1/paper' | |
version=$(curl -s $base | gawk 'match($0, /"versions"\s*:\s*\[\s*"([^"]+)/, a) {print a[1]}') | |
build=$(curl -s "${base}/${version}" | awk '{print gensub(/^.+"builds"\s*:\s*{\s*"latest"\s*:\s*"([^"]+)".+$/, "\\1", "g");}') | |
url="${base}/${version}/${build}/download" | |
curl -JLO $url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment