]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/xfileshare.py
[extractor] Deprecate `_sort_formats`
[yt-dlp.git] / yt_dlp / extractor / xfileshare.py
index 63abe4a1f4e8e6387bf83519ad04b2f4802a708b..08c6d6c7c01f153ba37454a2da0020f8bea49382 100644 (file)
@@ -61,6 +61,7 @@ class XFileShareIE(InfoExtractor):
     IE_DESC = 'XFileShare based sites: %s' % ', '.join(list(zip(*_SITES))[1])
     _VALID_URL = (r'https?://(?:www\.)?(?P<host>%s)/(?:embed-)?(?P<id>[0-9a-zA-Z]+)'
                   % '|'.join(site for site in list(zip(*_SITES))[0]))
+    _EMBED_REGEX = [r'<iframe\b[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//(?:%s)/embed-[0-9a-zA-Z]+.*?)\1' % '|'.join(site for site in list(zip(*_SITES))[0])]
 
     _FILE_NOT_FOUND_REGEXES = (
         r'>(?:404 - )?File Not Found<',
@@ -68,6 +69,15 @@ class XFileShareIE(InfoExtractor):
     )
 
     _TESTS = [{
+        'url': 'https://uqload.com/dltx1wztngdz',
+        'md5': '3cfbb65e4c90e93d7b37bcb65a595557',
+        'info_dict': {
+            'id': 'dltx1wztngdz',
+            'ext': 'mp4',
+            'title': 'Rick Astley Never Gonna Give You mp4',
+            'thumbnail': r're:https://.*\.jpg'
+        }
+    }, {
         'url': 'http://xvideosharing.com/fq65f94nd2ve',
         'md5': '4181f63957e8fe90ac836fa58dc3c8a6',
         'info_dict': {
@@ -84,15 +94,6 @@ class XFileShareIE(InfoExtractor):
         'only_matching': True,
     }]
 
-    @staticmethod
-    def _extract_urls(webpage):
-        return [
-            mobj.group('url')
-            for mobj in re.finditer(
-                r'<iframe\b[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//(?:%s)/embed-[0-9a-zA-Z]+.*?)\1'
-                % '|'.join(site for site in list(zip(*XFileShareIE._SITES))[0]),
-                webpage)]
-
     def _real_extract(self, url):
         host, video_id = self._match_valid_url(url).groups()
 
@@ -181,7 +182,6 @@ def _real_extract(self, url):
                         'url': video_url,
                         'format_id': 'sd',
                     })
-        self._sort_formats(formats)
 
         thumbnail = self._search_regex(
             [
@@ -194,4 +194,5 @@ def _real_extract(self, url):
             'title': title,
             'thumbnail': thumbnail,
             'formats': formats,
+            'http_headers': {'Referer': url}
         }