Dolda2000 GitWeb
/
automanga.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
531e447
)
Fixed some more Python3-compatibility in mangafox.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Mon, 16 Nov 2015 04:57:44 +0000
(
05:57
+0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Mon, 16 Nov 2015 04:57:44 +0000
(
05:57
+0100)
manga/mangafox.py
patch
|
blob
|
blame
|
history
diff --git
a/manga/mangafox.py
b/manga/mangafox.py
index
8b4300a
..
0e8c2e9
100644
(file)
--- a/
manga/mangafox.py
+++ b/
manga/mangafox.py
@@
-147,7
+147,11
@@
class manga(lib.manga):
return "<mangafox.manga %r>" % self.name
def libalphacmp(a, b):
return "<mangafox.manga %r>" % self.name
def libalphacmp(a, b):
- return cmp(a.upper(), b.upper())
+ if a.upper() < b.upper():
+ return -1
+ elif a.upper() > b.upper():
+ return 1
+ return 0
class library(lib.library):
def __init__(self):
class library(lib.library):
def __init__(self):
@@
-205,8
+209,10
@@
class library(lib.library):
i = 0
def search(self, expr):
i = 0
def search(self, expr):
- with urllib.request.urlopen(self.base + ("ajax/search.php?term=%s" % urllib.quote(expr))) as resp:
- rc = json.load(resp)
+ req = urllib.request.Request(self.base + ("ajax/search.php?term=%s" % urllib.parse.quote(expr)),
+ headers={"User-Agent": "automanga/1"})
+ with urllib.request.urlopen(req) as resp:
+ rc = json.loads(resp.read().decode("utf-8"))
return [manga(self, id, name, self.base + ("manga/%s/" % id)) for num, name, id, genres, author in rc]
def byid(self, id):
return [manga(self, id, name, self.base + ("manga/%s/" % id)) for num, name, id, genres, author in rc]
def byid(self, id):