X-Git-Url: http://dolda2000.com/gitweb/?p=automanga.git;a=blobdiff_plain;f=manga%2Fmangafox.py;h=c95a77be7c33219c7a1d9281252159a4280c02a9;hp=b165d21aa4e11eddf6c02aa2a32ccda699073237;hb=59e32d8da9a36ba7b2395d8168d335786e9b4c5d;hpb=03fdcb32535b1920a6c9ac0875ea7d44a47969be diff --git a/manga/mangafox.py b/manga/mangafox.py index b165d21..c95a77b 100644 --- a/manga/mangafox.py +++ b/manga/mangafox.py @@ -1,4 +1,4 @@ -import urllib +import urllib, re import BeautifulSoup import lib, htcache soup = BeautifulSoup.BeautifulSoup @@ -117,6 +117,8 @@ def nextel(el): return el class manga(lib.manga): + cure = re.compile(r"/v\d+/c[\d.]+/$") + def __init__(self, lib, id, name, url): self.lib = lib self.id = id @@ -154,9 +156,13 @@ class manga(lib.manga): except KeyError: pass url = n.a["href"].encode("us-ascii") - if url[-7:] != "/1.html": + if url[-7:] == "/1.html": + url = url[:-6] + elif self.cure.search(url) is not None: + pass + else: raise Exception("parse error: unexpected chapter URL for %r: %s" % (self, url)) - vol.ch.append(chapter(vol, vol.stack + [(vol, o)], chid, name, url[:-6])) + vol.ch.append(chapter(vol, vol.stack + [(vol, o)], chid, name, url)) cvol.append(vol) self.cvol = cvol return self.cvol