[ruleporn] Add requested changes for pull request #11207

This commit is contained in:
Andy Savicki 2016-11-17 03:13:20 +03:00
parent b1a0ada143
commit b3af4c2787

View File

@ -3,6 +3,7 @@ from __future__ import unicode_literals
import re
from .nuevo import NuevoBaseIE
from ..utils import int_or_none
class RulePornIE(NuevoBaseIE):
_VALID_URL = r'https?://(?:www\.)?ruleporn\.com/(?:[^/?#&]+/)*(?P<id>[^/?#&]+)'
@ -57,11 +58,11 @@ class RulePornIE(NuevoBaseIE):
video_url = self._search_regex(
r'<div\s+id=\"player\">\s+<iframe[\w\W]+?(?:src=[\"\']?(?P<url>[^\"\' ]+))', webpage, 'video url')
mobj = re.search(r'lovehomeporn\.com/embed/(\d+)', video_url)
video_id = self._search_regex(
r'lovehomeporn\.com/embed/(\d+)', video_url, 'video_id', default=None)
if mobj:
if video_id:
video_id = mobj.group(1)
info = self._extract_nuevo(
'http://lovehomeporn.com/media/nuevo/econfig.php?key=%s&rp=true' % video_id,
video_id)
@ -78,13 +79,13 @@ class RulePornIE(NuevoBaseIE):
video_page = self._download_webpage(video_url, display_id)
js_str = self._search_regex(
r'<script\s+type=\"text/javascript\">\s+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)
video_id = '%s' % js_obj.get("id")
duration = js_obj.get("video_duration")
thumbnail = js_obj.get("url_thumb")
video_id = '%s' % js_obj.get('id')
duration = int_or_none(js_obj.get('video_duration'))
thumbnail = js_obj.get('url_thumb')
formats = []
for element_name, format_id in (('url_mp4_lowres', 'ld'), ('url_mp4', 'sd'), ('url_orig', 'hd')):