diff --git a/i3pystatus/weather/weathercom.py b/i3pystatus/weather/weathercom.py index 716bf41c..1e33abfb 100644 --- a/i3pystatus/weather/weathercom.py +++ b/i3pystatus/weather/weathercom.py @@ -70,9 +70,12 @@ def handle_data(self, content): weather_data = None self.logger.debug('Located window.__data') # Strip the "window.__data=" from the beginning and load json - json_data = self.load_json( - content[begin:].split('=', 1)[1].lstrip() - ) + raw_json = content[begin:].split('=', 1)[1].lstrip() + if re.match(r'^JSON\.parse\("', raw_json): + raw_json = re.sub(r'^JSON\.parse\("', '', raw_json) + raw_json = re.sub(r'"\);?$', '', raw_json) + raw_json = raw_json.replace(r'\"', '"').replace(r'\\', '\\') + json_data = self.load_json(raw_json) if json_data is not None: try: weather_data = json_data['dal']