[pornhub] Fix review issues (closes #27393)
This commit is contained in:
parent
b57b27ff8f
commit
17e0f41d34
1 changed files with 11 additions and 11 deletions
|
@ -288,15 +288,13 @@ class PornHubIE(PornHubBaseIE):
|
||||||
video_urls.append((v_url, None))
|
video_urls.append((v_url, None))
|
||||||
video_urls_set.add(v_url)
|
video_urls_set.add(v_url)
|
||||||
|
|
||||||
def parse_quality_items(js_str):
|
def parse_quality_items(quality_items):
|
||||||
if (url_or_none(js_str)):
|
q_items = self._parse_json(quality_items, video_id, fatal=False)
|
||||||
return js_str
|
if not isinstance(q_items, list):
|
||||||
media_definitions = self._parse_json(js_str, video_id, fatal=False)
|
return
|
||||||
if isinstance(media_definitions, list):
|
for item in q_items:
|
||||||
for definition in media_definitions:
|
if isinstance(item, dict):
|
||||||
if not isinstance(definition, dict):
|
add_video_url(item.get('url'))
|
||||||
continue
|
|
||||||
add_video_url(definition.get('url'))
|
|
||||||
|
|
||||||
if not video_urls:
|
if not video_urls:
|
||||||
FORMAT_PREFIXES = ('media', 'quality', 'qualityItems')
|
FORMAT_PREFIXES = ('media', 'quality', 'qualityItems')
|
||||||
|
@ -305,8 +303,10 @@ class PornHubIE(PornHubBaseIE):
|
||||||
default=None)
|
default=None)
|
||||||
if js_vars:
|
if js_vars:
|
||||||
for key, format_url in js_vars.items():
|
for key, format_url in js_vars.items():
|
||||||
if any(key.startswith(p) for p in FORMAT_PREFIXES):
|
if key.startswith(FORMAT_PREFIXES[-1]):
|
||||||
add_video_url(parse_quality_items(format_url))
|
parse_quality_items(format_url)
|
||||||
|
elif any(key.startswith(p) for p in FORMAT_PREFIXES[:2]):
|
||||||
|
add_video_url(format_url)
|
||||||
if not video_urls and re.search(
|
if not video_urls and re.search(
|
||||||
r'<[^>]+\bid=["\']lockedPlayer', webpage):
|
r'<[^>]+\bid=["\']lockedPlayer', webpage):
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
|
|
Loading…
Reference in a new issue