Small fix

This commit is contained in:
chu23465 2025-04-29 08:29:00 +05:30
parent e4a0e7aab6
commit bbdcbb64b6
2 changed files with 8 additions and 19 deletions

View File

@ -289,27 +289,16 @@ class BaseService(ABC):
proxy += hostname proxy += hostname
return proxy + ":89" # https: 89, http: 80 return proxy + ":89" # https: 89, http: 80
def get_nordvpn_server(self, country): def get_nordvpn_server(self, country):
"""
Get the recommended NordVPN server hostname for a specified Country.
:param country: Country (in alpha 2 format, e.g. 'US' for United States)
:returns: Recommended NordVPN server hostname, e.g. `us123.nordvpn.com`
"""
# Get the Country's NordVPN ID # Get the Country's NordVPN ID
countries = self.session.get( countries = self.session.get("https://api.nordvpn.com/v1/servers/countries").json()
url="https://nordvpn.com/wp-admin/admin-ajax.php",
params={"action": "servers_countries"}
).json()
country_id = [x["id"] for x in countries if x["code"].lower() == country.lower()] country_id = [x["id"] for x in countries if x["code"].lower() == country.lower()]
if not country_id: if not country_id:
return None return None
country_id = country_id[0] country_id = country_id[0]
# Get the most recommended server for the country and return it # Get the most recommended server for the country and return it
recommendations = self.session.get( recommendations = self.session.get(f"https://api.nordvpn.com/v1/servers/recommendations?filters[country_id]={country_id}").json()
url="https://nordvpn.com/wp-admin/admin-ajax.php",
params={
"action": "servers_recommendations",
"filters": json.dumps({"country_id": country_id})
}
).json()
return recommendations[0]["hostname"] return recommendations[0]["hostname"]

View File

@ -23,7 +23,7 @@ cdm_api:
credentials: credentials:
iTunes: 'username:password' iTunes: 'username:password'
Hotstar: 'username:password' Hotstar: 'username:password'
DisneyPlus: 'tjp4252@gmail.com:Tjcooke@121382' DisneyPlus: 'username:password'
directories: directories:
temp: '' temp: ''