From fe57a565c8b0a80b47b79808c3ac03798d2b4996 Mon Sep 17 00:00:00 2001 From: Thomas Ward Date: Fri, 2 Mar 2018 16:05:25 -0500 Subject: [PATCH] Fix issue with getting page text for display 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). --- Wikipedia/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Wikipedia/plugin.py b/Wikipedia/plugin.py index 8d8113b4..c2733ecc 100644 --- a/Wikipedia/plugin.py +++ b/Wikipedia/plugin.py @@ -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, '