From 48d561de1af562f092b70628b79bd7c9cfbc8079 Mon Sep 17 00:00:00 2001 From: sigizmund Date: Mon, 21 Dec 2009 13:40:11 +0000 Subject: [PATCH] Fixed multiline ff.net --- ffnet.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ffnet.py b/ffnet.py index 852c6097..0816bf81 100644 --- a/ffnet.py +++ b/ffnet.py @@ -114,10 +114,24 @@ class FFNet(FanfictionSiteAdapter): def getText(self, url): data = self._fetchUrl(url) lines = data.split('\n') + + textbuf = '' + emit = False + for l in lines: if l.find('') != -1: - s2 = bs.BeautifulStoneSoup(l) - return s2.div.prettify() + #s2 = bs.BeautifulStoneSoup(l) + #return s2.div.prettify() + emit = True + + if emit: + textbuf = textbuf + "\n" + l + + if l.find('') != -1: + emit = False + + s2 = bs.BeautifulStoneSoup(textbuf) + return s2.div.prettify() def setLogin(self, login):