projects
/
zzz-dywypi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3b1217d
)
WWWJDIC: Fixed to match the abrupt change in result format.
author
Eevee
<git@veekun.com>
Thu, 11 Mar 2010 03:46:38 +0000
(19:46 -0800)
committer
Eevee
<git@veekun.com>
Thu, 13 May 2010 21:52:36 +0000
(14:52 -0700)
plugins/WWWJDIC/plugin.py
patch
|
blob
|
history
diff --git
a/plugins/WWWJDIC/plugin.py
b/plugins/WWWJDIC/plugin.py
index
cefd09b
..
f141604
100644
(file)
--- 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:
# Even the raw results come wrapped in minimal HTML. This sucks.
# They're just in this form though:
- # <p>
- #
<br>
entry 1
- #
<br>
entry 2
- # So grab everything from that p
aragraph that isn't a tag (<br>) or
- # b
lank space and spit it b
ack out.
+ # <p
re
>
+ # entry 1
+ # entry 2
+ # So grab everything from that p
re tag, split by lines, and spit it
+ # back out.
soup = BeautifulSoup(res)
thing_ct = 0
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
if entry == '':
continue