diff options
author | Walter Purcaro <vuolter@gmail.com> | 2015-02-16 10:46:28 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2015-02-16 10:46:28 +0100 |
commit | ce1c2b6b05c08b669357947e61ae40efce7fc50f (patch) | |
tree | 0b5f7996960cf35c4eface53a89eba18a37519b7 /module/plugins/crypter/HoerbuchIn.py | |
parent | Fix filename case (diff) | |
download | pyload-ce1c2b6b05c08b669357947e61ae40efce7fc50f.tar.xz |
module temp
Diffstat (limited to 'module/plugins/crypter/HoerbuchIn.py')
-rw-r--r-- | module/plugins/crypter/HoerbuchIn.py | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/module/plugins/crypter/HoerbuchIn.py b/module/plugins/crypter/HoerbuchIn.py new file mode 100644 index 000000000..a12d7c02a --- /dev/null +++ b/module/plugins/crypter/HoerbuchIn.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- + +import re + +from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup + +from pyload.plugin.Crypter import Crypter + + +class HoerbuchIn(Crypter): + __name__ = "HoerbuchIn" + __type__ = "crypter" + __version__ = "0.60" + + __pattern__ = r'http://(?:www\.)?hoerbuch\.in/(wp/horbucher/\d+/.+/|tp/out\.php\?.+|protection/folder_\d+\.html)' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + + __description__ = """Hoerbuch.in decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("spoob", "spoob@pyload.org"), + ("mkaay", "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 + + if self.article.match(pyfile.url): + html = self.load(pyfile.url) + soup = BeautifulSoup(html, 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, package)) + else: + self.urls = self.decryptFolder(pyfile.url) + + + def decryptFolder(self, url): + m = self.protection.search(url) + if m is None: + self.fail(_("Bad URL")) + url = m.group(0) + + self.pyfile.url = url + html = self.load(url, post={"viewed": "adpg"}) + + links = [] + pattern = re.compile("http://www\.hoerbuch\.in/protection/(\w+)/(.*?)\"") + for hoster, lid in pattern.findall(html): + self.req.lastURL = url + self.load("http://www.hoerbuch.in/protection/%s/%s" % (hoster, lid)) + links.append(self.req.lastEffectiveURL) + + return links |