commit 3084f08b190f49042767511b089cc4b5e12b8279
parent 53703459ce6e7e46ec35aa24d86043db65745104
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Wed, 6 Jun 2012 11:55:10 +0200
fix for python3 compatibility, disable shortening for now
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/wikifirc b/wikifirc
@@ -2,12 +2,13 @@
import sys
import time
-import urllib2
+import urllib.parse
+import urllib.request
API="http://uzy.me/?api&longurl=%s"
def shorten(url):
- return urllib2.urlopen(API % urllib2.quote(url)).read()
+ return urllib.request.urlopen(API % urllib.parse.quote(url)).read()
class Line:
@@ -20,13 +21,13 @@ class Line:
fields = rest.split(' ')
fields.pop(0) # trailing characters of title
self.flags = fields.pop(0)[:-2]
- self.diff = shorten(fields.pop(0)[3:-1])
+ self.diff = fields.pop(0)[3:-1]
self.flags2 = fields.pop(0)[2:-1]
username, sep, rest = ' '.join(fields).partition('*')
self.username = username[3:-4]
fields = rest.split(' ')
fields.pop(0) # rest of flags3
- self.diff = fields.pop(0)[1:-1]
+ self.diff2 = fields.pop(0)[1:-1]
self.message = ' '.join(fields)[3:-1]
def __str__(self):