diff options
author | mkaay <mkaay@mkaay.de> | 2011-02-01 01:25:26 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2011-02-01 01:25:26 +0100 |
commit | 93dd69b3df109e0b909292986b69b8c50d2d7e11 (patch) | |
tree | 4d58be4d5fae4a8874a644e68c002fb6f5f237be /module/plugins/crypter/HoerbuchIn.py | |
parent | resolved #178 (diff) | |
download | pyload-93dd69b3df109e0b909292986b69b8c50d2d7e11.tar.xz |
fixed #206 (HoerbuchIn)
Diffstat (limited to 'module/plugins/crypter/HoerbuchIn.py')
-rw-r--r-- | module/plugins/crypter/HoerbuchIn.py | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/module/plugins/crypter/HoerbuchIn.py b/module/plugins/crypter/HoerbuchIn.py index 7dd52ba40..3d876d7fe 100644 --- a/module/plugins/crypter/HoerbuchIn.py +++ b/module/plugins/crypter/HoerbuchIn.py @@ -4,43 +4,49 @@ import re from module.plugins.Crypter import Crypter +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.4" + __version__ = "0.5" __description__ = """Hoerbuch.in Container Plugin""" - __author_name__ = ("spoob") - __author_mail__ = ("spoob@pyload.org") + __author_name__ = ("spoob", "mkaay") + __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de") + + 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 + + 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)) + + sortedLinks = {} + for mirrors in links.values(): + decrypted_mirrors = [] + for u in mirrors: + src = self.load(u) + decrypted_mirrors.append(re.search('<FORM ACTION="(http://.*?)" METHOD="post"', src).group(1)) + + results = self.core.pluginManager.parseUrls(decrypted_mirrors) + + for url, hoster in results: + if not sortedLinks.has_key(hoster): + sortedLinks[hoster] = [] + sortedLinks[hoster].append(url) + + for hoster, urls in sortedLinks.iteritems(): + self.packages.append(("%s (%s)" % (package_base, hoster), urls, self.pyfile.package().folder)) - def __init__(self, parent): - Crypter.__init__(self, parent) - self.parent = parent - self.html = None - - def download_html(self): - url = self.parent.url - self.html = self.req.load(url) - - def file_exists(self): - """ returns True or False - """ - self.download_html() - if re.search(r"Download", self.html) is not None: - return True - return False - - def proceed(self, url, location): - temp_links = [] - download_container = ("Download", "Mirror #1", "Mirror #2", "Mirror #3") - for container in download_container: - download_content = re.search("<BR><B>" + container + ":</B>(.*?)<BR><B>", self.html).group(1) - tmp = re.findall('<A HREF="http://www.hoerbuch.in/cj/out.php\?pct=\d+&url=(http://rs\.hoerbuch\.in/.+?)" TARGET="_blank">Part \d+</A>', download_content) - if tmp == []: continue - for link in tmp: - link_html = self.req.load(link, cookies=True) - temp_links.append(re.search('<FORM ACTION="(http://.*?)" METHOD="post"', link_html).group(1)) - break - - self.links = temp_links |