]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/pornhub.py
[extractor] Deprecate `_sort_formats`
[yt-dlp.git] / yt_dlp / extractor / pornhub.py
index 35468b4fc801f7577fae6565b2663bd471365f1a..5d8d7c100a4d40109f4f682c401ddec35a865619 100644 (file)
@@ -128,6 +128,7 @@ class PornHubIE(PornHubBaseIE):
                         )
                         (?P<id>[\da-z]+)
                     ''' % PornHubBaseIE._PORNHUB_HOST_RE
+    _EMBED_REGEX = [r'<iframe[^>]+?src=["\'](?P<url>(?:https?:)?//(?:www\.)?pornhub(?:premium)?\.(?:com|net|org)/embed/[\da-z]+)']
     _TESTS = [{
         'url': 'http://www.pornhub.com/view_video.php?viewkey=648719015',
         'md5': 'a6391306d050e4547f62b3f485dd9ba9',
@@ -257,12 +258,6 @@ class PornHubIE(PornHubBaseIE):
         'only_matching': True,
     }]
 
-    @staticmethod
-    def _extract_urls(webpage):
-        return re.findall(
-            r'<iframe[^>]+?src=["\'](?P<url>(?:https?:)?//(?:www\.)?pornhub(?:premium)?\.(?:com|net|org)/embed/[\da-z]+)',
-            webpage)
-
     def _extract_count(self, pattern, webpage, name):
         return str_to_int(self._search_regex(pattern, webpage, '%s count' % name, default=None))
 
@@ -461,10 +456,6 @@ def add_format(format_url, height=None):
                 continue
             add_format(video_url)
 
-        # field_preference is unnecessary here, but kept for code-similarity with youtube-dl
-        self._sort_formats(
-            formats, field_preference=('height', 'width', 'fps', 'format_id'))
-
         model_profile = self._search_json(
             r'var\s+MODEL_PROFILE\s*=', webpage, 'model profile', video_id, fatal=False)
         video_uploader = self._html_search_regex(