]> code.delx.au - webdl/commitdiff
SBS is dumb, they send XML as an error response
authorJames Bunton <jamesbunton@delx.net.au>
Fri, 8 Jun 2012 07:06:18 +0000 (17:06 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Fri, 8 Jun 2012 07:06:18 +0000 (17:06 +1000)
sbs.py

diff --git a/sbs.py b/sbs.py
index 6e853460b00b2c192846f24227c0041389427e0c..1d318487352e0983f89386a35af0f543a4045e75 100644 (file)
--- a/sbs.py
+++ b/sbs.py
@@ -82,7 +82,11 @@ def fill_entry(get_catnode, entry):
 def fill_section(get_catnode, section):
        index = 1
        while True:
-               doc = grab_json(BASE + MENU_URL % (section, index), 3600)
+               try:
+                       doc = grab_json(BASE + MENU_URL % (section, index), 3600)
+               except ValueError:
+                       # SBS sends XML as an error message :\
+                       break
                if len(doc.get("entries", [])) == 0:
                        break
                for entry in doc["entries"]: