From 1195fb68b638b05a912d2074cd62d9e75bb7508b Mon Sep 17 00:00:00 2001
From: godofdream <soilfiction@gmail.com>
Date: Wed, 29 Aug 2012 01:58:17 +0200
Subject: Added DuckcryptInfo decrypter, smaller fixes

---
 module/plugins/crypter/DuckCryptInfo.py   | 57 +++++++++++++++++++++++++++++++
 module/plugins/crypter/TrailerzoneInfo.py |  4 +--
 module/plugins/hoster/IcyFilesCom.py      | 18 +++++-----
 3 files changed, 67 insertions(+), 12 deletions(-)
 create mode 100644 module/plugins/crypter/DuckCryptInfo.py

(limited to 'module')

diff --git a/module/plugins/crypter/DuckCryptInfo.py b/module/plugins/crypter/DuckCryptInfo.py
new file mode 100644
index 000000000..6e7166ff8
--- /dev/null
+++ b/module/plugins/crypter/DuckCryptInfo.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+
+import re
+from module.lib.BeautifulSoup import BeautifulSoup
+from module.plugins.Crypter import Crypter
+
+class DuckCryptInfo(Crypter):
+    __name__ = "DuckCryptInfo"
+    __type__ = "container"
+    __pattern__ = r"http://(?:www\.)?duckcrypt.info/(folder|wait|link)/(\w+)/?(\w*)"
+    __version__ = "0.01"
+    __description__ = """DuckCrypt.Info Container Plugin"""
+    __author_name__ = ("godofdream")
+    __author_mail__ = ("soilfiction@gmail.com")
+
+    TIMER_PATTERN = r'<span id="timer">(.*)</span>'
+    
+    def decrypt(self, pyfile):
+        url = pyfile.url
+        # seems we don't need to wait
+        #src = self.req.load(str(url))
+        #found = re.search(self.TIMER_PATTERN, src)
+        #if found:
+        #    self.logDebug("Sleeping for" % found.group(1))
+        #    self.setWait(int(found.group(1)) ,False)
+        found = re.search(self.__pattern__, url)
+        if not found:
+            self.fail('Weird error in link')
+        if str(found.group(1)) == "link":
+            self.handleLink(url)
+        else:
+            self.handleFolder(found)
+
+        
+		
+    def handleFolder(self, found):
+        src = self.load("http://duckcrypt.info/ajax/auth.php?hash="  + str(found.group(2)))
+        found = re.search(self.__pattern__, src)
+        self.logDebug("Redirectet to " + str(found.group(0)))
+        src = self.load(str(found.group(0)))
+        soup = BeautifulSoup(src)
+        cryptlinks = soup.find("div", attrs={"class": "folderbox"}).findAll("a")
+        self.logDebug("Redirectet to " + str(cryptlinks))
+        if not cryptlinks:
+            self.fail('no links found - (Plugin out of date?)')
+        for clink in cryptlinks:
+            self.handleLink(clink['href'])
+
+    def handleLink(self, url):
+        src = self.load(url)
+        soup = BeautifulSoup(src)
+        link = soup.find("iframe")["src"]
+        if not link:
+            self.logDebug('no links found - (Plugin out of date?)')
+        else:
+            self.core.files.addLinks([link], self.pyfile.package().id)
+        
diff --git a/module/plugins/crypter/TrailerzoneInfo.py b/module/plugins/crypter/TrailerzoneInfo.py
index e52c5429c..2683c2429 100644
--- a/module/plugins/crypter/TrailerzoneInfo.py
+++ b/module/plugins/crypter/TrailerzoneInfo.py
@@ -5,9 +5,9 @@ from module.plugins.Crypter import Crypter
 
 class TrailerzoneInfo(Crypter):
     __name__ = "TrailerzoneInfo"
-    __type__ = "container"
+    __type__ = "crypter"
     __pattern__ = r"http://(www\.)?trailerzone.info/.*?"
-    __version__ = "0.01"
+    __version__ = "0.02"
     __description__ = """TrailerZone.info Crypter Plugin"""
     __author_name__ = ("godofdream")
     __author_mail__ = ("soilfiction@gmail.com")
diff --git a/module/plugins/hoster/IcyFilesCom.py b/module/plugins/hoster/IcyFilesCom.py
index 09458732e..3f966d936 100644
--- a/module/plugins/hoster/IcyFilesCom.py
+++ b/module/plugins/hoster/IcyFilesCom.py
@@ -41,8 +41,8 @@ def getInfo(urls):
 class IcyFilesCom(Hoster):
     __name__ = "IcyFilesCom"
     __type__ = "hoster"
-    __pattern__ = r"http://(?:www\.)?icyfiles\.com/.*"
-    __version__ = "0.03"
+    __pattern__ = r"http://(?:www\.)?icyfiles\.com/(.*)"
+    __version__ = "0.04"
     __description__ = """IcyFiles.com plugin - free only"""
     __author_name__ = ("godofdream")
     __author_mail__ = ("soilfiction@gmail.com")
@@ -53,7 +53,7 @@ class IcyFilesCom(Hoster):
     WAIT_LONGER_PATTERN = r'All download tickets are in use\. please try it again in a few seconds'
     WAIT_PATTERN = r'<div class="counter">(\d+)</div>'
     TOOMUCH_PATTERN = r'Sorry dude, you have downloaded too much\. Please wait (\d+) seconds'
-    URL_PATTERN = r'http://.*?icyfiles\.com/(.*)'
+
 
     def setup(self):
         self.multiDL = False
@@ -72,12 +72,14 @@ class IcyFilesCom(Hoster):
         timmy = re.search(self.WAIT_PATTERN, self.html)
         if timmy:
             self.logDebug("waiting", timmy.group(1))
-            self.waitSeconds(timmy.group(1))
+            self.setWait(int(timmy.group(1)) + 2, False)
+            self.wait() 
         # Downloaded to much
         timmy = re.search(self.TOOMUCH_PATTERN, self.html)
         if timmy:
             self.logDebug("too much", timmy.group(1))
-            self.waitSeconds(timmy.group(1))
+            self.setWait(int(timmy.group(1)), True)
+            self.wait() 
         # Find Name
         found = re.search(self.FILE_NAME_PATTERN, self.html)
         if found is None:
@@ -85,7 +87,7 @@ class IcyFilesCom(Hoster):
         pyfile.name = found.group(1)
         # Get the URL
         url = pyfile.url
-        found = re.search(self.URL_PATTERN, url)
+        found = re.search(self.__pattern__, url)
         if found is None:
             self.fail("Parse error (URL)")
         download_url = "http://icyfiles.com/download.php?key=" + found.group(1)
@@ -108,7 +110,3 @@ class IcyFilesCom(Hoster):
 
     def waitForFreeSlot(self):
         self.retry(60, 60, "Wait for free slot")
-
-    def waitSeconds(self, seconds):
-        self.setWait(int(seconds) + 2)
-        self.wait() 
-- 
cgit v1.2.3