summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSergey M․ <[email protected]>2016-06-18 05:37:53 +0700
committerSergey M․ <[email protected]>2016-06-18 05:37:53 +0700
commite6fe993c318738fee5a4a2ce7a86c4512e42653a (patch)
tree165a97492aed7f848c0fa436be1ff52fb64fb516
parentd0d93f76ea0dd1dae15bdba6059815d9cc467b05 (diff)
downloadyoutube-dl-e6fe993c318738fee5a4a2ce7a86c4512e42653a.tar.gz
youtube-dl-e6fe993c318738fee5a4a2ce7a86c4512e42653a.zip
[pornhd] Improve formats extraction
-rw-r--r--youtube_dl/extractor/pornhd.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/youtube_dl/extractor/pornhd.py b/youtube_dl/extractor/pornhd.py
index 33faf5e58..e7721b013 100644
--- a/youtube_dl/extractor/pornhd.py
+++ b/youtube_dl/extractor/pornhd.py
@@ -7,7 +7,6 @@ from .common import InfoExtractor
from ..utils import (
int_or_none,
js_to_json,
- qualities,
)
@@ -46,18 +45,19 @@ class PornHdIE(InfoExtractor):
thumbnail = self._search_regex(
r"'poster'\s*:\s*'([^']+)'", webpage, 'thumbnail', fatal=False)
- 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():
+ for format_id, video_url in sources.items():
if not video_url:
continue
+ height = int_or_none(self._search_regex(
+ r'^(\d+)[pP]', format_id, 'height', default=None))
formats.append({
'url': video_url,
- 'format_id': qname,
- 'quality': quality(qname),
+ 'format_id': format_id,
+ 'height': height,
})
self._sort_formats(formats)