[tvnoe] PEP8 and coding style

This commit is contained in:
Yen Chi Hsuan 2016-09-05 13:37:36 +08:00
parent 78e762d23c
commit 9127e1533d
No known key found for this signature in database
GPG key ID: 3FDDD575826C5C30

View file

@ -2,7 +2,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .jwplatform import JWPlatformBaseIE from .jwplatform import JWPlatformBaseIE
from ..utils import clean_html, get_element_by_class, js_to_json from ..utils import (
clean_html,
get_element_by_class,
js_to_json,
)
class TVNoeIE(JWPlatformBaseIE): class TVNoeIE(JWPlatformBaseIE):
@ -14,8 +18,7 @@ class TVNoeIE(JWPlatformBaseIE):
'id': '10362', 'id': '10362',
'ext': 'mp4', 'ext': 'mp4',
'series': 'Noční univerzita', 'series': 'Noční univerzita',
'title': 'prof. Tomáš Halík, Th.D. - ' + 'title': 'prof. Tomáš Halík, Th.D. - Návrat náboženství a střet civilizací',
'Návrat náboženství a střet civilizací',
'description': 'md5:f337bae384e1a531a52c55ebc50fff41', 'description': 'md5:f337bae384e1a531a52c55ebc50fff41',
} }
} }
@ -24,21 +27,23 @@ def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
iframe_url = self._search_regex(r'<iframe[^>]+src="([^"]+)"', iframe_url = self._search_regex(
webpage, 'iframe src attribute') r'<iframe[^>]+src="([^"]+)"', webpage, 'iframe URL')
ifs_page = self._download_webpage(iframe_url, video_id) ifs_page = self._download_webpage(iframe_url, video_id)
jwplayer_data = self._parse_json(self._find_jwplayer_data(ifs_page), jwplayer_data = self._parse_json(
video_id, transform_source=js_to_json) self._find_jwplayer_data(ifs_page),
video_id, transform_source=js_to_json)
info_dict = self._parse_jwplayer_data( info_dict = self._parse_jwplayer_data(
jwplayer_data, video_id, require_title=False, base_url=iframe_url) jwplayer_data, video_id, require_title=False, base_url=iframe_url)
info_dict.update({ info_dict.update({
'id': video_id, 'id': video_id,
'title': clean_html( 'title': clean_html(get_element_by_class(
get_element_by_class('field-name-field-podnazev', webpage)), 'field-name-field-podnazev', webpage)),
'description': clean_html(get_element_by_class('field-name-body', 'description': clean_html(get_element_by_class(
webpage)), 'field-name-body', webpage)),
'series': clean_html(get_element_by_class('title', webpage)) 'series': clean_html(get_element_by_class('title', webpage))
}) })
return info_dict return info_dict