diff --git a/pcomfortcloud/authentication.py b/pcomfortcloud/authentication.py index 4cb764e..62682f1 100644 --- a/pcomfortcloud/authentication.py +++ b/pcomfortcloud/authentication.py @@ -7,6 +7,7 @@ import time import urllib import requests +import re from bs4 import BeautifulSoup from . import exceptions @@ -437,12 +438,11 @@ def _update_app_version(self): if self._raw: print("--- auto detecting latest app version") try: - response = requests.get(constants.APPBRAIN_URL) - responseContent = response.content - soup = BeautifulSoup(responseContent, "html.parser") - meta_tag = soup.find("meta", itemprop="softwareVersion") - if meta_tag is not None: - version = meta_tag['content'] + response = requests.get("https://play.google.com/store/apps/details?id=com.panasonic.ACCsmart") + responseText = response.content.decode("utf-8") + version_match = re.search(r'\[\"(\d+\.\d+\.\d+)\"\]', responseText) + if version_match: + version = version_match.group(1) self._app_version = version if self._raw: print("--- found version: {}".format(self._app_version)) @@ -450,7 +450,7 @@ def _update_app_version(self): else: self._app_version = constants.X_APP_VERSION if self._raw: - print("--- Error finding meta_tag") + print("--- error finding version") return except Exception: diff --git a/pcomfortcloud/constants.py b/pcomfortcloud/constants.py index f8a6180..e4f69c9 100644 --- a/pcomfortcloud/constants.py +++ b/pcomfortcloud/constants.py @@ -6,7 +6,6 @@ BASE_PATH_AUTH = "https://authglb.digital.panasonic.com" BASE_PATH_ACC = "https://accsmart.panasonic.com" X_APP_VERSION = "1.22.0" -APPBRAIN_URL = "https://www.appbrain.com/app/panasonic-comfort-cloud/com.panasonic.ACCsmart" class Power(Enum): Off = 0