Fixed mcwiki help string.
This commit is contained in:
parent
c39c0244ef
commit
f04c01beb7
1 changed files with 4 additions and 4 deletions
|
@ -2,21 +2,21 @@ from util import hook, http, text
|
||||||
import re
|
import re
|
||||||
|
|
||||||
api_url = "http://minecraftwiki.net/api.php?action=opensearch"
|
api_url = "http://minecraftwiki.net/api.php?action=opensearch"
|
||||||
ed_url = "http://minecraftwiki.net/wiki/"
|
mc_url = "http://minecraftwiki.net/wiki/"
|
||||||
|
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def mcwiki(inp):
|
def mcwiki(inp):
|
||||||
"drama <phrase> -- Gets the first paragraph of" \
|
"mcwiki <phrase> -- Gets the first paragraph of" \
|
||||||
" the Minecraft Wiki article on <phrase>."
|
" the Minecraft Wiki article on <phrase>."
|
||||||
|
|
||||||
j = http.get_json(api_url, search=inp)
|
j = http.get_json(api_url, search=inp)
|
||||||
print j
|
|
||||||
if not j[1]:
|
if not j[1]:
|
||||||
return "No results found."
|
return "No results found."
|
||||||
article_name = j[1][0].replace(' ', '_').encode('utf8')
|
article_name = j[1][0].replace(' ', '_').encode('utf8')
|
||||||
|
|
||||||
url = ed_url + http.quote(article_name, '')
|
url = mc_url + http.quote(article_name, '')
|
||||||
page = http.get_html(url)
|
page = http.get_html(url)
|
||||||
|
|
||||||
for p in page.xpath('//div[@class="mw-content-ltr"]/p'):
|
for p in page.xpath('//div[@class="mw-content-ltr"]/p'):
|
||||||
|
|
Reference in a new issue