google: unescape titles. drama: set api endpoints to new domain.

This commit is contained in:
Ryan Hitchman 2011-05-30 05:18:01 -06:00
parent 6824443901
commit ce67812827
4 changed files with 12 additions and 4 deletions

2
.gitignore vendored
View File

@ -6,3 +6,5 @@ config
pep8.py
.project
.pydevproject
*.db
web

View File

@ -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')

View File

@ -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"

View File

@ -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()