diff --git a/README.rst b/README.rst
index b6af89e..c31c8a9 100644
--- a/README.rst
+++ b/README.rst
@@ -120,8 +120,18 @@ branch
An environment variable ``NVCHECKER_GITHUB_TOKEN`` can be set to a GitHub OAuth token in order to request more frequently than anonymously.
+Check BitBucket
+---------------
+Check `BitBucket `_ for updates. The version returned is in date format ``%Y%m%d``, e.g. ``20130701``.
+
+bitbucket
+ The bitbucket repository, with author, e.g. ``lilydjwg/dotvim``.
+
+branch
+ Which branch to track? Default is the repository's default.
+
Check GitCafe
-------------
+-------------
Check `GitCafe `_ for updates. The version returned is in date format ``%Y%m%d``, e.g. ``20130701``.
gitcafe
diff --git a/nvchecker/get_version.py b/nvchecker/get_version.py
index 88f78d1..472d93f 100644
--- a/nvchecker/get_version.py
+++ b/nvchecker/get_version.py
@@ -4,7 +4,7 @@ from importlib import import_module
logger = logging.getLogger(__name__)
handler_precedence = (
'github', 'gitcafe', 'aur', 'pypi', 'archpkg', 'gems', 'pacman',
- 'cmd', 'gcode_hg', 'gcode_svn', 'regex', 'manual', 'vcs'
+ 'cmd', 'bitbucket', 'gcode_hg', 'gcode_svn', 'regex', 'manual', 'vcs',
)
def get_version(name, conf, callback):
diff --git a/nvchecker/source/bitbucket.py b/nvchecker/source/bitbucket.py
new file mode 100644
index 0000000..7124927
--- /dev/null
+++ b/nvchecker/source/bitbucket.py
@@ -0,0 +1,21 @@
+import os
+import json
+from functools import partial
+
+from tornado.httpclient import AsyncHTTPClient, HTTPRequest
+
+# doc: https://confluence.atlassian.com/display/BITBUCKET/commits+or+commit+Resource
+BITBUCKET_URL = 'https://bitbucket.org/api/2.0/repositories/%s/commits/%s'
+
+def get_version(name, conf, callback):
+ repo = conf.get('bitbucket')
+ br = conf.get('branch', '')
+ url = BITBUCKET_URL % (repo, br)
+ request = HTTPRequest(url, user_agent='lilydjwg/nvchecker')
+ AsyncHTTPClient().fetch(request,
+ callback=partial(_bitbucket_done, name, callback))
+
+def _bitbucket_done(name, callback, res):
+ data = json.loads(res.body.decode('utf-8'))
+ version = data['values'][0]['date'].split('T', 1)[0].replace('-', '')
+ callback(name, version)