diff options
author | Sergey M․ <dstftw@gmail.com> | 2016-03-21 22:07:34 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2016-03-21 22:07:34 +0600 |
commit | 065c4b27bfc4488758b357e023e9b6b1679c9641 (patch) | |
tree | ae965b8ed84528ac98aeb5a836ca5adeb9e9edb7 | |
parent | 1600ed1ff9edb33ef901bda2c4b2732df7e0e4e7 (diff) |
[xhamster:embed] Extract vars (Closes #8912)
-rw-r--r-- | youtube_dl/extractor/xhamster.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/youtube_dl/extractor/xhamster.py b/youtube_dl/extractor/xhamster.py index fd43e8854..b3547174d 100644 --- a/youtube_dl/extractor/xhamster.py +++ b/youtube_dl/extractor/xhamster.py @@ -4,6 +4,7 @@ import re from .common import InfoExtractor from ..utils import ( + dict_get, float_or_none, int_or_none, unified_strdate, @@ -170,6 +171,12 @@ class XHamsterEmbedIE(InfoExtractor): video_url = self._search_regex( r'href="(https?://xhamster\.com/movies/%s/[^"]+\.html[^"]*)"' % video_id, - webpage, 'xhamster url') + webpage, 'xhamster url', default=None) + + if not video_url: + vars = self._parse_json( + self._search_regex(r'vars\s*:\s*({.+?})\s*,\s*\n', webpage, 'vars'), + video_id) + video_url = dict_get(vars, ('downloadLink', 'homepageLink', 'commentsLink', 'shareUrl')) return self.url_result(video_url, 'XHamster') |