diff options
author | Sergey M․ <dstftw@gmail.com> | 2021-06-21 03:22:37 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2021-06-21 03:22:37 +0700 |
commit | da32828208743c8012c8eea01780cbf9b3f60436 (patch) | |
tree | 136730dfe66996e83cc7a8cbf0d3b9f16a57b293 | |
parent | 2ccee8db74c36eb1254cdffd4e691e56c0ce0724 (diff) |
[pornhub] Dismiss tbr extracted from download URLs (closes #28927)
No longer reliable
-rw-r--r-- | youtube_dl/extractor/pornhub.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/youtube_dl/extractor/pornhub.py b/youtube_dl/extractor/pornhub.py index 031454600..10516ee5a 100644 --- a/youtube_dl/extractor/pornhub.py +++ b/youtube_dl/extractor/pornhub.py @@ -408,17 +408,14 @@ class PornHubIE(PornHubBaseIE): format_url, video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls', fatal=False)) return - tbr = None - mobj = re.search(r'(?P<height>\d+)[pP]?_(?P<tbr>\d+)[kK]', format_url) - if mobj: - if not height: - height = int(mobj.group('height')) - tbr = int(mobj.group('tbr')) + if not height: + height = int_or_none(self._search_regex( + r'(?P<height>\d+)[pP]?_\d+[kK]', format_url, 'height', + default=None)) formats.append({ 'url': format_url, 'format_id': '%dp' % height if height else None, 'height': height, - 'tbr': tbr, }) for video_url, height in video_urls: @@ -440,7 +437,8 @@ class PornHubIE(PornHubBaseIE): add_format(video_url, height) continue add_format(video_url) - self._sort_formats(formats) + self._sort_formats( + formats, field_preference=('height', 'width', 'fps', 'format_id')) video_uploader = self._html_search_regex( r'(?s)From: .+?<(?:a\b[^>]+\bhref=["\']/(?:(?:user|channel)s|model|pornstar)/|span\b[^>]+\bclass=["\']username)[^>]+>(.+?)<', |