+ 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 = soupify(htcache.fetch(url))
+ if page.find("div", id="title") is None:
+ # Assume we got the search page
+ raise KeyError(id)
+ name = page.find("div", id="series_info").find("div", attrs={"class": "cover"}).img["alt"]
+ return manga(self, id, name, url)
+