A script for getting a Wikipedia article's See also

using MediaWiki Parsing API efficiently

#!/usr/bin/env bash
title="$(echo "$1" | jq -Rr '@uri')"

theseealso="$(curl -s \
"https://en.wikipedia.org/w/api.php?action=parse&page=$title&prop=sections&format=json" |
jq -r '''.parse.sections | map(select(.line == "See also")) |
if isempty(.[]) then "nope" else .[0].index end ''')"

curl -s \
"https://en.wikipedia.org/w/api.php?action=parse&page=$title&section=$theseealso&prop=links&format=json" |
jq -r '''.parse.links | map(select(.exists == "")) | .[] | .["*"] | @uri''' |
{ while IFS= read -r link
  do   # we first convert to uriencoding and then back because that's adaptable
    echo -e "${link//%/\\x}"
  done
}