[prosiebensat1] Simplify

This commit is contained in:
Sergey M․ 2014-05-05 19:02:49 +07:00
parent 4de9e9a6db
commit fcf5b01746
1 changed files with 5 additions and 17 deletions

View File

@ -8,8 +8,6 @@ from .common import InfoExtractor
from ..utils import ( from ..utils import (
compat_urllib_parse, compat_urllib_parse,
unified_strdate, unified_strdate,
clean_html,
RegexNotFoundError,
) )
@ -188,16 +186,7 @@ class ProSiebenSat1IE(InfoExtractor):
page = self._download_webpage(url, video_id, 'Downloading page') page = self._download_webpage(url, video_id, 'Downloading page')
def extract(patterns, name, page, fatal=False): clip_id = self._html_search_regex(self._CLIPID_REGEXES, page, 'clip id')
for pattern in patterns:
mobj = re.search(pattern, page)
if mobj:
return clean_html(mobj.group(1))
if fatal:
raise RegexNotFoundError(u'Unable to extract %s' % name)
return None
clip_id = extract(self._CLIPID_REGEXES, 'clip id', page, fatal=True)
access_token = 'testclient' access_token = 'testclient'
client_name = 'kolibri-1.2.5' client_name = 'kolibri-1.2.5'
@ -246,13 +235,12 @@ class ProSiebenSat1IE(InfoExtractor):
urls = self._download_json(url_api_url, clip_id, 'Downloading urls JSON') urls = self._download_json(url_api_url, clip_id, 'Downloading urls JSON')
title = extract(self._TITLE_REGEXES, 'title', page, fatal=True) title = self._html_search_regex(self._TITLE_REGEXES, page, 'title')
description = extract(self._DESCRIPTION_REGEXES, 'description', page) description = self._html_search_regex(self._DESCRIPTION_REGEXES, page, 'description', fatal=False)
thumbnail = self._og_search_thumbnail(page) thumbnail = self._og_search_thumbnail(page)
upload_date = extract(self._UPLOAD_DATE_REGEXES, 'upload date', page) upload_date = unified_strdate(self._html_search_regex(
if upload_date: self._UPLOAD_DATE_REGEXES, page, 'upload date', fatal=False))
upload_date = unified_strdate(upload_date)
formats = [] formats = []