Skip to content

Commit 9c4c113

Browse files
committed
wikipedia: special-case pages in Special:* namespace
1 parent 4b4b118 commit 9c4c113

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sopel/builtins/wikipedia.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,12 @@ def mw_info(bot, trigger, match=None):
334334
article = unquote(page_info.path)[trim_offset:]
335335
section = unquote(page_info.fragment)
336336

337+
if article.startswith("Special:"):
338+
# The MediaWiki query API does not include pages in the Special:*
339+
# namespace, so there's no point bothering when we know this will error
340+
LOGGER.debug("Ignoring page in Special:* namespace")
341+
return False
342+
337343
if section:
338344
if section.startswith('cite_note-'):
339345
# Don't bother trying to retrieve a snippet when cite-note is linked
@@ -367,6 +373,11 @@ def wikipedia(bot, trigger):
367373
if not query:
368374
bot.reply('What do you want me to look up?')
369375
return plugin.NOLIMIT
376+
377+
if query.startswith("Special:"):
378+
bot.reply("Sorry, the MediaWiki API doesn't support querying the Special:* namespace")
379+
return False
380+
370381
server = lang + '.wikipedia.org'
371382
query = mw_search(server, query, 1)
372383
if not query:

0 commit comments

Comments
 (0)