1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-13 15:17:20 +08:00

[ruleporn] fix flake8 warnings (except E501 - line too long)

This commit is contained in:
Andy Savicki 2016-11-22 00:23:00 +03:00
parent 2bed3ee9f8
commit 86bd65df8d

View File

@ -1,10 +1,9 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import re
from .nuevo import NuevoBaseIE from .nuevo import NuevoBaseIE
from ..utils import int_or_none from ..utils import int_or_none
class RulePornIE(NuevoBaseIE): class RulePornIE(NuevoBaseIE):
_VALID_URL = r'https?://(?:www\.)?ruleporn\.com/(?:[^/?#&]+/)*(?P<id>[^/?#&]+)' _VALID_URL = r'https?://(?:www\.)?ruleporn\.com/(?:[^/?#&]+/)*(?P<id>[^/?#&]+)'
_TESTS = [{ _TESTS = [{
@ -18,7 +17,7 @@ class RulePornIE(NuevoBaseIE):
'description': 'md5:6d28be231b981fff1981deaaa03a04d5', 'description': 'md5:6d28be231b981fff1981deaaa03a04d5',
'age_limit': 18, 'age_limit': 18,
'duration': 635.1, 'duration': 635.1,
}, },
}, { }, {
'url': 'http://ruleporn.com/short-sweet-amateur-milf-sex-action/', 'url': 'http://ruleporn.com/short-sweet-amateur-milf-sex-action/',
'md5': '9ec215fe7ecc19323eba42d0f16af054', 'md5': '9ec215fe7ecc19323eba42d0f16af054',
@ -62,7 +61,6 @@ class RulePornIE(NuevoBaseIE):
r'lovehomeporn\.com/embed/(\d+)', video_url, 'video_id', default=None) r'lovehomeporn\.com/embed/(\d+)', video_url, 'video_id', default=None)
if video_id: if video_id:
info = self._extract_nuevo( info = self._extract_nuevo(
'http://lovehomeporn.com/media/nuevo/econfig.php?key=%s&rp=true' % video_id, 'http://lovehomeporn.com/media/nuevo/econfig.php?key=%s&rp=true' % video_id,
video_id) video_id)
@ -72,22 +70,21 @@ class RulePornIE(NuevoBaseIE):
'title': title, 'title': title,
'description': description, 'description': description,
'age_limit': 18 'age_limit': 18
}) })
else: else:
video_page = self._download_webpage(video_url, display_id) video_page = self._download_webpage(video_url, display_id)
js_str = self._search_regex( js_str = self._search_regex(
r'var\s+item\s+=\s+({.+(?=};)});', video_page, 'js_str') r'var\s+item\s+=\s+({.+(?=};)});', video_page, 'js_str')
js_obj = self._parse_json(js_str, display_id) js_obj = self._parse_json(js_str, display_id)
video_id = '%s' % js_obj.get('id') video_id = '%s' % js_obj.get('id')
duration = int_or_none(js_obj.get('video_duration')) duration = int_or_none(js_obj.get('video_duration'))
thumbnail = js_obj.get('url_thumb') thumbnail = js_obj.get('url_thumb')
formats = [] formats = []
for element_name, format_id in (('url_mp4_lowres', 'ld'), ('url_mp4', 'sd'), ('url_orig', 'hd')): for element_name, format_id in (('url_mp4_lowres', 'ld'), ('url_mp4', 'sd'), ('url_orig', 'hd')):
video_url = js_obj.get(element_name) video_url = js_obj.get(element_name)
formats.append({ formats.append({
@ -95,7 +92,7 @@ class RulePornIE(NuevoBaseIE):
'format_id': format_id 'format_id': format_id
}) })
self._check_formats(formats, video_id) self._check_formats(formats, video_id)
info = { info = {
'id': video_id, 'id': video_id,
'display_id': display_id, 'display_id': display_id,