dotfiles

Obligatory dotfiles repo
git clone git://git.danielmoch.com/dotfiles.git
Log | Files | Refs

commit 63ff93b831c40de3353a3139f97dcb48f0864012
parent c8182af75a80d4cadde870704f1af071eb95b2ee
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Thu,  1 Aug 2019 18:04:58 -0400

urlwatch: Add gitlabtag hook

Diffstat:
M.config/urlwatch/hooks.py | 17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)

diff --git a/.config/urlwatch/hooks.py b/.config/urlwatch/hooks.py @@ -97,6 +97,23 @@ def filter(self, data, subfilter=None): fallback = soup.select('div.site') return '\n'.join([str(tag) for tag in fallback]) +class GitLabTagFilter(filters.FilterBase): + """Search for new Github releases or tags""" + __kind__ = 'gitlabtag' + + def filter(self, data, subfilter=None): + soup = BeautifulSoup(data, "html5lib") + + releases = soup.select('a.ref-name') + + if releases: + results = [rel.text for rel in releases] + return '\n'.join(results) + + else: + fallback = soup.select('div.site') + return '\n'.join([str(tag) for tag in fallback]) + class PyPIFilter(filters.FilterBase): """Search for new releases at pypi.python.org""" __kind__ = 'pypi'