google: unescape titles. drama: set api endpoints to new domain.
This commit is contained in:
parent
6824443901
commit
ce67812827
|
@ -6,3 +6,5 @@ config
|
|||
pep8.py
|
||||
.project
|
||||
.pydevproject
|
||||
*.db
|
||||
web
|
||||
|
|
|
@ -3,8 +3,8 @@ article'''
|
|||
|
||||
from util import hook, http
|
||||
|
||||
api_url = "http://encyclopediadramatica.com/api.php?action=opensearch"
|
||||
ed_url = "http://encyclopediadramatica.com/"
|
||||
api_url = "http://encyclopediadramatica.ch/api.php?action=opensearch"
|
||||
ed_url = "http://encyclopediadramatica.ch/"
|
||||
|
||||
|
||||
@hook.command('ed')
|
||||
|
|
|
@ -37,8 +37,8 @@ def google(inp):
|
|||
|
||||
result = parsed['responseData']['results'][0]
|
||||
|
||||
title = result['titleNoFormatting']
|
||||
content = result['content']
|
||||
title = http.unescape(result['titleNoFormatting'])
|
||||
content = http.unescape(result['content'])
|
||||
|
||||
if len(content) == 0:
|
||||
content = "No description available"
|
||||
|
|
|
@ -88,3 +88,9 @@ def to_utf8(s):
|
|||
|
||||
def quote_plus(s):
|
||||
return _quote_plus(to_utf8(s))
|
||||
|
||||
|
||||
def unescape(s):
|
||||
if not s.strip():
|
||||
return s
|
||||
return html.fromstring(s).text_content()
|
||||
|
|
Loading…
Reference in New Issue