# Buggy code
def _verify_video_password(self, url, video_id, webpage):
    password = self._downloader.params.get("videopassword", None)
    if password is None:
        raise ExtractorError(
            "This video is protected by a password, use the --video-password option",
            expected=True,
        )
    token = self._search_regex(r"xsrft: \'(.*?)\'", webpage, "login token")
    data = compat_urllib_parse.urlencode(
        {
            "password": password,
            "token": token,
        }
    )
    # I didn't manage to use the password with https
    if url.startswith("https"):
        pass_url = url.replace("https", "http")
    else:
        pass_url = url
    password_request = compat_urllib_request.Request(pass_url + "/password", data)
    password_request.add_header("Content-Type", "application/x-www-form-urlencoded")
    password_request.add_header("Cookie", "xsrft=%s" % token)
    return self._download_webpage(
        password_request, video_id, "Verifying the password", "Wrong password"
    )


# Traceback (RegexNotFoundError)
benjaminmikiten@benjaminmikiten ~/Dropbox/printing_vids $ youtube-dl --batch-file batch.txt --video-password dcp2015 -v
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['--batch-file', 'batch.txt', '--video-password', u'PRIVATE', '-v']
[debug] Batch file urls: [u'https://vimeo.com/118076403', u'https://vimeo.com/118062456', u'https://vimeo.com/118072708', u'https://vimeo.com/118079046', u'https://vimeo.com/118080059', u'https://vimeo.com/118081777', u'https://vimeo.com/118085658', u'https://vimeo.com/118073801', u'https://vimeo.com/118086390', u'https://vimeo.com/118092186', u'https://vimeo.com/118092776']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2015.02.19.3
[debug] Python version 2.7.6 - Darwin-14.1.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 2.5.4, ffprobe 2.5.4
[debug] Proxy map: {}
[vimeo] 118076403: Downloading webpage
[vimeo] 118076403: Extracting information
[vimeo] 118076403: Verifying the password
[vimeo] 118076403: Downloading webpage
[vimeo] 118076403: Extracting information
ERROR: video password verification failed!; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
File "/usr/local/bin/youtube-dl/youtube_dl/extractor/vimeo.py", line 264, in _real_extract
flags=re.DOTALL)
File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 531, in _search_regex
raise RegexNotFoundError('Unable to extract %s' % _name)
RegexNotFoundError: Unable to extract info section; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 643, in extract_info
ie_result = ie.extract(url)
File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 269, in extract
return self._real_extract(url)
File "/usr/local/bin/youtube-dl/youtube_dl/extractor/vimeo.py", line 275, in _real_extract
smuggle_url(url, {'_video_password_verified': 'verified'}))
File "/usr/local/bin/youtube-dl/youtube_dl/extractor/vimeo.py", line 272, in _real_extract
raise ExtractorError('video password verification failed!')
ExtractorError: video password verification failed!; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

# Fixed code
def _verify_video_password(self, url, video_id, webpage):
    password = self._downloader.params.get("videopassword", None)
    if password is None:
        raise ExtractorError(
            "This video is protected by a password, use the --video-password option",
            expected=True,
        )
    token = self._search_regex(r"xsrft = \'(.*?)\'", webpage, "login token")
    data = urlencode_postdata(
        {
            "password": password,
            "token": token,
        }
    )
    if url.startswith("http://"):
        # vimeo only supports https now, but the user can give an http url
        url = url.replace("http://", "https://")
    password_request = compat_urllib_request.Request(url + "/password", data)
    password_request.add_header("Content-Type", "application/x-www-form-urlencoded")
    password_request.add_header("Cookie", "xsrft=%s" % token)
    return self._download_webpage(
        password_request, video_id, "Verifying the password", "Wrong password"
    )