Since PIA rotates their servers and only returns a couple of ip's per request you can use this command to grab more ip's if you wish. It will grab more ip's using a for loop and show only the unique ones.
Code:
for i in {1..5}; do curl --silent --retry 3 --connect-timeout 3 --max-time 6 --retry-delay 1 --retry-all-errors https://serverlist.piaservers.net/vpninfo/servers/v6 | jq --raw-output '.regions[] | select(.name=="US New York") | .servers.ovpnudp[].ip' 2>/dev/null; done | sort | uniq
If you want a larger list just increase the number of iterations e.g: change for i in {1..5} to for i in {1..10}
-----------------------------------------------------------------------------------------------
Another tip which can be used to grab and filter ip's is to ping every single ip that is returned before displaying the list of ips with this method you will only get the ip's that are close to your location.
Just add this command at the end of the curl statment.
To set the target ping just change the value here e.g: 'if (a[2] < 200)' 200 = 200ms
This will grab only ip's with less than 200ms ping.
Code:
| while read -r ip; do ping -c 1 -W 1 "$ip" | awk -v ip="$ip" '/time=/{split($7,a,"="); if (a[2] < 200) print ip}'; done
Full Example:
Code:
curl --silent --retry 3 --connect-timeout 3 --max-time 6 --retry-delay 1 --retry-all-errors https://api.nordvpn.com/v1/servers?limit=16354 | jq --raw-output '.[] | select(.locations[0].country.city.name == "New York") | .station' | while read -r ip; do ping -c 1 -W 1 "$ip" | awk -v ip="$ip" '/time=/{split($7,a,"="); if (a[2] < 200) print ip}'; done
Tested on NordVPN and ProtonVPN.