summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2019-04-07 02:58:40 +0700
committerSergey M․ <dstftw@gmail.com>2019-04-07 02:59:09 +0700
commitf4da80803619aea52bb116f6191f78e1bd77d2c7 (patch)
tree003284388d06e14575779c1469e82ead943b2d9d
parentf412970164c349bea81bfd9d95e56fec7d16c8a1 (diff)
downloadyoutube-dl-f4da80803619aea52bb116f6191f78e1bd77d2c7.tar.gz
youtube-dl-f4da80803619aea52bb116f6191f78e1bd77d2c7.tar.xz
youtube-dl-f4da80803619aea52bb116f6191f78e1bd77d2c7.zip
[xvideos] Extract all thumbnails (closes #20432)
-rw-r--r--youtube_dl/extractor/xvideos.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/youtube_dl/extractor/xvideos.py b/youtube_dl/extractor/xvideos.py
index ec2d913fc..166bcf443 100644
--- a/youtube_dl/extractor/xvideos.py
+++ b/youtube_dl/extractor/xvideos.py
@@ -57,10 +57,17 @@ class XVideosIE(InfoExtractor):
             webpage, 'title', default=None,
             group='title') or self._og_search_title(webpage)
 
-        thumbnail = self._search_regex(
-            (r'setThumbUrl\(\s*(["\'])(?P<thumbnail>(?:(?!\1).)+)\1',
-             r'url_bigthumb=(?P<thumbnail>.+?)&amp'),
-            webpage, 'thumbnail', fatal=False, group='thumbnail')
+        thumbnails = []
+        for preference, thumbnail in enumerate(('', '169')):
+            thumbnail_url = self._search_regex(
+                r'setThumbUrl%s\(\s*(["\'])(?P<thumbnail>(?:(?!\1).)+)\1' % thumbnail,
+                webpage, 'thumbnail', default=None, group='thumbnail')
+            if thumbnail_url:
+                thumbnails.append({
+                    'url': thumbnail_url,
+                    'preference': preference,
+                })
+
         duration = int_or_none(self._og_search_property(
             'duration', webpage, default=None)) or parse_duration(
             self._search_regex(
@@ -98,6 +105,6 @@ class XVideosIE(InfoExtractor):
             'formats': formats,
             'title': title,
             'duration': duration,
-            'thumbnail': thumbnail,
+            'thumbnails': thumbnails,
             'age_limit': 18,
         }