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
|
pep8.py
|
||||||
.project
|
.project
|
||||||
.pydevproject
|
.pydevproject
|
||||||
|
*.db
|
||||||
|
web
|
||||||
|
|
|
@ -3,8 +3,8 @@ article'''
|
||||||
|
|
||||||
from util import hook, http
|
from util import hook, http
|
||||||
|
|
||||||
api_url = "http://encyclopediadramatica.com/api.php?action=opensearch"
|
api_url = "http://encyclopediadramatica.ch/api.php?action=opensearch"
|
||||||
ed_url = "http://encyclopediadramatica.com/"
|
ed_url = "http://encyclopediadramatica.ch/"
|
||||||
|
|
||||||
|
|
||||||
@hook.command('ed')
|
@hook.command('ed')
|
||||||
|
|
|
@ -37,8 +37,8 @@ def google(inp):
|
||||||
|
|
||||||
result = parsed['responseData']['results'][0]
|
result = parsed['responseData']['results'][0]
|
||||||
|
|
||||||
title = result['titleNoFormatting']
|
title = http.unescape(result['titleNoFormatting'])
|
||||||
content = result['content']
|
content = http.unescape(result['content'])
|
||||||
|
|
||||||
if len(content) == 0:
|
if len(content) == 0:
|
||||||
content = "No description available"
|
content = "No description available"
|
||||||
|
|
|
@ -88,3 +88,9 @@ def to_utf8(s):
|
||||||
|
|
||||||
def quote_plus(s):
|
def quote_plus(s):
|
||||||
return _quote_plus(to_utf8(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