Skip to content

Commit

Permalink
Fix issue with getting page text for display
Browse files Browse the repository at this point in the history
Something changed in Wikipedia or its plugin where by the existing code for reading data from the page itself is broken.  That said, the fix is to use two slashes before the `p[1]` for the `xpath` call.  This allows data to be properly read from the Wikipedia page.

This was tested in `#limnoria-bots` on IRC as well, with my bot, Archangel (which was spun up for this test only).
  • Loading branch information
teward authored and progval committed Mar 2, 2018
1 parent f4f9e2d commit fe57a56
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Wikipedia/plugin.py
Expand Up @@ -159,7 +159,7 @@ def wiki(self, irc, msg, args, search):
reply += format(_('This article appears to be a talk page: %u'), addr)
else:
##### etree!
p = tree.xpath("//div[@id='mw-content-text']/p[1]")
p = tree.xpath("//div[@id='mw-content-text']//p[1]")
if len(p) == 0 or addr.endswith('Special:Search'):
if 'wikipedia:wikiproject' in addr.lower():
reply += format(_('This page appears to be a WikiProject page, '
Expand Down

0 comments on commit fe57a56

Please sign in to comment.