From 1241bb8da30576ef54bca33dc392997f30518ebf Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Wed, 15 Jan 2014 14:53:35 +0100 Subject: [PATCH] parse: check whether HTML body exists --- dvr-db.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dvr-db.py b/dvr-db.py index dbf7791..62038e6 100755 --- a/dvr-db.py +++ b/dvr-db.py @@ -219,10 +219,11 @@ def parseAndInsert(db, htmldata): bs = bs4.BeautifulSoup(htmldata) b = bs.body + if b is None: + print("No HTML body found.", file=sys.stderr) + return id = None - - #bs.body.find('form', attrs = {'id' : 'aspnetForm'}). form = b.find('form') if not form is None: idattr = form.get('action') @@ -232,7 +233,7 @@ def parseAndInsert(db, htmldata): id = idmatch.group(1) id = int(id) if id is None: - print("Could not find ID.") + print("Could not find ID.", file=sys.stderr) return dvrtagid = 'ctl00_ContentHolder_AuftraggeberDaten_tempDVRNr_labelDVRNr' -- 2.39.5