X-Git-Url: https://git.rapsys.eu/youtubedl/blobdiff_plain/6d835d4d6903cf5e18ad01844736929e06d16004..d018d3313032e12968a6add6800e51d412e2f602:/youtube_dl/extractor/pornhd.py
diff --git a/youtube_dl/extractor/pornhd.py b/youtube_dl/extractor/pornhd.py
index bac484c..57c78ba 100644
--- a/youtube_dl/extractor/pornhd.py
+++ b/youtube_dl/extractor/pornhd.py
@@ -8,7 +8,6 @@ from ..utils import (
int_or_none,
js_to_json,
qualities,
- determine_ext,
)
@@ -37,7 +36,8 @@ class PornHdIE(InfoExtractor):
webpage = self._download_webpage(url, display_id or video_id)
title = self._html_search_regex(
- r'
(.+) porn HD.+?', webpage, 'title')
+ [r']+class=["\']video-name["\'][^>]*>([^<]+)',
+ r'(.+?) - .*?[Pp]ornHD.*?'], webpage, 'title')
description = self._html_search_regex(
r'([^<]+)
', webpage, 'description', fatal=False)
view_count = int_or_none(self._html_search_regex(
@@ -45,13 +45,19 @@ class PornHdIE(InfoExtractor):
thumbnail = self._search_regex(
r"'poster'\s*:\s*'([^']+)'", webpage, 'thumbnail', fatal=False)
- quality = qualities(['SD', 'HD'])
- formats = [{
- 'url': source['file'],
- 'format_id': '%s-%s' % (source['label'], determine_ext(source['file'])),
- 'quality': quality(source['label']),
- } for source in json.loads(js_to_json(self._search_regex(
- r"(?s)'sources'\s*:\s*(\[.+?\])", webpage, 'sources')))]
+ quality = qualities(['sd', 'hd'])
+ sources = json.loads(js_to_json(self._search_regex(
+ r"(?s)'sources'\s*:\s*(\{.+?\})\s*\}[;,)]",
+ webpage, 'sources')))
+ formats = []
+ for qname, video_url in sources.items():
+ if not video_url:
+ continue
+ formats.append({
+ 'url': video_url,
+ 'format_id': qname,
+ 'quality': quality(qname),
+ })
self._sort_formats(formats)
return {