summary refs log tree commit diff
diff options
context:
space:
mode:
authorSander <sander@plex.tv>2017-04-23 23:49:41 +0200
committerSergey M․ <dstftw@gmail.com>2017-04-30 18:10:49 +0700
commit13081db1f5e026e8571e4f46758dc947702228f5 (patch)
tree39cde2a08bc7caffc90ae510b652331f8b806dd1
parentb07ea5eaecd6e3ab3a31c996ec815682efaf8edb (diff)
downloadyoutube-dl-13081db1f5e026e8571e4f46758dc947702228f5.tar.gz
youtube-dl-13081db1f5e026e8571e4f46758dc947702228f5.tar.xz
youtube-dl-13081db1f5e026e8571e4f46758dc947702228f5.zip
[xvideos] Add video duration
-rw-r--r--youtube_dl/extractor/xvideos.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/youtube_dl/extractor/xvideos.py b/youtube_dl/extractor/xvideos.py
index 30825daae..ce3a05e41 100644
--- a/youtube_dl/extractor/xvideos.py
+++ b/youtube_dl/extractor/xvideos.py
@@ -8,6 +8,7 @@ from ..utils import (
     clean_html,
     ExtractorError,
     determine_ext,
+    parse_duration,
 )
 
 
@@ -20,6 +21,7 @@ class XVideosIE(InfoExtractor):
             'id': '4588838',
             'ext': 'mp4',
             'title': 'Biker Takes his Girl',
+            'duration': 120,
             'age_limit': 18,
         }
     }
@@ -36,6 +38,8 @@ class XVideosIE(InfoExtractor):
             r'<title>(.*?)\s+-\s+XVID', webpage, 'title')
         video_thumbnail = self._search_regex(
             r'url_bigthumb=(.+?)&amp', webpage, 'thumbnail', fatal=False)
+        video_duration = parse_duration(self._search_regex(
+            r'<span class="duration">.*?(\d[^<]+)', webpage, 'duration', fatal=False))
 
         formats = []
 
@@ -67,6 +71,7 @@ class XVideosIE(InfoExtractor):
             'id': video_id,
             'formats': formats,
             'title': video_title,
+            'duration': video_duration,
             'thumbnail': video_thumbnail,
             'age_limit': 18,
         }