From c352884c17d7b213abd84f36662adc5923775dd9 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 30 Jan 2026 15:52:44 -0700 Subject: [PATCH] fix(proxy): collect servers from all locations in WindscribeVPN Previously get_random_server only collected servers from the first location matching a country code. Now it collects from all matching locations before selecting randomly. --- unshackle/core/proxies/windscribevpn.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/unshackle/core/proxies/windscribevpn.py b/unshackle/core/proxies/windscribevpn.py index d48eeea..25d5af0 100644 --- a/unshackle/core/proxies/windscribevpn.py +++ b/unshackle/core/proxies/windscribevpn.py @@ -86,9 +86,11 @@ class WindscribeVPN(Proxy): Returns: A random hostname from matching servers, or None if none available. """ + hostnames = [] + + # Collect hostnames from ALL locations matching the country code for location in self.countries: if location.get("country_code", "").lower() == country_code.lower(): - hostnames = [] for group in location.get("groups", []): # Filter by city if specified if city: @@ -101,14 +103,14 @@ class WindscribeVPN(Proxy): if hostname := host.get("hostname"): hostnames.append(hostname) - if hostnames: - return random.choice(hostnames) - elif city: - # No servers found for the specified city - raise ValueError( - f"No servers found in city '{city}' for country code '{country_code}'. " - "Try a different city or check the city name spelling." - ) + if hostnames: + return random.choice(hostnames) + elif city: + # No servers found for the specified city + raise ValueError( + f"No servers found in city '{city}' for country code '{country_code}'. " + "Try a different city or check the city name spelling." + ) return None