diff --git a/modules/vimeo/pages.py b/modules/vimeo/pages.py index 1b1940ec6bbcfc010d8102e0c67b642bea5e90b9..5f76f346d93a05ca2e903098157930df619fff1a 100644 --- a/modules/vimeo/pages.py +++ b/modules/vimeo/pages.py @@ -80,7 +80,7 @@ def set_details(self, v): # Else fall back to the API if data is None: # for the rest, use the JSON config descriptor - json_data = self.browser.openurl('http://%s/config/%s?type=%s&referrer=%s' % ("player.vimeo.com", int(v.id), "html5_desktop_local", "")) + json_data = self.browser.openurl('http://%s/video/%s/config?type=%s&referrer=%s' % ("player.vimeo.com", int(v.id), "html5_desktop_local", "")) data = json.load(json_data) if data is None: @@ -98,30 +98,17 @@ def set_details(self, v): # use highest quality possible quality = 'sd' codec = None - if 'vp6' in data['video']['files']: + if 'vp6' in data['request']['files']: codec = 'vp6' - if 'vp8' in data['video']['files']: + if 'vp8' in data['request']['files']: codec = 'vp8' - if 'h264' in data['video']['files']: + if 'h264' in data['request']['files']: codec = 'h264' if not codec: raise BrokenPageError('Unable to detect available codec for id: %r' % int(v.id)) - if 'hd' in data['video']['files'][codec]: + if 'hd' in data['request']['files'][codec]: quality = 'hd' - v.url = unicode("http://player.vimeo.com/play_redirect?quality=%s&codecs=%s&clip_id=%d&time=%s&sig=%s&type=html5_desktop_local" % (quality, codec, int(v.id), data['request']['timestamp'], data['request']['signature'])) - - # attempt to determine the redirected URL to pass it instead - # since the target server doesn't check for User-Agent, unlike - # for the source one. - # HACK: we use mechanize directly here for now... FIXME - #print "asking for redirect on '%s'" % (v.url) - self.browser.set_handle_redirect(False) - try: - self.browser.open_novisit(v.url) - except HTTPError as e: - if e.getcode() == 302 and hasattr(e, 'hdrs'): - #print e.hdrs['Location'] - v.url = unicode(e.hdrs['Location']) - self.browser.set_handle_redirect(True) + v.url = data['request']['files'][codec][quality]['url'] + return v