From 531572578e542fcee26f1a30fd9f87ad158e6594 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Mon, 2 Feb 2015 23:04:39 +0100 Subject: [normalboots] Modernize --- youtube_dl/extractor/normalboots.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/youtube_dl/extractor/normalboots.py b/youtube_dl/extractor/normalboots.py index c13ff0d65..78e75266f 100644 --- a/youtube_dl/extractor/normalboots.py +++ b/youtube_dl/extractor/normalboots.py @@ -11,7 +11,7 @@ from ..utils import ( class NormalbootsIE(InfoExtractor): - _VALID_URL = r'http://(?:www\.)?normalboots\.com/video/(?P[0-9a-z-]*)/?$' + _VALID_URL = r'http://(?:www\.)?normalboots\.com/video/(?P[0-9a-z-]*)/?$' _TEST = { 'url': 'http://normalboots.com/video/home-alone-games-jontron/', 'md5': '8bf6de238915dd501105b44ef5f1e0f6', @@ -30,19 +30,22 @@ class NormalbootsIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) - video_id = mobj.group('videoid') - + video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - video_uploader = self._html_search_regex(r'Posted\sby\s(?P[A-Za-z]*)\s', - webpage, 'uploader') - raw_upload_date = self._html_search_regex('[A-Za-z]+, (?P.*)', - webpage, 'date') - video_upload_date = unified_strdate(raw_upload_date) - player_url = self._html_search_regex(r'[\S]+)"', webpage, 'url') + video_uploader = self._html_search_regex( + r'Posted\sby\s(?P[A-Za-z]*)\s', + webpage, 'uploader', fatal=False) + video_upload_date = unified_strdate(self._html_search_regex( + r'[A-Za-z]+, (?P.*)', + webpage, 'date', fatal=False)) + + player_url = self._html_search_regex( + r'[\S]+)"', + webpage, 'player url') player_page = self._download_webpage(player_url, video_id) - video_url = self._html_search_regex(r"file:\s'(?P[^']+\.mp4)'", player_page, 'file') + video_url = self._html_search_regex( + r"file:\s'(?P[^']+\.mp4)'", player_page, 'file') return { 'id': video_id, -- cgit v1.2.3