Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Watch for exam results announcement and notify via telegram-middleman-bot (run as Cronjob)
import requests
import os
url = ''
keywords = ['steuerrecht']
cache_file = 'cache.txt'
hook_url = ''
hook_sender_id = 'Watcher'
hook_recipient_id = ''
def callback(keyword):
json_data = {
'recipient_token': hook_recipient_id,
'origin': hook_sender_id,
'text': 'Found word *{}* at [{}]({})'.format(keyword, url, url)
}, json=json_data)
if __name__ is '__main__':
text_new, text_old = '', ''
if not os.path.exists(cache_file): open(cache_file, 'a', encoding='utf8').close()
with open(cache_file, 'r', encoding='utf8') as f:
text_old =
r = requests.get(url)
text_new = r.text.lower()
for k in keywords:
if k.lower() in text_new and not k.lower() in text_old:
with open(cache_file, 'w', encoding='utf8') as f:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.