Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #22 from Bytespeicher/plugins/shorturl
Browse files Browse the repository at this point in the history
Fixed UTF-8 missing output in shorturl plugin. Closes #21
  • Loading branch information
mkzero committed May 12, 2014
2 parents acab27a + 65f95cf commit 18b68bb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/shorturl.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def googl(self, url):
return ret

def getTitle(self, url):
data = urllib2.urlopen(url=url, timeout=BYTEBOT_HTTP_TIMEOUT)
data = urllib2.urlopen(url=url, timeout=BYTEBOT_HTTP_TIMEOUT)
soup = BeautifulSoup(data)
return soup.title.string[:60]
return soup.title.getText().encode('utf-8')[:60]

def onPrivmsg(self, irc, msg, channel, user):

Expand All @@ -47,7 +47,7 @@ def onPrivmsg(self, irc, msg, channel, user):
title = ''

if title != '':
irc.msg(channel, title.encode('ascii', 'ignore'))
irc.msg(channel, title)
irc.msg(channel, '\tURL: %s' % shorturl)
else:
irc.msg(channel, "URL: %s" % shorturl)

0 comments on commit 18b68bb

Please sign in to comment.