diff options
author | Remita Amine <remitamine@gmail.com> | 2018-09-15 06:30:57 +0100 |
---|---|---|
committer | Remita Amine <remitamine@gmail.com> | 2018-09-15 06:31:15 +0100 |
commit | 8b40c92724453995701b75559b190075d6dbfd7d (patch) | |
tree | 98b328ddb599ebff7db4e1ec5e37e4e3ee599de3 | |
parent | 3661ebf2b6e0cb951dca5b4498a1d6885cbf7b56 (diff) |
[vimeo] redirect to feature url only in the case of a trailer(closes #14591)
-rw-r--r-- | youtube_dl/extractor/vimeo.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/youtube_dl/extractor/vimeo.py b/youtube_dl/extractor/vimeo.py index 95d368cc1..0a9239b62 100644 --- a/youtube_dl/extractor/vimeo.py +++ b/youtube_dl/extractor/vimeo.py @@ -571,19 +571,23 @@ class VimeoIE(VimeoBaseInfoExtractor): if config.get('view') == 4: config = self._verify_player_video_password(redirect_url, video_id) + vod = config.get('video', {}).get('vod', {}) + def is_rented(): if '>You rented this title.<' in webpage: return True if config.get('user', {}).get('purchased'): return True - label = try_get( - config, lambda x: x['video']['vod']['purchase_options'][0]['label_string'], compat_str) - if label and label.startswith('You rented this'): - return True + for purchase_option in vod.get('purchase_options', []): + if purchase_option.get('purchased'): + return True + label = purchase_option.get('label_string') + if label and (label.startswith('You rented this') or label.endswith(' remaining')): + return True return False - if is_rented(): - feature_id = config.get('video', {}).get('vod', {}).get('feature_id') + if is_rented() and vod.get('is_trailer'): + feature_id = vod.get('feature_id') if feature_id and not data.get('force_feature_id', False): return self.url_result(smuggle_url( 'https://player.vimeo.com/player/%s' % feature_id, |