diff --git a/src/adhd_reminder/__main__.py b/src/adhd_reminder/__main__.py index 0a68646..79b0356 100644 --- a/src/adhd_reminder/__main__.py +++ b/src/adhd_reminder/__main__.py @@ -61,26 +61,20 @@ class GreetBot: self.curl = { "url": "https://www.terminland.de/noris-psychotherapie/default.aspx?m=39059&ll=DAl3u&dpp=DAl3u&dlgid=8&step=3&dlg=1&a2291013099=2291025408&mode=frame&css=1'", "expect": b"F\xc3\xbcr die ADHS-Abkl\xc3\xa4rung stehen derzeit keine freien Termine zur Verf\xc3\xbcgung.
Bitte versuchen Sie es zu einem sp\xc3\xa4teren Zeitpunkt noch einmal.", - "headers": { - 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0', - 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8', - 'Accept-Language': 'en-US,en;q=0.5', - 'Accept-Encoding': 'gzip, deflate, br', - 'Referer': 'https://www.terminland.de/noris-psychotherapie/default.aspx?m=39059&ll=DAl3u&dpp=DAl3u&step=1&a2291013099=2291025408&mode=frame&css=1&ldlg=1', - 'DNT': '1', - 'Connection': 'keep-alive', - } -#-H 'Cookie: ASP.NET_SessionId=huwhhoompma2505dsiq31xd0' -H 'Upgrade-Insecure-Requests: 1' -H 'Sec-Fetch-Dest: iframe' -H 'Sec-Fetch-Mode: navigate' -H 'Sec-Fetch-Site: same-origin' -H 'Sec-Fetch-User: ?1'" + "notification": "Hey, auf https://noris-psychotherapie.de/kontakt/ müsste es jetzt neue Termine für ADHS geben :) oder ich weiß nicht mehr wie ich richtig gucke, das kann auch sein. Dann sag nami@systemli.org bescheid.", } self.contacts = contacts def crawl(self): - response = r.get(self.curl['url'], headers=self.curl['headers']) + response = r.get(self.curl['url']) if self.curl['expect'] not in response.content: print(str(response.content)) for addr in self.contacts: - print(addr) - + print("Notifying", addr) + chat = self.account.create_chat(addr) + chat.send_text(self.curl["notification"]) + print("Sleeping for 24 hours now, then I'll try again.") + time.sleep(60*60*24) def main(): @@ -100,10 +94,10 @@ def main(): ac = setup_account(ops.email, ops.password, ops.db_path, ops.show_ffi) greeter = GreetBot(ac, ["nami@nine.testrun.org"]) - print("waiting for ADHD appointment... (and I hate waiting)") + print("waiting for ADHD appointments... (and I hate waiting)") while 1: greeter.crawl() - sleep(5) + sleep(60) if __name__ == "__main__":