diff --git a/youtube-dl b/youtube-dl
index 3ac27a857..87681e49b 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -7,6 +7,7 @@
# Author: Witold Baryluk
# Author: Paweł Paprota
# Author: Gergely Imreh
+# Author: Amaury Gauthier
# License: Public domain code
import cookielib
import ctypes
@@ -1719,6 +1720,97 @@ class YahooIE(InfoExtractor):
except UnavailableVideoError:
self._downloader.trouble(u'\nERROR: unable to download video')
+class VimeoIE(InfoExtractor):
+ """Information extractor for Vimeo"""
+
+ _VALID_URL = r'(?:http://)?(?:www\.)?vimeo\.com/(\d+)'
+ _VIDEO_INFO = 'http://vimeo.com/moogaloop/load/clip:'
+ _VIDEO_URL = 'http://vimeo.com/moogaloop/play/clip:%s/%s/%s/?q=sd'
+
+ def __init__(self, downloader=None):
+ InfoExtractor.__init__(self, downloader)
+
+ @staticmethod
+ def suitable(url):
+ return (re.match(VimeoIE._VALID_URL, url) is not None)
+
+ def report_download_webpage(self, video_id):
+ """Report webpage download."""
+ self._downloader.to_screen(u'[vimeo] %s: Downloading video information' % video_id)
+
+ def report_extraction(self, video_id):
+ """Report information extraction."""
+ self._downloader.to_screen(u'[vimeo] %s: Extracting information' % video_id)
+
+ def _real_initialize(self):
+ return
+
+ def _real_extract(self, url, new_video=True):
+ # Extract ID from URL
+ mobj = re.match(self._VALID_URL, url)
+ if mobj is None:
+ self._downloader.trouble(u'ERROR: Invalid URL: %s' % url)
+ return
+
+ # At this point we have a new video
+ self._downloader.increment_downloads()
+ video_id = mobj.group(1)
+
+ # Retrieve video webpage to extract further information
+ request = urllib2.Request(self._VIDEO_INFO+video_id)
+ try:
+ self.report_download_webpage(self._VIDEO_INFO+video_id)
+ webpage = urllib2.urlopen(request).read()
+ except (urllib2.URLError, httplib.HTTPException, socket.error), err:
+ self._downloader.trouble(u'ERROR: Unable to retrieve video webpage: %s' % str(err))
+ return
+
+ self.report_extraction(self._VIDEO_INFO+video_id)
+ # Extract credentials
+ mobj = re.search(r'