From 4b5fe1349f5568f3b9b939520db0a1ddc598b4b3 Mon Sep 17 00:00:00 2001 From: Slava Shklyaev Date: Tue, 2 Jun 2015 18:15:05 +0300 Subject: [PATCH] [nova] Comply with review --- youtube_dl/extractor/nova.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/youtube_dl/extractor/nova.py b/youtube_dl/extractor/nova.py index 10957e5fa..4a2d76506 100644 --- a/youtube_dl/extractor/nova.py +++ b/youtube_dl/extractor/nova.py @@ -4,7 +4,11 @@ from __future__ import unicode_literals import re from .common import InfoExtractor -from ..utils import clean_html, determine_ext +from ..utils import ( + clean_html, + determine_ext, + unified_strdate, +) class NovaIE(InfoExtractor): @@ -143,14 +147,12 @@ class NovaIE(InfoExtractor): description = clean_html(self._og_search_description(webpage, default=None)) thumbnail = config.get('poster') - mobj = None if site == 'novaplus': - mobj = re.search(r'(?P\d{1,2})-(?P\d{1,2})-(?P\d{4})$', display_id) - if site == 'fanda': - mobj = re.search( - r'(?P\d{1,2})\.(?P\d{1,2})\.(?P\d{4})\b', webpage) - if mobj: - upload_date = '{}{:02d}{:02d}'.format(mobj.group('year'), int(mobj.group('month')), int(mobj.group('day'))) + upload_date = unified_strdate(self._search_regex( + r'(\d{1,2}-\d{1,2}-\d{4})$', display_id, 'upload date', default=None)) + elif site == 'fanda': + upload_date = unified_strdate(self._search_regex( + r'(\d{1,2}\.\d{1,2}\.\d{4})', webpage, 'upload date', default=None)) else: upload_date = None