diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-10-01 18:50:17 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-10-01 18:50:17 +0200 |
commit | 04b13e003d6af0de21e6c59e411ffee5b97b6134 (patch) | |
tree | 6ea896c823290df0c598f82f8daa61713de373f5 /config_template.py | |
parent | f8f939634396158de53fb26fa7f9a539a92fb219 (diff) |
New upstream version 2.0.4upstream/2.0.4
Diffstat (limited to 'config_template.py')
-rwxr-xr-x[-rw-r--r--] | config_template.py | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/config_template.py b/config_template.py index f394e52..02788bd 100644..100755 --- a/config_template.py +++ b/config_template.py @@ -1,47 +1,49 @@ -import os.path +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- -# Copyright: (2013-2014) Michael Till Beck <Debianguru@gmx.de> +# Copyright: (2013-2017) Michael Till Beck <Debianguru@gmx.de> # License: GPL-2.0+ -#We collect xpath snippets at this place: <a href="https://github.com/Debianguru/MailWebsiteChanges/wiki/snippets">Snippet collection</a> - please feel free to add your own definitions! + +# We collect xpath snippets at this place: +# <a href="https://github.com/Debianguru/MailWebsiteChanges/wiki/snippets">Snippet collection</a> +# Feel free to contribute! + + +from mwctools import URLReceiver as uri +from mwctools import CommandReceiver as command +from mwctools import XPathParser as xpath +from mwctools import CSSParser as css +from mwctools import RegExParser as regex +from mwctools import Content +from mwctools import Parser + sites = [ - {'shortname': 'mywebsite1', - 'uri': 'http://www.mywebsite1.com/info', - 'type': 'html', - 'titlexpath': '//h1', - 'contentxpath': '//div', - 'titleregex': '', - 'contentregex': '', - 'user-agent': 'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0', - 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' - 'encoding': 'utf-8'}, - - {'shortname': 'mywebsite2', - 'uri': 'http://www.mywebsite2.com/info', - 'type': 'html', - 'contentxpath': '//*[contains(concat(\' \', normalize-space(@class), \' \'), \' news-list-container \')]', - 'regex': '', - 'encoding': 'utf-8'}, - - {'shortname': 'mywebsite3', - 'uri': 'http://www.mywebsite3.com/info', - 'type': 'text', - 'contentxpath': '', - 'contentregex': 'Version\"\:\d*\.\d*', - 'encoding': 'utf-8'}, - - {'shortname': 'lscmd', - 'uri': 'cmd://ls -l /home/pi', - 'contentregex': '.*Desktop.*' - } + {'name': 'example-css', + 'parsers': [uri(uri='https://github.com/mtill', contenttype='html'), + css(contentcss='div') + ] + }, + + {'name': 'example-xpath', + 'parsers': [uri(uri='https://example-webpage.com/test', contenttype='html'), + xpath(contentxpath='//div[contains(concat(\' \', normalize-space(@class), \' \'), \' package-version-header \')]') + ] + }, + + {'name': 'my-script', + 'parsers': [command(command='/home/user/script.sh', contenttype='text'), + regex(contentregex='^.*$') + ] + } ] -subjectPostfix = 'A website has been updated!' +workingDirectory = '/path-to-data-dir/MailWebsiteChanges-data' -enableMailNotifications = True +enableMailNotifications = False maxMailsPerSession = -1 sender = 'me@mymail.com' smtphost = 'mysmtpprovider.com' @@ -51,9 +53,7 @@ smtpusername = sender smtppwd = 'mypassword' receiver = 'me2@mymail.com' -os.chdir('/var/cache/mwc') - -enableRSSFeed = True +enableRSSFeed = False rssfile = 'feed.xml' maxFeeds = 100 |