X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=youtube_dl%2Fextractor%2Fvimeo.py;h=bb08c61509e6d68a8661c3d4876cb258e99fa832;hb=a9c2896e2252839c2e4801189f10acce7ff6413e;hp=ec6aad592054a9bcec0000877cb739c232a00eb9;hpb=ca7fa3dcb321f3de429cac9e83fda737ac0be4c9;p=youtube-dl diff --git a/youtube_dl/extractor/vimeo.py b/youtube_dl/extractor/vimeo.py index ec6aad592..bb08c6150 100644 --- a/youtube_dl/extractor/vimeo.py +++ b/youtube_dl/extractor/vimeo.py @@ -8,6 +8,7 @@ import itertools from .common import InfoExtractor from .subtitles import SubtitlesInfoExtractor from ..utils import ( + compat_HTTPError, compat_urllib_parse, compat_urllib_request, clean_html, @@ -101,6 +102,15 @@ class VimeoIE(SubtitlesInfoExtractor): }, ] + @classmethod + def suitable(cls, url): + if VimeoChannelIE.suitable(url): + # Otherwise channel urls like http://vimeo.com/channels/31259 would + # match + return False + else: + return super(VimeoIE, cls).suitable(url) + def _login(self): (username, password) = self._get_login_info() if username is None: @@ -172,7 +182,18 @@ class VimeoIE(SubtitlesInfoExtractor): # Retrieve video webpage to extract further information request = compat_urllib_request.Request(url, None, headers) - webpage = self._download_webpage(request, video_id) + try: + webpage = self._download_webpage(request, video_id) + except ExtractorError as ee: + if isinstance(ee.cause, compat_HTTPError) and ee.cause.code == 403: + errmsg = ee.cause.read() + if b'Because of its privacy settings, this video cannot be played here' in errmsg: + raise ExtractorError( + 'Cannot download embed-only video without embedding ' + 'URL. Please call youtube-dl with the URL of the page ' + 'that embeds this video.', + expected=True) + raise # Now we begin extracting as much information as we can from what we # retrieved. First we extract the information common to all extractors, @@ -220,8 +241,10 @@ class VimeoIE(SubtitlesInfoExtractor): # Extract video thumbnail video_thumbnail = config["video"].get("thumbnail") - if video_thumbnail is None and config["video"].get("thumbs"): - _, video_thumbnail = sorted((int(width), t_url) for (width, t_url) in config["video"]["thumbs"].items())[-1] + if video_thumbnail is None: + video_thumbs = config["video"].get("thumbs") + if video_thumbs and isinstance(video_thumbs, dict): + _, video_thumbnail = sorted((int(width), t_url) for (width, t_url) in video_thumbs.items())[-1] # Extract video description video_description = None @@ -318,7 +341,7 @@ class VimeoIE(SubtitlesInfoExtractor): class VimeoChannelIE(InfoExtractor): IE_NAME = 'vimeo:channel' - _VALID_URL = r'(?:https?://)?vimeo\.com/channels/(?P[^/]+)' + _VALID_URL = r'(?:https?://)?vimeo\.com/channels/(?P[^/]+)/?(\?.*)?$' _MORE_PAGES_INDICATOR = r']+?title="(.*?)"'