From 84fd839b84779c624a9ca38ddeead97dba7c4ee1 Mon Sep 17 00:00:00 2001 From: Bezleputh Date: Tue, 29 Jul 2014 15:56:52 +0200 Subject: [PATCH] [arte] do not crash if 'VDA' fiels is missing in json --- modules/arte/browser.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/arte/browser.py b/modules/arte/browser.py index 54a62fe8..1e0985bb 100644 --- a/modules/arte/browser.py +++ b/modules/arte/browser.py @@ -182,12 +182,13 @@ class ArteBrowser(BaseBrowser): video.set_empty_fields(NotAvailable, ('url',)) if 'VDE' in item: video.description = u'%s' % item['VDE'] - m = re.match('(\d{2})\s(\d{2})\s(\d{4})(.*?)', item['VDA']) - if m: - dd = int(m.group(1)) - mm = int(m.group(2)) - yyyy = int(m.group(3)) - video.date = datetime.date(yyyy, mm, dd) + if 'VDA' in item: + m = re.match('(\d{2})\s(\d{2})\s(\d{4})(.*?)', item['VDA']) + if m: + dd = int(m.group(1)) + mm = int(m.group(2)) + yyyy = int(m.group(3)) + video.date = datetime.date(yyyy, mm, dd) return video def create_url_plus7(self, class_name, method_name, level, cluster, channel, limit, offset, pattern=None):