From 6dc0ffa85bb2fc755400dbf7ac35c486ffc8ee06 Mon Sep 17 00:00:00 2001 From: Eevee Date: Wed, 10 Mar 2010 19:46:38 -0800 Subject: [PATCH] WWWJDIC: Fixed to match the abrupt change in result format. --- plugins/WWWJDIC/plugin.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/plugins/WWWJDIC/plugin.py b/plugins/WWWJDIC/plugin.py index cefd09b..f141604 100644 --- a/plugins/WWWJDIC/plugin.py +++ b/plugins/WWWJDIC/plugin.py @@ -72,19 +72,15 @@ class WWWJDIC(callbacks.Plugin): # Even the raw results come wrapped in minimal HTML. This sucks. # They're just in this form though: - #

- #
entry 1 - #
entry 2 - # So grab everything from that paragraph that isn't a tag (
) or - # blank space and spit it back out. + #

+        # entry 1
+        # entry 2
+        # So grab everything from that pre tag, split by lines, and spit it
+        # back out.
         soup = BeautifulSoup(res)
         thing_ct = 0
-        for thing in soup.p:
-            if not isinstance(thing, NavigableString):
-                continue
-
-            # Everything ends with a newline, bleh!
-            entry = unicode(thing).strip()
+        for entry in soup.pre.string.splitlines():
+            entry = entry.strip()
             if entry == '':
                 continue
 
-- 
2.7.4