From acdaab15e769dfb75a85a1d802d4810db473fd87 Mon Sep 17 00:00:00 2001 From: OndrejIT Date: Mon, 2 May 2016 20:32:18 +0200 Subject: Improved error... --- module/plugins/hoster/WebshareCz.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py index 4f083b24f..33f2ec7d6 100644 --- a/module/plugins/hoster/WebshareCz.py +++ b/module/plugins/hoster/WebshareCz.py @@ -29,17 +29,19 @@ class WebshareCz(SimpleHoster): @classmethod def api_info(cls, url): info = {} - api = get_url("https://webshare.cz/api/file_info/", + api_data = get_url("https://webshare.cz/api/file_info/", post={'ident': re.match(cls.__pattern__, url).group('ID'), 'wst' : ""}) - if not re.search(r'OK', api): + if re.search(r'OK', api_data): + info['status'] = 2 + info['name'] = re.search(r'(.+?)<', api_data).group(1) + info['size'] = re.search(r'(.+?)<', api_data).group(1) + elif re.search(r'FATAL', api_data): + info['status'] = 1 + else: info['status'] = 8 info['error'] = _("Could not find required xml data") - else: - info['status'] = 2 - info['name'] = re.search(r'(.+?)<', api).group(1) - info['size'] = re.search(r'(.+?)<', api).group(1) return info -- cgit v1.2.3