Closed klikevil closed 3 years ago
you can try porting this working wikipedia plugin: mediawiki.py. it supports any mediawiki instance, but its configured for english wikipedia.
context: i mantain a 2013 skybot fork.
handles links and searches:
<inex> https://en.wikipedia.org/wiki/IRC
<Taigabot> Internet Relay Chat - Internet Relay Chat (IRC) is an application... [removed for brevity]
<inex> .wiki clouds
<Taigabot> Cloud - In meteorology, a cloud is an aerosol consisting of a visible mass of minute liquid droplets, frozen crystals, or other particles suspended in the atmosphere of a planetary body or similar space.[1] Water or various other chemicals may... - https://en.wikipedia.org/wiki/Cloud
and it can also handle redirects:
<inex> .wiki irc
<Taigabot> Internet Relay Chat - [removed for brevity] - https://en.wikipedia.org/wiki/Irc (redirected from Irc)
04:44:59 #laks `wiki foo
Unhandled exception in thread started by <function run at 0x7f27ed9329e0>
Traceback (most recent call last):
File "core/main.py", line 88, in run
out = func(input.inp)
File "plugins/wikipedia.py", line 42, in wiki
title, desc, url = extract(items[0])
File "plugins/wikipedia.py", line 40, in extract
('Text', 'Description', 'Url')]
File "plugins/wikipedia.py", line 39, in
return [item.find(ns + x).text for x in
AttributeError: 'NoneType' object has no attribute 'text'
period@ifrit ~/src/skybot $ python -V Python 3.7.7