[arte] do not crash if 'VDA' fiels is missing in json

This commit is contained in:
Bezleputh 2014-07-29 15:56:52 +02:00
commit 84fd839b84

View file

@ -182,12 +182,13 @@ class ArteBrowser(BaseBrowser):
video.set_empty_fields(NotAvailable, ('url',)) video.set_empty_fields(NotAvailable, ('url',))
if 'VDE' in item: if 'VDE' in item:
video.description = u'%s' % item['VDE'] video.description = u'%s' % item['VDE']
m = re.match('(\d{2})\s(\d{2})\s(\d{4})(.*?)', item['VDA']) if 'VDA' in item:
if m: m = re.match('(\d{2})\s(\d{2})\s(\d{4})(.*?)', item['VDA'])
dd = int(m.group(1)) if m:
mm = int(m.group(2)) dd = int(m.group(1))
yyyy = int(m.group(3)) mm = int(m.group(2))
video.date = datetime.date(yyyy, mm, dd) yyyy = int(m.group(3))
video.date = datetime.date(yyyy, mm, dd)
return video return video
def create_url_plus7(self, class_name, method_name, level, cluster, channel, limit, offset, pattern=None): def create_url_plus7(self, class_name, method_name, level, cluster, channel, limit, offset, pattern=None):