Small fix
This commit is contained in:
parent
e4a0e7aab6
commit
bbdcbb64b6
@ -289,27 +289,16 @@ class BaseService(ABC):
|
||||
proxy += hostname
|
||||
return proxy + ":89" # https: 89, http: 80
|
||||
|
||||
|
||||
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
|
||||
countries = self.session.get(
|
||||
url="https://nordvpn.com/wp-admin/admin-ajax.php",
|
||||
params={"action": "servers_countries"}
|
||||
).json()
|
||||
|
||||
# Get the Country's NordVPN ID
|
||||
countries = self.session.get("https://api.nordvpn.com/v1/servers/countries").json()
|
||||
country_id = [x["id"] for x in countries if x["code"].lower() == country.lower()]
|
||||
if not country_id:
|
||||
return None
|
||||
country_id = country_id[0]
|
||||
# Get the most recommended server for the country and return it
|
||||
recommendations = self.session.get(
|
||||
url="https://nordvpn.com/wp-admin/admin-ajax.php",
|
||||
params={
|
||||
"action": "servers_recommendations",
|
||||
"filters": json.dumps({"country_id": country_id})
|
||||
}
|
||||
).json()
|
||||
|
||||
# Get the most recommended server for the country and return it
|
||||
recommendations = self.session.get(f"https://api.nordvpn.com/v1/servers/recommendations?filters[country_id]={country_id}").json()
|
||||
return recommendations[0]["hostname"]
|
||||
|
||||
@ -23,7 +23,7 @@ cdm_api:
|
||||
credentials:
|
||||
iTunes: 'username:password'
|
||||
Hotstar: 'username:password'
|
||||
DisneyPlus: 'tjp4252@gmail.com:Tjcooke@121382'
|
||||
DisneyPlus: 'username:password'
|
||||
|
||||
directories:
|
||||
temp: ''
|
||||
|
||||
Loading…
Reference in New Issue
Block a user