aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-04-30 18:11:29 +0700
committerSergey M․ <dstftw@gmail.com>2017-04-30 18:14:01 +0700
commit6ec371cd9e49eb3acf352e9211f05c3d1de72161 (patch)
treeef329178c623d0d04952c31d2eebf14ad029c7df /youtube_dl/extractor
parent13081db1f5e026e8571e4f46758dc947702228f5 (diff)
[xvideos] Extract og:duration (closes #12828)
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/xvideos.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/youtube_dl/extractor/xvideos.py b/youtube_dl/extractor/xvideos.py
index ce3a05e41..eca603028 100644
--- a/youtube_dl/extractor/xvideos.py
+++ b/youtube_dl/extractor/xvideos.py
@@ -6,8 +6,9 @@ from .common import InfoExtractor
from ..compat import compat_urllib_parse_unquote
from ..utils import (
clean_html,
- ExtractorError,
determine_ext,
+ ExtractorError,
+ int_or_none,
parse_duration,
)
@@ -21,7 +22,7 @@ class XVideosIE(InfoExtractor):
'id': '4588838',
'ext': 'mp4',
'title': 'Biker Takes his Girl',
- 'duration': 120,
+ 'duration': 108,
'age_limit': 18,
}
}
@@ -38,8 +39,11 @@ 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))
+ video_duration = int_or_none(self._og_search_property(
+ 'duration', webpage, default=None)) or parse_duration(
+ self._search_regex(
+ r'<span[^>]+class=["\']duration["\'][^>]*>.*?(\d[^<]+)',
+ webpage, 'duration', fatal=False))
formats = []