From e645c054d8cc64824879b8a6f91ff74736e8d8be Mon Sep 17 00:00:00 2001 From: retiefjimm Date: Tue, 15 Mar 2011 14:49:16 -0500 Subject: [PATCH] adastrafanfic can have chapters with tags () in them. Allow get as well as post. --- fanficdownloader/adastrafanfic.py | 4 +++- fanficdownloader/output.py | 2 ++ main.py | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fanficdownloader/adastrafanfic.py b/fanficdownloader/adastrafanfic.py index 894787f2..9d3186b7 100644 --- a/fanficdownloader/adastrafanfic.py +++ b/fanficdownloader/adastrafanfic.py @@ -113,7 +113,9 @@ class Adastrafanfic(FanfictionSiteAdapter): for o in allOptions: # warning=5 bypasses 'are you old enough' checks. url = self.url + "&warning=5&chapter=%s" % o['value'] - title = o.string + # ad astra can have tags, like in chapter titles. + title = "%s" % o + title = re.sub('<[^>]+>','',title) result.append((url,title)) # warning=5 bypasses 'are you old enough' checks. diff --git a/fanficdownloader/output.py b/fanficdownloader/output.py index 63c1168c..26e646a1 100644 --- a/fanficdownloader/output.py +++ b/fanficdownloader/output.py @@ -474,6 +474,8 @@ def replaceNotEntities(data): def removeEntities(text): # replace numeric versions of [&<>] with named versions. + if text is None: + return text try: t = text.decode('utf-8') except UnicodeEncodeError, e: diff --git a/main.py b/main.py index 5c0563d2..9bddd146 100644 --- a/main.py +++ b/main.py @@ -171,6 +171,9 @@ class RecentAllFilesServer(webapp.RequestHandler): self.response.out.write(template.render(path, template_values)) class FanfictionDownloader(webapp.RequestHandler): + def get(self): + self.post() + def post(self): logging.getLogger().setLevel(logging.DEBUG)