diff --git a/ox/web/siteparser.py b/ox/web/siteparser.py index 6aa9e15..b8b78f8 100644 --- a/ox/web/siteparser.py +++ b/ox/web/siteparser.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # vi:si:et:sw=4:sts=4:ts=4 import re +import json from multiprocessing.pool import ThreadPool from six import string_types @@ -77,6 +78,10 @@ class SiteParser(dict): elif self.regex[key]['type'] == 'date': parse_date = lambda d: d and datetime.strptime('-'.join(d), '%m-%d-%Y').strftime('%Y-%m-%d') data = apply_f(parse_date, data) + elif self.regex[key]['type'] == 'json': + if isinstance(data, list) and len(data) == 1: + data = data[0] + data = json.loads(data) if data: self[key] = data