X-Git-Url: http://dolda2000.com/gitweb/?p=automanga.git;a=blobdiff_plain;f=manga%2Fmangafox.py;h=be9365153afa05349eb76bd5dba5373f27729c68;hp=c95a77be7c33219c7a1d9281252159a4280c02a9;hb=7038902e3253ac3e9d350fbef443454e389e4e83;hpb=299d3f50467a6e719819ca95e7f5416a16b535fc diff --git a/manga/mangafox.py b/manga/mangafox.py index c95a77b..be93651 100644 --- a/manga/mangafox.py +++ b/manga/mangafox.py @@ -1,5 +1,5 @@ import urllib, re -import BeautifulSoup +import BeautifulSoup, json import lib, htcache soup = BeautifulSoup.BeautifulSoup @@ -233,6 +233,14 @@ class library(lib.library): ls = self.alphapage(pno) i = 0 + def search(self, expr): + resp = urllib.urlopen(self.base + ("ajax/search.php?term=%s" % urllib.quote(expr))) + try: + rc = json.load(resp) + finally: + resp.close() + return [manga(self, id.encode("utf8"), name, self.base + ("manga/%s/" % id.encode("utf8"))) for num, name, id, genres, author in rc] + def byid(self, id): url = self.base + ("manga/%s/" % id) page = soup(htcache.fetch(url))