mirror of
https://github.com/vimagick/dockerfiles.git
synced 2025-02-03 13:21:49 +02:00
add urlwatch
This commit is contained in:
parent
f80a52ef0d
commit
e3a195db3b
30
urlwatch/Dockerfile
Normal file
30
urlwatch/Dockerfile
Normal file
@ -0,0 +1,30 @@
|
||||
#
|
||||
# Dockerfile for urlwatch
|
||||
#
|
||||
|
||||
FROM alpine
|
||||
MAINTAINER kev <noreply@datageek.info>
|
||||
|
||||
RUN apk add -U ca-certificates \
|
||||
build-base \
|
||||
libxml2 \
|
||||
libxml2-dev \
|
||||
libxslt \
|
||||
libxslt-dev \
|
||||
make \
|
||||
python-dev \
|
||||
py-pip \
|
||||
&& pip install keyring \
|
||||
lxml \
|
||||
urlwatch \
|
||||
yaml \
|
||||
&& apk del build-base \
|
||||
libxml2-dev \
|
||||
libxslt-dev \
|
||||
python-dev \
|
||||
&& rm -rf /var/cache/apk/* \
|
||||
&& echo '*/15 * * * * cd ~/.urlwatch && make' | crontab
|
||||
|
||||
COPY urlwatch /root/.urlwatch
|
||||
|
||||
CMD ["crond", "-f", "-L", "/dev/stdout"]
|
6
urlwatch/README.md
Normal file
6
urlwatch/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
urlwatch
|
||||
========
|
||||
|
||||
[urlwatch][1] - a tool for monitoring webpages for updates
|
||||
|
||||
[1]: thp.io/2008/urlwatch/
|
13
urlwatch/urlwatch/Makefile
Normal file
13
urlwatch/urlwatch/Makefile
Normal file
@ -0,0 +1,13 @@
|
||||
SHELL = /bin/bash
|
||||
PATH := /usr/local/bin:$(PATH)
|
||||
|
||||
SMTP = smtp.datageek.info:587
|
||||
FROM = urlwatch@datageek.info
|
||||
TO = noreply@datageek.info
|
||||
|
||||
all: urls.txt
|
||||
urlwatch -s $(SMTP) -f $(FROM) -t $(TO) -A -T
|
||||
|
||||
urls.txt: urls.yml
|
||||
python lib/hooks.py
|
||||
|
44
urlwatch/urlwatch/lib/hooks.py
Executable file
44
urlwatch/urlwatch/lib/hooks.py
Executable file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# version detector for urlwatch
|
||||
#
|
||||
|
||||
import lxml.html
|
||||
import os.path
|
||||
import re
|
||||
import yaml
|
||||
|
||||
|
||||
urlwatch_dir = os.path.expanduser(os.path.join('~', '.urlwatch'))
|
||||
urls_txt = os.path.join(urlwatch_dir, 'urls.txt')
|
||||
urls_yml = os.path.join(urlwatch_dir, 'urls.yml')
|
||||
config = yaml.load(open(urls_yml))
|
||||
|
||||
|
||||
def filter(url, data):
|
||||
|
||||
for key, cfg in config.items():
|
||||
if url.endswith('#' + key):
|
||||
exp = cfg['exp']
|
||||
break
|
||||
else:
|
||||
return data
|
||||
|
||||
try:
|
||||
dom = lxml.html.fromstring(data.encode('utf-8'))
|
||||
txt = dom.xpath(exp)[0]
|
||||
ver = re.search(r'([0-9]+\.)*[0-9]+', txt).group(0)
|
||||
return '{}: {}\n'.format(key, ver)
|
||||
except:
|
||||
return '{}: {}\n'.format(key, 'unknown')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
print 'Generating <urls.txt> ...',
|
||||
urls = ['{0[url]}#{1}\n'.format(cfg, key) for key, cfg in config.items()]
|
||||
with open(urls_txt, 'w') as f:
|
||||
f.writelines(urls)
|
||||
print 'OK!'
|
||||
|
68
urlwatch/urlwatch/urls.yml
Normal file
68
urlwatch/urlwatch/urls.yml
Normal file
@ -0,0 +1,68 @@
|
||||
vagrant:
|
||||
url: https://www.vagrantup.com/downloads.html
|
||||
exp: //h2[@class="os-name" and .="Mac OS X"]/following-sibling::ul/li/a/@href
|
||||
|
||||
coreos:
|
||||
url: https://coreos.com
|
||||
exp: //div[@class="co-p-homepage-release-text"]/text()
|
||||
|
||||
git:
|
||||
url: http://git-scm.com
|
||||
exp: //span[@class="version"]/text()
|
||||
|
||||
phantomjs:
|
||||
url: http://phantomjs.org
|
||||
exp: //span[@class="version"]/text()
|
||||
|
||||
firefox:
|
||||
url: https://www.mozilla.org/en-US/firefox/new/
|
||||
exp: //li[@class="os_osx"]/a[@class="download-link"]/@href
|
||||
|
||||
python:
|
||||
url: https://www.python.org/downloads/
|
||||
exp: //div[@class="download-unknown"]/p[@class]/a[1]/text()
|
||||
|
||||
ubuntu:
|
||||
url: http://www.ubuntu.com/download/server
|
||||
exp: //div[contains(@class, "row-hero")]//h2/text()
|
||||
|
||||
mongodb:
|
||||
url: https://www.mongodb.org/downloads
|
||||
exp: //h2[@class="release-version" and contains(., "Production")]/text()
|
||||
|
||||
jquery:
|
||||
url: http://jquery.com
|
||||
exp: //span[@class="download"]/following-sibling::span/text()
|
||||
|
||||
vim:
|
||||
url: http://en.wikipedia.org/wiki/Vim_%28text_editor%29
|
||||
exp: //th[a="Stable release"]/following-sibling::td/text()
|
||||
|
||||
redis:
|
||||
url: http://redis.io
|
||||
exp: //a[contains(@href, "/releases/")]/text()
|
||||
|
||||
scrapy:
|
||||
url: https://github.com/scrapy/scrapy/releases
|
||||
exp: //ul[@class="release-timeline-tags"]/li[1]//span[@class="tag-name"]/text()
|
||||
|
||||
scrapyd:
|
||||
url: https://github.com/scrapy/scrapyd/releases
|
||||
exp: //div[contains(@class, "label-latest")]//h1[@class="release-title"]/a/text()
|
||||
|
||||
shadowsocks:
|
||||
url: https://github.com/shadowsocks/shadowsocks/releases
|
||||
exp: //ul[@class="release-timeline-tags"]/li[1]//span[@class="tag-name"]/text()
|
||||
|
||||
urlwatch:
|
||||
url: https://github.com/thp/urlwatch/releases
|
||||
exp: //ul[@class="release-timeline-tags"]/li[1]//span[@class="tag-name"]/text()
|
||||
|
||||
influxdb:
|
||||
url: http://influxdb.com/download/
|
||||
exp: //h1[.="Download"]/following-sibling::h3[contains(., "Stable")][1]/text()
|
||||
|
||||
monit:
|
||||
url: http://mmonit.com/monit/changes/
|
||||
exp: //div[@class="container"]/div[@class="row"][1]//h3/a/text()
|
||||
|
Loading…
x
Reference in New Issue
Block a user