Skip to content

Instantly share code, notes, and snippets.

@Inndy
Created October 29, 2022 03:59
Show Gist options
  • Save Inndy/30296cd4101bb4ec554523da69ace09c to your computer and use it in GitHub Desktop.
Save Inndy/30296cd4101bb4ec554523da69ace09c to your computer and use it in GitHub Desktop.
#!/bin/bash
s="main>div>div>div>table tr"
curl -s https://flare-on9.ctfd.io/scoreboard |
htmlq "$s :nth-child(1) small, $s :nth-child(2), $s :nth-child(4) span" -t -w |
awk '
BEGIN {
i = -1
n = 0
s = 0
}
/^\s*$/{ next }
{
if (s++ < 2) {
next
}
gsub(/^\s+|\s+$/, "")
i = (i+1)%3
if (i == 0) {
if ($0 ~ /^[0-9]+(st|nd|rd|th)/) {
} else {
printf "QQ{%s}\n", $0
}
} else if (i == 1) {
name = $0
} else if (i == 2) {
if ($0 ~ /^[0-9]+(st|nd|rd|th)/) {
country = ""
i++
} else {
country = $0
}
n++
printf "%s,%s,%s\n", n, name, country
}
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment