From 6d4cd25e580825b466b91c1400307a254e07cd28 Mon Sep 17 00:00:00 2001 From: mkaay Date: Wed, 15 Jun 2011 11:36:32 +0200 Subject: fixed hoerbuch.in plugin (closes #328) --- module/plugins/crypter/HoerbuchIn.py | 63 ++++++++++++++++-------------- module/plugins/crypter/SerienjunkiesOrg.py | 1 - 2 files changed, 33 insertions(+), 31 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/crypter/HoerbuchIn.py b/module/plugins/crypter/HoerbuchIn.py index 3d876d7fe..a34091c93 100644 --- a/module/plugins/crypter/HoerbuchIn.py +++ b/module/plugins/crypter/HoerbuchIn.py @@ -9,44 +9,47 @@ from module.lib.BeautifulSoup import BeautifulSoup, BeautifulStoneSoup class HoerbuchIn(Crypter): __name__ = "HoerbuchIn" __type__ = "container" - __pattern__ = r"http://(www\.)?hoerbuch\.in/(blog\.php\?id=|download_(.*)\.html)" - __version__ = "0.5" + __pattern__ = r"http://(www\.)?hoerbuch\.in/(wp/horbucher/\d+/.+/|tp/out.php\?.+|protection/folder_\d+\.html)" + __version__ = "0.6" __description__ = """Hoerbuch.in Container Plugin""" __author_name__ = ("spoob", "mkaay") __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de") + + article = re.compile("http://(www\.)?hoerbuch\.in/wp/horbucher/\d+/.+/") + protection = re.compile("http://(www\.)?hoerbuch\.in/protection/folder_\d+.html") def decrypt(self, pyfile): self.pyfile = pyfile - self.html = self.req.load(self.pyfile.url) - if re.search(r"Download", self.html) is None: - self.offline() - - soup = BeautifulSoup(self.html, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) - package_base = soup.find("a", attrs={"href": re.compile(self.__pattern__)}).text + if self.article.match(self.pyfile.url): + src = self.load(self.pyfile.url) + soup = BeautifulSoup(src, convertEntities=BeautifulStoneSoup.HTML_ENTITIES) + + abookname = soup.find("a", attrs={"rel": "bookmark"}).text + for a in soup.findAll("a", attrs={"href": self.protection}): + package = "%s (%s)" % (abookname, a.previousSibling.previousSibling.text[:-1]) + links = self.decryptFolder(a["href"]) + + self.packages.append((package, links, self.pyfile.package().folder)) + else: + links = self.decryptFolder(self.pyfile.url) + + self.packages.append((self.pyfile.package().name, links, self.pyfile.package().folder)) - links = {} - out = re.compile("http://www.hoerbuch.in/cj/out.php\?pct=\d+&url=(http://rs\.hoerbuch\.in/.*)") - for a in soup.findAll("a", attrs={"href": out}): - part = int(a.text.replace("Part ", "")) - if not part in links.keys(): - links[part] = [] - links[part].append(out.search(a["href"]).group(1)) + def decryptFolder(self, url): + m = self.protection.search(url) + if not m: + self.fail("Bad URL") + url = m.group(0) - sortedLinks = {} - for mirrors in links.values(): - decrypted_mirrors = [] - for u in mirrors: - src = self.load(u) - decrypted_mirrors.append(re.search('