]> git.sthu.org Git - dvrdb.git/commitdiff
parse: check whether HTML body exists
authorStefan Huber <shuber@sthu.org>
Wed, 15 Jan 2014 13:53:35 +0000 (14:53 +0100)
committerStefan Huber <shuber@sthu.org>
Fri, 17 Jan 2014 13:30:19 +0000 (14:30 +0100)
dvr-db.py

index dbf7791c88c76c3f1b4a6c1119149b192478648e..62038e6a71daa4d8e2de7695085694f24fcede5a 100755 (executable)
--- 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'