projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d0d93f7
)
[pornhd] Improve formats extraction
author
Sergey M․
<dstftw@gmail.com>
Fri, 17 Jun 2016 22:37:53 +0000
(
05:37
+0700)
committer
Sergey M․
<dstftw@gmail.com>
Fri, 17 Jun 2016 22:37:53 +0000
(
05:37
+0700)
youtube_dl/extractor/pornhd.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/pornhd.py
b/youtube_dl/extractor/pornhd.py
index 33faf5e583df034aa33c2b47ebcf1683b8ddef0f..e7721b0138ec76653eb0862ff2fc034df2a346d7 100644
(file)
--- 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,
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)
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 = []
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
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,
formats.append({
'url': video_url,
- 'format_id':
qname
,
- '
quality': quality(qname)
,
+ 'format_id':
format_id
,
+ '
height': height
,
})
self._sort_formats(formats)
})
self._sort_formats(formats)