Commit ff752ae1 authored by Svetlana Tkachenko's avatar Svetlana Tkachenko
Browse files

Unescape entities in urltitle

parent e55cd966
#import urllib
import urllib.request
import html.parser
@plugin
class Urltitle(object):
......@@ -30,7 +30,9 @@ class Urltitle(object):
try:
request = urllib.request.Request(url, headers={'user-agent': 'guppy ' + self.server.config["version"]})
s = urllib.request.urlopen(request)
return url + " - " + s.read().decode('utf-8', 'replace').split("<title>")[1].split("</title>")[0]
title = s.read().decode('utf-8', 'replace').split("<title>")[1].split("</title>")[0]
title = html.parser.HTMLParser().unescape(title)
return url + " - " + title
except:
return None
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment