From 578a49e391859cbe24411ca4d80432ea5c7b4474 Mon Sep 17 00:00:00 2001
From: Walter Purcaro <vuolter@gmail.com>
Date: Mon, 29 Sep 2014 00:02:51 +0200
Subject: [CatShareNet] Fixed and improved

---
 module/plugins/hoster/CatShareNet.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

(limited to 'module/plugins/hoster')

diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py
index e06547f96..121973e4d 100644
--- a/module/plugins/hoster/CatShareNet.py
+++ b/module/plugins/hoster/CatShareNet.py
@@ -9,7 +9,7 @@ from module.plugins.internal.CaptchaService import ReCaptcha
 class CatShareNet(SimpleHoster):
     __name__ = "CatShareNet"
     __type__ = "hoster"
-    __version__ = "0.05"
+    __version__ = "0.06"
 
     __pattern__ = r'http://(?:www\.)?catshare\.net/\w{16}'
 
@@ -18,18 +18,25 @@ class CatShareNet(SimpleHoster):
     __author_mail__ = ("z00nx0@gmail.com", None, "vuolter@gmail.com")
 
 
+    TEXT_ENCODING = True
+
     FILE_INFO_PATTERN = r'<title>(?P<N>.+) \((?P<S>[\d.]+) (?P<U>\w+)\)<'
     OFFLINE_PATTERN = r'Podany plik został usunięty\s*</div>'
 
     IP_BLOCKED_PATTERN = r'>Nasz serwis wykrył że Twój adres IP nie pochodzi z Polski.<'
-    SECONDS_PATTERN = 'var count = (\d+);'
+    SECONDS_PATTERN = 'var\scount\s=\s(\d+);'
     RECAPTCHA_KEY = "6Lfln9kSAAAAANZ9JtHSOgxUPB9qfDFeLUI_QMEy"
     LINK_PATTERN = r'<form action="(.+?)" method="GET">'
 
 
+    def setup(self):
+        self.multiDL = self.premium
+        self.resumeDownload = True
+
+
     def getFileInfo(self):
         m = re.search(self.IP_BLOCKED_PATTERN, self.html)
-        if m is None:
+        if m:
             self.fail("Only connections from Polish IP address are allowed")
         return super(CatShareNet, self).getFileInfo()
 
@@ -52,7 +59,7 @@ class CatShareNet(SimpleHoster):
             self.retry(reason="Wrong captcha entered")
 
         dl_link = m.group(1)
-        self.download(dl_link)
+        self.download(dl_link, disposition=True)
 
 
 getInfo = create_getInfo(CatShareNet)
-- 
cgit v1.2.3


From 01c5c24e6aa993b2060618e244f47a476725657d Mon Sep 17 00:00:00 2001
From: Walter Purcaro <vuolter@gmail.com>
Date: Wed, 1 Oct 2014 04:45:27 +0200
Subject: [OneFichierCom] Fixed wait pattern + code optimizations

---
 module/plugins/hoster/Keep2shareCC.py  | 11 ++++---
 module/plugins/hoster/OneFichierCom.py | 56 +++++++++++++++-------------------
 2 files changed, 31 insertions(+), 36 deletions(-)

(limited to 'module/plugins/hoster')

diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py
index 78d6aaba7..f17faae46 100644
--- a/module/plugins/hoster/Keep2shareCC.py
+++ b/module/plugins/hoster/Keep2shareCC.py
@@ -1,7 +1,4 @@
 # -*- coding: utf-8 -*-
-#
-# Test links:
-# http://k2s.cc/file/55fb73e1c00c5/random.bin
 
 import re
 
@@ -22,13 +19,14 @@ class Keep2shareCC(SimpleHoster):
     __author_name__ = "stickell"
     __author_mail__ = "l.stickell@yahoo.it"
 
+
     FILE_NAME_PATTERN = r'File: <span>(?P<N>.+)</span>'
     FILE_SIZE_PATTERN = r'Size: (?P<S>[^<]+)</div>'
     OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404'
 
     LINK_PATTERN = r'To download this file with slow speed, use <a href="([^"]+)">this link</a>'
     WAIT_PATTERN = r'Please wait ([\d:]+) to download this file'
-    ALREADY_DOWNLOADING_PATTERN = r'Free account does not allow to download more than one file at the same time'
+    MULTIDL_ERROR = r'Free account does not allow to download more than one file at the same time'
 
     RECAPTCHA_KEY = "6LcYcN0SAAAAABtMlxKj7X0hRxOY8_2U86kI1vbb"
 
@@ -59,7 +57,7 @@ class Keep2shareCC(SimpleHoster):
                 self.wait(wait_time, reconnect=True)
                 self.retry()
 
-            m = re.search(self.ALREADY_DOWNLOADING_PATTERN, self.html)
+            m = re.search(self.MULTIDL_ERROR, self.html)
             if m:
                 # if someone is already downloading on our line, wait 30min and retry
                 self.logDebug("Already downloading, waiting for 30 minutes")
@@ -71,6 +69,7 @@ class Keep2shareCC(SimpleHoster):
                 self.parseError("Unable to detect direct link")
             self.startDownload(m.group(1))
 
+
     def handleCaptcha(self):
         recaptcha = ReCaptcha(self)
         for _ in xrange(5):
@@ -94,11 +93,13 @@ class Keep2shareCC(SimpleHoster):
         else:
             self.fail("All captcha attempts failed")
 
+
     def startDownload(self, url):
         d = urljoin(self.base_url, url)
         self.logDebug("Direct Link: " + d)
         self.download(d, disposition=True)
 
+
     def sanitize_url(self):
         header = self.load(self.pyfile.url, just_header=True)
         if 'location' in header:
diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py
index 8a962d062..984e2bb2d 100644
--- a/module/plugins/hoster/OneFichierCom.py
+++ b/module/plugins/hoster/OneFichierCom.py
@@ -1,7 +1,4 @@
 # -*- coding: utf-8 -*-
-#
-# Test links:
-# http://5pnm24ltcw.1fichier.com/
 
 import re
 
@@ -13,41 +10,39 @@ class OneFichierCom(SimpleHoster):
     __type__ = "hoster"
     __version__ = "0.61"
 
-    __pattern__ = r'(http://(?P<id>\w+)\.(?P<host>(1fichier|d(es)?fichiers|pjointe)\.(com|fr|net|org)|(cjoint|mesfichiers|piecejointe|oi)\.(org|net)|tenvoi\.(com|org|net)|dl4free\.com|alterupload\.com|megadl.fr))/?'
+    __pattern__ = r'https?://(?P<ID>\w+)\.(?P<HOST>(1fichier|d(es)?fichiers|pjointe)\.(com|fr|net|org)|(cjoint|mesfichiers|piecejointe|oi)\.(org|net)|tenvoi\.(com|org|net)|dl4free\.com|alterupload\.com|megadl\.fr)'
 
     __description__ = """1fichier.com hoster plugin"""
     __author_name__ = ("fragonib", "the-razer", "zoidberg", "imclem", "stickell", "Elrick69")
     __author_mail__ = ("fragonib[AT]yahoo[DOT]es", "daniel_ AT gmx DOT net", "zoidberg@mujmail.cz",
                        "imclem on github", "l.stickell@yahoo.it", "elrick69[AT]rocketmail[DOT]com")
 
-    FILE_NAME_PATTERN = r'">Filename :</th>\s*<td>(?P<N>[^<]+)</td>'
-    FILE_SIZE_PATTERN = r'<th>Size :</th>\s*<td>(?P<S>[^<]+)</td>'
-    OFFLINE_PATTERN = r'The (requested)? file (could not be found|has been deleted)'
 
-    FILE_URL_REPLACEMENTS = [(__pattern__, r'http://\g<id>.\g<host>/en/')]
+    FILE_NAME_PATTERN = r'>Filename :</th>\s*<td>(?P<N>.+?)<'
+    FILE_SIZE_PATTERN = r'>Size :</th>\s*<td>(?P<S>[\d.,]+) (?P<U>\w+)'
+    OFFLINE_PATTERN = r'>The (requested)? file (could not be found|has been deleted)'
 
-    WAITING_PATTERN = r'Warning ! Without premium status, you must wait between each downloads'
-    NOT_PARALLEL = r'Warning ! Without premium status, you can download only one file at a time'
-    WAIT_TIME = 10 * 60  # Retry time between each free download
-    RETRY_TIME = 15 * 60  # Default retry time in seconds (if detected parallel download)
+    FILE_URL_REPLACEMENTS = [(__pattern__, r'http://\g<ID>.\g<HOST>/')]
+    COOKIES = [(".1fichier.com", "LG", "en")]
+
+    WAIT_PATTERN = r'>You must wait (\d+)'
 
 
     def setup(self):
-        self.multiDL = self.premium
+        self.multiDL = True
         self.resumeDownload = True
 
+
     def handleFree(self):
         self.html = self.load(self.pyfile.url, decode=True)
-
-        if self.WAITING_PATTERN in self.html:
-            self.logInfo("You have to wait been each free download! Retrying in %d seconds." % self.WAIT_TIME)
-            self.waitAndRetry(self.WAIT_TIME)
-        else:  # detect parallel download
-            m = re.search(self.NOT_PARALLEL, self.html)
-            if m:
-                self.waitAndRetry(self.RETRY_TIME)
-
-        url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['id'])
+        m = re.search(self.WAIT_PATTERN, self.html)
+        if m:
+            time = int(m.group(1)) + 1 * 60  #: One minute more than what the page displays to be safe
+            self.logInfo("You have to wait been each free download", "Retrying in %d minutes." % minutes)
+            self.wait(time, True)
+            self.retry()
+
+        url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['ID'])
         if not url:
             self.parseError("Download link not found")
 
@@ -61,8 +56,9 @@ class OneFichierCom(SimpleHoster):
         # Check download
         self.checkDownloadedFile()
 
+
     def handlePremium(self):
-        url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['id'])
+        url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['ID'])
         if not url:
             self.parseError("Download link not found")
 
@@ -76,15 +72,13 @@ class OneFichierCom(SimpleHoster):
         # Check download
         self.checkDownloadedFile()
 
+
     def checkDownloadedFile(self):
-        check = self.checkDownload({"wait": self.WAITING_PATTERN})
+        check = self.checkDownload({'wait': self.WAIT_PATTERN})
         if check == "wait":
-            self.waitAndRetry(int(self.lastcheck.group(1)) * 60)
-
-    def waitAndRetry(self, wait_time):
-        self.wait(wait_time, True)
-        self.retry()
-
+            time = int(self.lastcheck.group(1)) * 60
+            self.wait(time, True)
+            self.retry()
 
 
 getInfo = create_getInfo(OneFichierCom)
-- 
cgit v1.2.3


From a9df6627d1df9786a47cd7cdc834dd4e509a9208 Mon Sep 17 00:00:00 2001
From: Walter Purcaro <vuolter@gmail.com>
Date: Wed, 1 Oct 2014 04:53:19 +0200
Subject: [OneFichierCom] Bump version number

---
 module/plugins/hoster/OneFichierCom.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

(limited to 'module/plugins/hoster')

diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py
index 984e2bb2d..fc40a1874 100644
--- a/module/plugins/hoster/OneFichierCom.py
+++ b/module/plugins/hoster/OneFichierCom.py
@@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
 class OneFichierCom(SimpleHoster):
     __name__ = "OneFichierCom"
     __type__ = "hoster"
-    __version__ = "0.61"
+    __version__ = "0.62"
 
     __pattern__ = r'https?://(?P<ID>\w+)\.(?P<HOST>(1fichier|d(es)?fichiers|pjointe)\.(com|fr|net|org)|(cjoint|mesfichiers|piecejointe|oi)\.(org|net)|tenvoi\.(com|org|net)|dl4free\.com|alterupload\.com|megadl\.fr)'
 
@@ -22,8 +22,7 @@ class OneFichierCom(SimpleHoster):
     FILE_SIZE_PATTERN = r'>Size :</th>\s*<td>(?P<S>[\d.,]+) (?P<U>\w+)'
     OFFLINE_PATTERN = r'>The (requested)? file (could not be found|has been deleted)'
 
-    FILE_URL_REPLACEMENTS = [(__pattern__, r'http://\g<ID>.\g<HOST>/')]
-    COOKIES = [(".1fichier.com", "LG", "en")]
+    FILE_URL_REPLACEMENTS = [(__pattern__, r'http://\g<ID>.\g<HOST>/en/')]
 
     WAIT_PATTERN = r'>You must wait (\d+)'
 
-- 
cgit v1.2.3


From e5e233b45f2ce7bc98618d61d1b75bce34d4add4 Mon Sep 17 00:00:00 2001
From: Walter Purcaro <vuolter@gmail.com>
Date: Wed, 1 Oct 2014 23:28:59 +0200
Subject: [OneFichierCom] Fix typo

---
 module/plugins/hoster/OneFichierCom.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

(limited to 'module/plugins/hoster')

diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py
index fc40a1874..6cec7a9c4 100644
--- a/module/plugins/hoster/OneFichierCom.py
+++ b/module/plugins/hoster/OneFichierCom.py
@@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
 class OneFichierCom(SimpleHoster):
     __name__ = "OneFichierCom"
     __type__ = "hoster"
-    __version__ = "0.62"
+    __version__ = "0.63"
 
     __pattern__ = r'https?://(?P<ID>\w+)\.(?P<HOST>(1fichier|d(es)?fichiers|pjointe)\.(com|fr|net|org)|(cjoint|mesfichiers|piecejointe|oi)\.(org|net)|tenvoi\.(com|org|net)|dl4free\.com|alterupload\.com|megadl\.fr)'
 
@@ -28,7 +28,7 @@ class OneFichierCom(SimpleHoster):
 
 
     def setup(self):
-        self.multiDL = True
+        self.multiDL = self.premium
         self.resumeDownload = True
 
 
@@ -36,9 +36,9 @@ class OneFichierCom(SimpleHoster):
         self.html = self.load(self.pyfile.url, decode=True)
         m = re.search(self.WAIT_PATTERN, self.html)
         if m:
-            time = int(m.group(1)) + 1 * 60  #: One minute more than what the page displays to be safe
-            self.logInfo("You have to wait been each free download", "Retrying in %d minutes." % minutes)
-            self.wait(time, True)
+            wait_time = int(m.group(1)) + 1 * 60  #: One minute more than what the page displays to be safe
+            self.logInfo("You have to wait been each free download", "Retrying in %d minutes." % wait_time)
+            self.wait(wait_time, True)
             self.retry()
 
         url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['ID'])
@@ -75,8 +75,8 @@ class OneFichierCom(SimpleHoster):
     def checkDownloadedFile(self):
         check = self.checkDownload({'wait': self.WAIT_PATTERN})
         if check == "wait":
-            time = int(self.lastcheck.group(1)) * 60
-            self.wait(time, True)
+            wait_time = int(self.lastcheck.group(1)) * 60
+            self.wait(wait_time, True)
             self.retry()
 
 
-- 
cgit v1.2.3


From e17394d4fd0a70369ac424895a56a0b279dc9495 Mon Sep 17 00:00:00 2001
From: Walter Purcaro <vuolter@gmail.com>
Date: Thu, 2 Oct 2014 21:24:00 +0200
Subject: [OneFichierCom] Fix waiting again

---
 module/plugins/hoster/OneFichierCom.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'module/plugins/hoster')

diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py
index 6cec7a9c4..af5d97878 100644
--- a/module/plugins/hoster/OneFichierCom.py
+++ b/module/plugins/hoster/OneFichierCom.py
@@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
 class OneFichierCom(SimpleHoster):
     __name__ = "OneFichierCom"
     __type__ = "hoster"
-    __version__ = "0.63"
+    __version__ = "0.64"
 
     __pattern__ = r'https?://(?P<ID>\w+)\.(?P<HOST>(1fichier|d(es)?fichiers|pjointe)\.(com|fr|net|org)|(cjoint|mesfichiers|piecejointe|oi)\.(org|net)|tenvoi\.(com|org|net)|dl4free\.com|alterupload\.com|megadl\.fr)'
 
@@ -36,9 +36,9 @@ class OneFichierCom(SimpleHoster):
         self.html = self.load(self.pyfile.url, decode=True)
         m = re.search(self.WAIT_PATTERN, self.html)
         if m:
-            wait_time = int(m.group(1)) + 1 * 60  #: One minute more than what the page displays to be safe
+            wait_time = int(m.group(1)) + 1  #: One minute more than what the page displays to be safe
             self.logInfo("You have to wait been each free download", "Retrying in %d minutes." % wait_time)
-            self.wait(wait_time, True)
+            self.wait(wait_time * 60, True)
             self.retry()
 
         url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['ID'])
-- 
cgit v1.2.3


From e4042057fcc010f4e3bcb60bb4a27b42efacf48b Mon Sep 17 00:00:00 2001
From: Walter Purcaro <vuolter@gmail.com>
Date: Fri, 3 Oct 2014 08:35:26 +0200
Subject: [XFileSharingPro] Captcha refactoring + pattern improvement

---
 module/plugins/hoster/XFileSharingPro.py | 73 +++++++++++++++++---------------
 1 file changed, 40 insertions(+), 33 deletions(-)

(limited to 'module/plugins/hoster')

diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py
index 233a1fed3..8edfd8988 100644
--- a/module/plugins/hoster/XFileSharingPro.py
+++ b/module/plugins/hoster/XFileSharingPro.py
@@ -21,7 +21,7 @@ class XFileSharingPro(SimpleHoster):
     """
     __name__ = "XFileSharingPro"
     __type__ = "hoster"
-    __version__ = "0.36"
+    __version__ = "0.37"
 
     __pattern__ = r'^unmatchable$'
 
@@ -40,7 +40,7 @@ class XFileSharingPro(SimpleHoster):
     FILE_NAME_PATTERN = r'<input type="hidden" name="fname" value="(?P<N>[^"]+)"'
     FILE_SIZE_PATTERN = r'You have requested .*\((?P<S>[\d\.\,]+) ?(?P<U>\w+)?\)</font>'
 
-    OFFLINE_PATTERN = r'>\w+ (Not Found|file (was|has been) removed)'
+    OFFLINE_PATTERN = r'>\s*\w+ (Not Found|file (was|has been) removed)'
 
     WAIT_PATTERN = r'<span id="countdown_str">.*?>(\d+)</span>'
 
@@ -48,11 +48,11 @@ class XFileSharingPro(SimpleHoster):
     LINK_PATTERN = None  #: final download url pattern
 
     CAPTCHA_URL_PATTERN = r'(http://[^"\']+?/captchas?/[^"\']+)'
-    RECAPTCHA_URL_PATTERN = r'http://[^"\']+?recaptcha[^"\']+?\?k=([^"\']+)"'
-    CAPTCHA_DIV_PATTERN = r'>Enter code.*?<div.*?>(.*?)</div>'
-    SOLVEMEDIA_PATTERN = r'http:\/\/api\.solvemedia\.com\/papi\/challenge\.script\?k=(.*?)"'
+    CAPTCHA_DIV_PATTERN = r'>Enter code.*?<div.*?>(.+?)</div>'
+    RECAPTCHA_PATTERN = None
+    SOLVEMEDIA_PATTERN = None
 
-    ERROR_PATTERN = r'class=["\']err["\'][^>]*>(.*?)</'
+    ERROR_PATTERN = r'class=["\']err["\'][^>]*>(.+?)</'
 
 
     def setup(self):
@@ -317,35 +317,42 @@ class XFileSharingPro(SimpleHoster):
 
 
     def handleCaptcha(self, inputs):
-        m = re.search(self.RECAPTCHA_URL_PATTERN, self.html)
+        m = re.search(self.CAPTCHA_URL_PATTERN, self.html)
         if m:
-            recaptcha_key = unquote(m.group(1))
-            self.logDebug("RECAPTCHA KEY: %s" % recaptcha_key)
-            recaptcha = ReCaptcha(self)
-            inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(recaptcha_key)
+            captcha_url = m.group(1)
+            inputs['code'] = self.decryptCaptcha(captcha_url)
             return 1
-        else:
-            m = re.search(self.CAPTCHA_URL_PATTERN, self.html)
-            if m:
-                captcha_url = m.group(1)
-                inputs['code'] = self.decryptCaptcha(captcha_url)
-                return 2
-            else:
-                m = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.DOTALL)
-                if m:
-                    captcha_div = m.group(1)
-                    self.logDebug(captcha_div)
-                    numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div))
-                    inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))])
-                    self.logDebug("CAPTCHA", inputs['code'], numerals)
-                    return 3
-                else:
-                    m = re.search(self.SOLVEMEDIA_PATTERN, self.html)
-                    if m:
-                        captcha_key = m.group(1)
-                        captcha = SolveMedia(self)
-                        inputs['adcopy_challenge'], inputs['adcopy_response'] = captcha.challenge(captcha_key)
-                        return 4
+
+        m = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.DOTALL)
+        if m:
+            captcha_div = m.group(1)
+            self.logDebug(captcha_div)
+            numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div))
+            inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))])
+            self.logDebug("CAPTCHA", inputs['code'], numerals)
+            return 2
+
+        recaptcha = ReCaptcha(self)
+        try:
+            captcha_key = re.search(self.RECAPTCHA_PATTERN, self.html).group(1)
+        except:
+            captcha_key = recaptcha.detect_key()
+
+        if captcha_key:
+            self.logDebug("RECAPTCHA KEY: %s" % captcha_key)
+            inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key)
+            return 3
+
+        solvemedia = SolveMedia(self)
+        try:
+            captcha_key = re.search(self.SOLVEMEDIA_PATTERN, self.html).group(1)
+        except:
+            captcha_key = solvemedia.detect_key()
+
+        if captcha_key:
+            inputs['adcopy_challenge'], inputs['adcopy_response'] = solvemedia.challenge(captcha_key)
+            return 4
+
         return 0
 
 
-- 
cgit v1.2.3


From 6a3a5045ba429d89b795ccc76a145b16c7e83cba Mon Sep 17 00:00:00 2001
From: Walter Purcaro <vuolter@gmail.com>
Date: Fri, 3 Oct 2014 09:01:05 +0200
Subject: [XFileSharingPro] TEMP_OFFLINE_PATTERN

---
 module/plugins/hoster/XFileSharingPro.py | 1 +
 1 file changed, 1 insertion(+)

(limited to 'module/plugins/hoster')

diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py
index 8edfd8988..c95e52e73 100644
--- a/module/plugins/hoster/XFileSharingPro.py
+++ b/module/plugins/hoster/XFileSharingPro.py
@@ -41,6 +41,7 @@ class XFileSharingPro(SimpleHoster):
     FILE_SIZE_PATTERN = r'You have requested .*\((?P<S>[\d\.\,]+) ?(?P<U>\w+)?\)</font>'
 
     OFFLINE_PATTERN = r'>\s*\w+ (Not Found|file (was|has been) removed)'
+    TEMP_OFFLINE_PATTERN = r'>\s*\w+ server (is in )?(maintenance|maintainance)'
 
     WAIT_PATTERN = r'<span id="countdown_str">.*?>(\d+)</span>'
 
-- 
cgit v1.2.3


From 9a8c57c198bf88c87872166caa35780f476c3b16 Mon Sep 17 00:00:00 2001
From: Walter Purcaro <vuolter@gmail.com>
Date: Fri, 3 Oct 2014 09:01:44 +0200
Subject: [MovReelCom] Fixed LINK_PATTERN

---
 module/plugins/hoster/MovReelCom.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

(limited to 'module/plugins/hoster')

diff --git a/module/plugins/hoster/MovReelCom.py b/module/plugins/hoster/MovReelCom.py
index eef4e2580..fa5a2265a 100644
--- a/module/plugins/hoster/MovReelCom.py
+++ b/module/plugins/hoster/MovReelCom.py
@@ -6,7 +6,7 @@ from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInf
 class MovReelCom(XFileSharingPro):
     __name__ = "MovReelCom"
     __type__ = "hoster"
-    __version__ = "1.20"
+    __version__ = "1.21"
 
     __pattern__ = r'http://(?:www\.)?movreel\.com/\w{12}'
 
@@ -17,9 +17,10 @@ class MovReelCom(XFileSharingPro):
 
     HOSTER_NAME = "movreel.com"
 
-    FILE_INFO_PATTERN = r'<h3>(?P<N>.+?) <small><sup>(?P<S>[\d.]+) (?P<U>..)</sup> </small></h3>'
-    OFFLINE_PATTERN = r'<b>File Not Found</b><br><br>'
-    LINK_PATTERN = r'<a href="(http://[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/.*)">Download Link</a>'
+    FILE_NAME_PATTERN = r'Filename: <b>(?P<N>.+?)<'
+    FILE_SIZE_PATTERN = r'Size: (?P<S>[\d.]+) (?P<U>\w+)'
+
+    LINK_PATTERN = r'<a href="([^"]+)">Download Link'
 
 
 getInfo = create_getInfo(MovReelCom)
-- 
cgit v1.2.3


From 23ae563604dca1dae262fbc598154b99b2f1eae8 Mon Sep 17 00:00:00 2001
From: Walter Purcaro <vuolter@gmail.com>
Date: Fri, 3 Oct 2014 09:06:05 +0200
Subject: Update plugins after CaptchaService and XFileSharingPro changes

---
 module/plugins/hoster/BitshareCom.py     | 12 +++++++-----
 module/plugins/hoster/CatShareNet.py     |  8 ++++++--
 module/plugins/hoster/CrockoCom.py       | 13 +++++--------
 module/plugins/hoster/DateiTo.py         |  8 ++++----
 module/plugins/hoster/DepositfilesCom.py | 13 +++----------
 module/plugins/hoster/EasybytezCom.py    |  2 +-
 module/plugins/hoster/EgoFilesCom.py     |  9 +++++++--
 module/plugins/hoster/EpicShareNet.py    |  1 -
 module/plugins/hoster/FilecloudIo.py     | 18 +++++++++++-------
 module/plugins/hoster/FilepostCom.py     |  4 ++--
 module/plugins/hoster/FilerNet.py        |  9 +++++++--
 module/plugins/hoster/FilerioCom.py      |  2 +-
 module/plugins/hoster/IfileIt.py         |  5 +++--
 module/plugins/hoster/Keep2shareCC.py    |  9 ++++++---
 module/plugins/hoster/KingfilesNet.py    | 12 +++++-------
 module/plugins/hoster/LemUploadsCom.py   |  1 -
 module/plugins/hoster/LetitbitNet.py     |  9 +++++++--
 module/plugins/hoster/LoadTo.py          |  9 ++++-----
 module/plugins/hoster/LuckyShareNet.py   |  8 ++++++--
 module/plugins/hoster/MediafireCom.py    | 22 +++++++++-------------
 module/plugins/hoster/MegaFilesSe.py     |  2 +-
 module/plugins/hoster/OboomCom.py        |  9 ++++++---
 module/plugins/hoster/RapidgatorNet.py   |  8 ++++----
 module/plugins/hoster/RyushareCom.py     | 13 ++++++-------
 module/plugins/hoster/SecureUploadEu.py  |  1 -
 module/plugins/hoster/TurbobitNet.py     | 15 ++++++++-------
 module/plugins/hoster/UpstoreNet.py      |  6 +++---
 module/plugins/hoster/UptoboxCom.py      |  1 -
 module/plugins/hoster/VidPlayNet.py      |  1 -
 29 files changed, 122 insertions(+), 108 deletions(-)

(limited to 'module/plugins/hoster')

diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py
index 3c84ce5da..d7143952b 100644
--- a/module/plugins/hoster/BitshareCom.py
+++ b/module/plugins/hoster/BitshareCom.py
@@ -23,7 +23,6 @@ class BitshareCom(SimpleHoster):
     OFFLINE_PATTERN = r'(>We are sorry, but the requested file was not found in our database|>Error - File not available<|The file was deleted either by the uploader, inactivity or due to copyright claim)'
 
     FILE_AJAXID_PATTERN = r'var ajaxdl = "(.*?)";'
-    CAPTCHA_KEY_PATTERN = r'http://api\.recaptcha\.net/challenge\?k=(.*?) '
     TRAFFIC_USED_UP = r'Your Traffic is used up for today. Upgrade to premium to continue!'
 
 
@@ -108,12 +107,15 @@ class BitshareCom(SimpleHoster):
         # Resolve captcha
         if captcha == 1:
             self.logDebug("File is captcha protected")
-            id = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1)
+            recaptcha = ReCaptcha(self)
+            captcha_key = recaptcha.detect_key()
+            if captcha_key is None:
+                self.parseError("ReCaptcha captcha key not found")
+
             # Try up to 3 times
             for i in xrange(3):
-                self.logDebug("Resolving ReCaptcha with key [%s], round %d" % (id, i + 1))
-                recaptcha = ReCaptcha(self)
-                challenge, code = recaptcha.challenge(id)
+                self.logDebug("Resolving ReCaptcha with key [%s], round %d" % (captcha_key, i + 1))
+                challenge, code = recaptcha.challenge(captcha_key)
                 response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
                                      post={"request": "validateCaptcha", "ajaxid": self.ajaxid,
                                            "recaptcha_challenge_field": challenge, "recaptcha_response_field": code})
diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py
index 121973e4d..6bfbe0f1a 100644
--- a/module/plugins/hoster/CatShareNet.py
+++ b/module/plugins/hoster/CatShareNet.py
@@ -25,7 +25,6 @@ class CatShareNet(SimpleHoster):
 
     IP_BLOCKED_PATTERN = r'>Nasz serwis wykrył że Twój adres IP nie pochodzi z Polski.<'
     SECONDS_PATTERN = 'var\scount\s=\s(\d+);'
-    RECAPTCHA_KEY = "6Lfln9kSAAAAANZ9JtHSOgxUPB9qfDFeLUI_QMEy"
     LINK_PATTERN = r'<form action="(.+?)" method="GET">'
 
 
@@ -48,7 +47,12 @@ class CatShareNet(SimpleHoster):
             self.wait(wait_time, True)
 
         recaptcha = ReCaptcha(self)
-        challenge, code = recaptcha.challenge(self.RECAPTCHA_KEY)
+
+        captcha_key = recaptcha.detect_key()
+        if captcha_key is None:
+            self.parseError("ReCaptcha key not found")
+
+        challenge, code = recaptcha.challenge(captcha_key)
         self.html = self.load(self.pyfile.url,
                               post={'recaptcha_challenge_field': challenge,
                                     'recaptcha_response_field': code})
diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py
index 80d9b3d61..8888802a9 100644
--- a/module/plugins/hoster/CrockoCom.py
+++ b/module/plugins/hoster/CrockoCom.py
@@ -22,7 +22,6 @@ class CrockoCom(SimpleHoster):
     OFFLINE_PATTERN = r"<h1>Sorry,<br />the page you're looking for <br />isn't here.</h1>|File not found"
 
     CAPTCHA_URL_PATTERN = re.compile(r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';")
-    CAPTCHA_KEY_PATTERN = re.compile(r'Recaptcha.create\("([^"]+)"')
 
     FORM_PATTERN = r'<form  method="post" action="([^"]+)">(.*?)</form>'
     FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>'
@@ -43,10 +42,10 @@ class CrockoCom(SimpleHoster):
             else:
                 break
 
-        m = re.search(self.CAPTCHA_KEY_PATTERN, self.html)
-        if m is None:
-            self.parseError('Captcha KEY')
-        captcha_key = m.group(1)
+        recaptcha = ReCaptcha(self)
+        captcha_key = recaptcha.detect_key()
+        if captcha_key is None:
+            self.parseError("ReCaptcha captcha key not found")
 
         m = re.search(self.FORM_PATTERN, self.html, re.DOTALL)
         if m is None:
@@ -54,14 +53,12 @@ class CrockoCom(SimpleHoster):
         action, form = m.groups()
         inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
 
-        recaptcha = ReCaptcha(self)
-
         for _ in xrange(5):
             inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key)
             self.download(action, post=inputs)
 
             check = self.checkDownload({
-                "captcha_err": self.CAPTCHA_KEY_PATTERN
+                "captcha_err": recaptcha.KEY_AJAX_PATTERN
             })
 
             if check == "captcha_err":
diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py
index c5155dc31..b57cdebc7 100644
--- a/module/plugins/hoster/DateiTo.py
+++ b/module/plugins/hoster/DateiTo.py
@@ -24,7 +24,6 @@ class DateiTo(SimpleHoster):
 
     WAIT_PATTERN = r'countdown\({seconds: (\d+)'
     DATA_PATTERN = r'url: "(.*?)", data: "(.*?)",'
-    RECAPTCHA_KEY_PATTERN = r'Recaptcha.create\("(.*?)"'
 
 
     def handleFree(self):
@@ -52,10 +51,11 @@ class DateiTo(SimpleHoster):
             data = dict(x.split('=') for x in m.group(2).split('&'))
 
             if url.endswith('recaptcha.php'):
-                m = re.search(self.RECAPTCHA_KEY_PATTERN, self.html)
-                recaptcha_key = m.group(1) if m else "6LdBbL8SAAAAAI0vKUo58XRwDd5Tu_Ze1DA7qTao"
+                captcha_key = recaptcha.detect_key()
+                if captcha_key is None:
+                    self.parseError("ReCaptcha key not found")
 
-                data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge(recaptcha_key)
+                data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge(captcha_key)
 
         else:
             self.fail('Too bad...')
diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py
index 9ff8c22a1..459096f96 100644
--- a/module/plugins/hoster/DepositfilesCom.py
+++ b/module/plugins/hoster/DepositfilesCom.py
@@ -29,8 +29,6 @@ class DepositfilesCom(SimpleHoster):
 
     COOKIES = [(".dfiles.eu", "lang_current", "en")]
 
-    RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)'"
-
     FREE_LINK_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"'
     PREMIUM_LINK_PATTERN = r'class="repeat"><a href="(.+?)"'
     PREMIUM_MIRROR_PATTERN = r'class="repeat_mirror"><a href="(.+?)"'
@@ -67,21 +65,16 @@ class DepositfilesCom(SimpleHoster):
         params = {'fid': m.group(1)}
         self.logDebug("FID: %s" % params['fid'])
 
-        captcha_key = '6LdRTL8SAAAAAE9UOdWZ4d0Ky-aeA7XfSqyWDM2m'
-        m = re.search(self.RECAPTCHA_PATTERN, self.html)
-        if m:
-            captcha_key = m.group(1)
-        self.logDebug("CAPTCHA_KEY: %s" % captcha_key)
-
         self.wait()
         recaptcha = ReCaptcha(self)
+        captcha_key = recaptcha.detect_key()
+        if captcha_key is None:
+            self.parseError("ReCaptcha key not found")
 
         for _ in xrange(5):
             self.html = self.load("https://dfiles.eu/get_file.php", get=params)
 
             if '<input type=button value="Continue" onclick="check_recaptcha' in self.html:
-                if not captcha_key:
-                    self.parseError('Captcha key')
                 if 'response' in params:
                     self.invalidCaptcha()
                 params['challenge'], params['response'] = recaptcha.challenge(captcha_key)
diff --git a/module/plugins/hoster/EasybytezCom.py b/module/plugins/hoster/EasybytezCom.py
index ed9230263..028bf198c 100644
--- a/module/plugins/hoster/EasybytezCom.py
+++ b/module/plugins/hoster/EasybytezCom.py
@@ -18,7 +18,7 @@ class EasybytezCom(XFileSharingPro):
     HOSTER_NAME = "easybytez.com"
 
     FILE_INFO_PATTERN = r'<span class="name">(?P<N>.+)</span><br>\s*<span class="size">(?P<S>[^<]+)</span>'
-    OFFLINE_PATTERN = r'<h1>File not available</h1>'
+    OFFLINE_PATTERN = r'>File not available'
 
     LINK_PATTERN = r'(http://(\w+\.(easyload|easybytez|zingload)\.(com|to)|\d+\.\d+\.\d+\.\d+)/files/\d+/\w+/[^"<]+)'
     OVR_LINK_PATTERN = r'<h2>Download Link</h2>\s*<textarea[^>]*>([^<]+)'
diff --git a/module/plugins/hoster/EgoFilesCom.py b/module/plugins/hoster/EgoFilesCom.py
index a99e43731..49667a722 100644
--- a/module/plugins/hoster/EgoFilesCom.py
+++ b/module/plugins/hoster/EgoFilesCom.py
@@ -24,7 +24,6 @@ class EgoFilesCom(SimpleHoster):
     OFFLINE_PATTERN = r'(File size|Rozmiar): 0 KB'
     WAIT_TIME_PATTERN = r'For next free download you have to wait <strong>((?P<m>\d*)m)? ?((?P<s>\d+)s)?</strong>'
     LINK_PATTERN = r'<a href="(?P<link>[^"]+)">Download ></a>'
-    RECAPTCHA_KEY = "6LeXatQSAAAAAHezcjXyWAni-4t302TeYe7_gfvX"
 
 
     def setup(self):
@@ -48,9 +47,15 @@ class EgoFilesCom(SimpleHoster):
             self.wait(waittime, True)
 
         downloadURL = r''
+
         recaptcha = ReCaptcha(self)
+
+        captcha_key = recaptcha.detect_key()
+        if captcha_key is None:
+            self.parseError("ReCaptcha key not found")
+
         for _ in xrange(5):
-            challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
+            challenge, response = recaptcha.challenge(captcha_key)
             post_data = {'recaptcha_challenge_field': challenge,
                          'recaptcha_response_field': response}
             self.html = self.load(self.pyfile.url, post=post_data, decode=True)
diff --git a/module/plugins/hoster/EpicShareNet.py b/module/plugins/hoster/EpicShareNet.py
index 73b16c08e..81e28f8aa 100644
--- a/module/plugins/hoster/EpicShareNet.py
+++ b/module/plugins/hoster/EpicShareNet.py
@@ -19,7 +19,6 @@ class EpicShareNet(XFileSharingPro):
 
     HOSTER_NAME = "epicshare.net"
 
-    OFFLINE_PATTERN = r'<b>File Not Found</b><br><br>'
     FILE_NAME_PATTERN = r'<b>Password:</b></div>\s*<h2>(?P<N>[^<]+)</h2>'
 
 
diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py
index 025bd483f..c90e7d6d8 100644
--- a/module/plugins/hoster/FilecloudIo.py
+++ b/module/plugins/hoster/FilecloudIo.py
@@ -26,9 +26,9 @@ class FilecloudIo(SimpleHoster):
     UKEY_PATTERN = r"'ukey'\s*:'(\w+)',"
     AB1_PATTERN = r"if\( __ab1 == '(\w+)' \)"
     ERROR_MSG_PATTERN = r'var __error_msg\s*=\s*l10n\.(.*?);'
+    RECAPTCHA_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';"
+
     LINK_PATTERN = r'"(http://s\d+.filecloud.io/%s/\d+/.*?)"'
-    RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';"
-    RECAPTCHA_KEY = "6Lf5OdISAAAAAEZObLcx5Wlv4daMaASRov1ysDB1"
 
 
     def setup(self):
@@ -43,11 +43,18 @@ class FilecloudIo(SimpleHoster):
             self.parseError("__AB1")
         data['__ab1'] = m.group(1)
 
+        recaptcha = ReCaptcha(self)
+
+        m = re.search(self.RECAPTCHA_PATTERN, self.html)
+        captcha_key = m.group(1) if m else recaptcha.detect_key()
+
+        if captcha_key is None:
+            self.parseError("ReCaptcha key not found")
+
         if not self.account:
             self.fail("User not logged in")
         elif not self.account.logged_in:
-            recaptcha = ReCaptcha(self)
-            captcha_challenge, captcha_response = recaptcha.challenge(self.RECAPTCHA_KEY)
+            captcha_challenge, captcha_response = recaptcha.challenge(captcha_key)
             self.account.form_data = {"recaptcha_challenge_field": captcha_challenge,
                                       "recaptcha_response_field": captcha_response}
             self.account.relogin(self.user)
@@ -63,9 +70,6 @@ class FilecloudIo(SimpleHoster):
 
         self.logDebug(response)
         if response['captcha']:
-            recaptcha = ReCaptcha(self)
-            m = re.search(self.RECAPTCHA_KEY_PATTERN, self.html)
-            captcha_key = m.group(1) if m else self.RECAPTCHA_KEY
             data['ctype'] = "recaptcha"
 
             for _ in xrange(5):
diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py
index c5439cf01..c96f20c06 100644
--- a/module/plugins/hoster/FilepostCom.py
+++ b/module/plugins/hoster/FilepostCom.py
@@ -24,7 +24,7 @@ class FilepostCom(SimpleHoster):
     OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>|<div class="file_info file_info_deleted">'
 
     PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file'
-    RECAPTCHA_KEY_PATTERN = r"Captcha.init\({\s*key:\s*'([^']+)'"
+    RECAPTCHA_PATTERN = r"Captcha.init\({\s*key:\s*'([^']+)'"
     FLP_TOKEN_PATTERN = r"set_store_options\({token: '([^']+)'"
 
 
@@ -37,7 +37,7 @@ class FilepostCom(SimpleHoster):
             self.parseError("Token")
         flp_token = m.group(1)
 
-        m = re.search(self.RECAPTCHA_KEY_PATTERN, self.html)
+        m = re.search(self.RECAPTCHA_PATTERN, self.html)
         if m is None:
             self.parseError("Captcha key")
         captcha_key = m.group(1)
diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py
index 3ad9f2091..3082c790b 100644
--- a/module/plugins/hoster/FilerNet.py
+++ b/module/plugins/hoster/FilerNet.py
@@ -26,7 +26,6 @@ class FilerNet(SimpleHoster):
 
     FILE_INFO_PATTERN = r'<h1 class="page-header">Free Download (?P<N>\S+) <small>(?P<S>[\w.]+) (?P<U>\w+)</small></h1>'
     OFFLINE_PATTERN = r'Nicht gefunden'
-    RECAPTCHA_KEY = "6LcFctISAAAAAAgaeHgyqhNecGJJRnxV1m_vAz3V"
     LINK_PATTERN = r'href="([^"]+)">Get download</a>'
 
 
@@ -65,9 +64,15 @@ class FilerNet(SimpleHoster):
         self.logDebug("Hash: " + hash_data)
 
         downloadURL = r''
+
         recaptcha = ReCaptcha(self)
+
+        captcha_key = recaptcha.detect_key()
+        if captcha_key is None:
+            self.parseError("ReCaptcha key not found")
+
         for _ in xrange(5):
-            challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
+            challenge, response = recaptcha.challenge(captcha_key)
             post_data = {'recaptcha_challenge_field': challenge,
                          'recaptcha_response_field': response,
                          'hash': hash_data}
diff --git a/module/plugins/hoster/FilerioCom.py b/module/plugins/hoster/FilerioCom.py
index a62f77f25..d64796531 100644
--- a/module/plugins/hoster/FilerioCom.py
+++ b/module/plugins/hoster/FilerioCom.py
@@ -17,7 +17,7 @@ class FilerioCom(XFileSharingPro):
 
     HOSTER_NAME = "filerio.in"
 
-    OFFLINE_PATTERN = r'<b>&quot;File Not Found&quot;</b>|File has been removed due to Copyright Claim'
+    OFFLINE_PATTERN = r'>&quot;File Not Found|File has been removed'
     FILE_URL_REPLACEMENTS = [(r'http://.*?/', 'http://filerio.in/')]
 
 
diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py
index 5dfd14d82..0cdb00b30 100644
--- a/module/plugins/hoster/IfileIt.py
+++ b/module/plugins/hoster/IfileIt.py
@@ -19,7 +19,7 @@ class IfileIt(SimpleHoster):
     __author_mail__ = "zoidberg@mujmail.cz"
 
     LINK_PATTERN = r'</span> If it doesn\'t, <a target="_blank" href="([^"]+)">'
-    RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';"
+    RECAPTCHA_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';"
     FILE_INFO_PATTERN = r'<span style="cursor: default;[^>]*>\s*(?P<N>.*?)\s*&nbsp;\s*<strong>\s*(?P<S>[0-9.]+)\s*(?P<U>[kKMG])i?B\s*</strong>\s*</span>'
     OFFLINE_PATTERN = r'<span style="cursor: default;[^>]*>\s*&nbsp;\s*<strong>\s*</strong>\s*</span>'
     TEMP_OFFLINE_PATTERN = r'<span class="msg_red">Downloading of this file is temporarily disabled</span>'
@@ -36,7 +36,8 @@ class IfileIt(SimpleHoster):
             self.offline()
 
         if json_response['captcha']:
-            captcha_key = re.search(self.RECAPTCHA_KEY_PATTERN, self.html).group(1)
+            captcha_key = re.search(self.RECAPTCHA_PATTERN, self.html).group(1)
+
             recaptcha = ReCaptcha(self)
             post_data['ctype'] = "recaptcha"
 
diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py
index f17faae46..bf2150a48 100644
--- a/module/plugins/hoster/Keep2shareCC.py
+++ b/module/plugins/hoster/Keep2shareCC.py
@@ -28,8 +28,6 @@ class Keep2shareCC(SimpleHoster):
     WAIT_PATTERN = r'Please wait ([\d:]+) to download this file'
     MULTIDL_ERROR = r'Free account does not allow to download more than one file at the same time'
 
-    RECAPTCHA_KEY = "6LcYcN0SAAAAABtMlxKj7X0hRxOY8_2U86kI1vbb"
-
 
     def handleFree(self):
         self.sanitize_url()
@@ -72,8 +70,13 @@ class Keep2shareCC(SimpleHoster):
 
     def handleCaptcha(self):
         recaptcha = ReCaptcha(self)
+
+        captcha_key = recaptcha.detect_key()
+        if captcha_key is None:
+            self.parseError("ReCaptcha key not found")
+
         for _ in xrange(5):
-            challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
+            challenge, response = recaptcha.challenge(captcha_key)
             post_data = {'recaptcha_challenge_field': challenge,
                          'recaptcha_response_field': response,
                          'CaptchaForm%5Bcode%5D': '',
diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py
index 4d87a5933..66a639a14 100644
--- a/module/plugins/hoster/KingfilesNet.py
+++ b/module/plugins/hoster/KingfilesNet.py
@@ -27,7 +27,6 @@ class KingfilesNet(SimpleHoster):
     RAND_ID_PATTERN = r'type=\"hidden\" name=\"rand\" value=\"(.+)\">'
 
     LINK_PATTERN = r'var download_url = \'(.+)\';'
-    SOLVEMEDIA_PATTERN = r'http://api\.solvemedia\.com/papi/challenge\.script\?k=(.+)\">'
 
 
     def setup(self):
@@ -50,13 +49,12 @@ class KingfilesNet(SimpleHoster):
                      'method_free': "+"}
         b = self.load(self.pyfile.url, post=post_data, cookies=True, decode=True)
 
-        # Do the captcha stuff
-        m = re.search(self.SOLVEMEDIA_PATTERN, b)
-        if m is None:
-            self.parseError("Captcha key not found")
-
         solvemedia = SolveMedia(self)
-        captcha_key = m.group(1)
+
+        captcha_key = solvemedia.detect_key()
+        if captcha_key is None:
+            self.parseError("SolveMedia key not found")
+
         self.logDebug("captcha_key", captcha_key)
         captcha_challenge, captcha_response = solvemedia.challenge(captcha_key)
 
diff --git a/module/plugins/hoster/LemUploadsCom.py b/module/plugins/hoster/LemUploadsCom.py
index 1b0c40b96..649e7f739 100644
--- a/module/plugins/hoster/LemUploadsCom.py
+++ b/module/plugins/hoster/LemUploadsCom.py
@@ -20,7 +20,6 @@ class LemUploadsCom(XFileSharingPro):
 
     HOSTER_NAME = "lemuploads.com"
 
-    OFFLINE_PATTERN = r'<b>File Not Found</b><br><br>'
     FILE_NAME_PATTERN = r'<b>Password:</b></div>\s*<h2>(?P<N>[^<]+)</h2>'
 
 
diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py
index ec1dd14bd..2d6130d3c 100644
--- a/module/plugins/hoster/LetitbitNet.py
+++ b/module/plugins/hoster/LetitbitNet.py
@@ -50,7 +50,6 @@ class LetitbitNet(SimpleHoster):
 
     SECONDS_PATTERN = r'seconds\s*=\s*(\d+);'
     CAPTCHA_CONTROL_FIELD = r"recaptcha_control_field\s=\s'(?P<value>[^']+)'"
-    RECAPTCHA_KEY = "6Lc9zdMSAAAAAF-7s2wuQ-036pLRbM0p8dDaQdAM"
 
 
     def setup(self):
@@ -108,7 +107,13 @@ class LetitbitNet(SimpleHoster):
         self.logDebug(response)
 
         recaptcha = ReCaptcha(self)
-        challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
+
+        captcha_key = recaptcha.detect_key()
+        if captcha_key is None:
+            self.parseError("ReCaptcha key not found")
+
+        challenge, response = recaptcha.challenge(captcha_key)
+
         post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response,
                      "recaptcha_control_field": recaptcha_control_field}
         self.logDebug("Post data to send", post_data)
diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py
index 18398e905..377509050 100644
--- a/module/plugins/hoster/LoadTo.py
+++ b/module/plugins/hoster/LoadTo.py
@@ -27,7 +27,6 @@ class LoadTo(SimpleHoster):
 
     LINK_PATTERN = r'<form method="post" action="(.+?)"'
     WAIT_PATTERN = r'type="submit" value="Download \((\d+)\)"'
-    SOLVEMEDIA_PATTERN = r'http://api\.solvemedia\.com/papi/challenge\.noscript\?k=([^"]+)'
 
     FILE_URL_REPLACEMENTS = [(r'(\w)$', r'\1/')]
 
@@ -51,12 +50,12 @@ class LoadTo(SimpleHoster):
             self.wait(m.group(1))
 
         # Load.to is using solvemedia captchas since ~july 2014:
-        m = re.search(self.SOLVEMEDIA_PATTERN, self.html)
-        if m is None:
+        solvemedia = SolveMedia(self)
+        captcha_key = solvemedia.detect_key()
+
+        if captcha_key is None:
             self.download(download_url)
         else:
-            captcha_key = m.group(1)
-            solvemedia = SolveMedia(self)
             captcha_challenge, captcha_response = solvemedia.challenge(captcha_key)
             self.download(download_url, post={"adcopy_challenge": captcha_challenge, "adcopy_response": captcha_response})
             check = self.checkDownload({"404": re.compile("\A<h1>404 Not Found</h1>")})
diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py
index de18b8512..4780c7108 100644
--- a/module/plugins/hoster/LuckyShareNet.py
+++ b/module/plugins/hoster/LuckyShareNet.py
@@ -21,7 +21,6 @@ class LuckyShareNet(SimpleHoster):
 
     FILE_INFO_PATTERN = r"<h1 class='file_name'>(?P<N>\S+)</h1>\s*<span class='file_size'>Filesize: (?P<S>[\d.]+)(?P<U>\w+)</span>"
     OFFLINE_PATTERN = r'There is no such file available'
-    RECAPTCHA_KEY = "6LdivsgSAAAAANWh-d7rPE1mus4yVWuSQIJKIYNw"
 
 
     def parseJson(self, rep):
@@ -50,8 +49,13 @@ class LuckyShareNet(SimpleHoster):
         self.wait(int(json['time']))
 
         recaptcha = ReCaptcha(self)
+
+        captcha_key = recaptcha.detect_key()
+        if captcha_key is None:
+            self.parseError("ReCaptcha key not found")
+
         for _ in xrange(5):
-            challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
+            challenge, response = recaptcha.challenge(captcha_key)
             rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" %
                             (challenge, response, json['hash']), decode=True)
             self.logDebug("JSON: " + rep)
diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py
index f83003424..f2dcc909a 100644
--- a/module/plugins/hoster/MediafireCom.py
+++ b/module/plugins/hoster/MediafireCom.py
@@ -58,7 +58,6 @@ class MediafireCom(SimpleHoster):
     LINK_PATTERN = r'<div class="download_link"[^>]*(?:z-index:(?P<zindex>\d+))?[^>]*>\s*<a href="(?P<href>http://[^"]+)"'
     JS_KEY_PATTERN = r"DoShow\('mfpromo1'\);[^{]*{((\w+)='';.*?)eval\(\2\);"
     JS_ZMODULO_PATTERN = r"\('z-index'\)\) \% (\d+)\)\);"
-    SOLVEMEDIA_PATTERN = r'http://api\.solvemedia\.com/papi/challenge\.noscript\?k=([^"]+)'
     PAGE1_ACTION_PATTERN = r'<link rel="canonical" href="([^"]+)"/>'
     PASSWORD_PATTERN = r'<form name="form_password"'
 
@@ -111,15 +110,12 @@ class MediafireCom(SimpleHoster):
         self.download(download_url)
 
     def checkCaptcha(self):
-        for _ in xrange(5):
-            m = re.search(self.SOLVEMEDIA_PATTERN, self.html)
-            if m:
-                captcha_key = m.group(1)
-                solvemedia = SolveMedia(self)
-                captcha_challenge, captcha_response = solvemedia.challenge(captcha_key)
-                self.html = self.load(self.url, post={"adcopy_challenge": captcha_challenge,
-                                                      "adcopy_response": captcha_response}, decode=True)
-            else:
-                break
-        else:
-            self.fail("No valid recaptcha solution received")
+        solvemedia = SolveMedia(self)
+
+        captcha_key = solvemedia.detect_key()
+        if captcha_key is None:
+            self.parseError("SolveMedia key not found")
+
+        captcha_challenge, captcha_response = solvemedia.challenge(captcha_key)
+        self.html = self.load(self.url, post={"adcopy_challenge": captcha_challenge,
+                                              "adcopy_response": captcha_response}, decode=True)
diff --git a/module/plugins/hoster/MegaFilesSe.py b/module/plugins/hoster/MegaFilesSe.py
index 975708597..a26d8fff3 100644
--- a/module/plugins/hoster/MegaFilesSe.py
+++ b/module/plugins/hoster/MegaFilesSe.py
@@ -16,7 +16,7 @@ class MegaFilesSe(XFileSharingPro):
 
     HOSTER_NAME = "megafiles.se"
 
-    OFFLINE_PATTERN = r'<b><font[^>]*>File Not Found</font></b><br><br>'
+    OFFLINE_PATTERN = r'><font[^>]*>File Not Found'
     FILE_NAME_PATTERN = r'<div[^>]+>\s*<b>(?P<N>[^<]+)</b>\s*</div>'
 
 
diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py
index f30c64184..637735fd9 100644
--- a/module/plugins/hoster/OboomCom.py
+++ b/module/plugins/hoster/OboomCom.py
@@ -21,8 +21,6 @@ class OboomCom(Hoster):
     __author_name__ = "stanley"
     __author_mail__ = "stanley.foerster@gmail.com"
 
-    RECAPTCHA_KEY = "6LdqpO0SAAAAAJGHXo63HyalP7H4qlRs_vff0kJX"
-
 
     def loadUrl(self, url, get=None):
         if get is None:
@@ -49,8 +47,13 @@ class OboomCom(Hoster):
 
     def solveCaptcha(self):
         recaptcha = ReCaptcha(self)
+
+        captcha_key = recaptcha.detect_key()
+        if captcha_key is None:
+            self.parseError("ReCaptcha key not found")
+
         for _ in xrange(5):
-            challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
+            challenge, response = recaptcha.challenge(captcha_key)
             apiUrl = "https://www.oboom.com/1.0/download/ticket"
             params = {"recaptcha_challenge_field": challenge,
                       "recaptcha_response_field": response,
diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py
index 3fea849ff..6265e13ef 100644
--- a/module/plugins/hoster/RapidgatorNet.py
+++ b/module/plugins/hoster/RapidgatorNet.py
@@ -34,8 +34,8 @@ class RapidgatorNet(SimpleHoster):
     WAIT_PATTERN = r'(?:Delay between downloads must be not less than|Try again in)\s*(\d+)\s*(hour|min)'
     LINK_PATTERN = r"return '(http://\w+.rapidgator.net/.*)';"
 
-    RECAPTCHA_KEY_PATTERN = r'"http://api\.recaptcha\.net/challenge\?k=(.*?)"'
-    ADSCAPTCHA_SRC_PATTERN = r'(http://api\.adscaptcha\.com/Get\.aspx[^"\']*)'
+    RECAPTCHA_PATTERN = r'"http://api\.recaptcha\.net/challenge\?k=(.*?)"'
+    ADSCAPTCHA_PATTERN = r'(http://api\.adscaptcha\.com/Get\.aspx[^"\']*)'
     SOLVEMEDIA_PATTERN = r'http://api\.solvemedia\.com/papi/challenge\.script\?k=(.*?)"'
 
 
@@ -138,12 +138,12 @@ class RapidgatorNet(SimpleHoster):
             self.parseError("Download link")
 
     def getCaptcha(self):
-        m = re.search(self.ADSCAPTCHA_SRC_PATTERN, self.html)
+        m = re.search(self.ADSCAPTCHA_PATTERN, self.html)
         if m:
             captcha_key = m.group(1)
             captcha = AdsCaptcha(self)
         else:
-            m = re.search(self.RECAPTCHA_KEY_PATTERN, self.html)
+            m = re.search(self.RECAPTCHA_PATTERN, self.html)
             if m:
                 captcha_key = m.group(1)
                 captcha = ReCaptcha(self)
diff --git a/module/plugins/hoster/RyushareCom.py b/module/plugins/hoster/RyushareCom.py
index a24090cde..49fb2b07f 100644
--- a/module/plugins/hoster/RyushareCom.py
+++ b/module/plugins/hoster/RyushareCom.py
@@ -26,7 +26,6 @@ class RyushareCom(XFileSharingPro):
 
     WAIT_PATTERN = r'You have to wait ((?P<hour>\d+) hour[s]?, )?((?P<min>\d+) minute[s], )?(?P<sec>\d+) second[s]'
     LINK_PATTERN = r'<a href="([^"]+)">Click here to download<'
-    SOLVEMEDIA_PATTERN = r'http:\/\/api\.solvemedia\.com\/papi\/challenge\.script\?k=(.*?)"'
 
 
     def getDownloadLink(self):
@@ -57,13 +56,13 @@ class RyushareCom(XFileSharingPro):
             self.retry()
 
         for _ in xrange(5):
-            m = re.search(self.SOLVEMEDIA_PATTERN, self.html)
-            if m is None:
-                self.parseError("Error parsing captcha")
-
-            captchaKey = m.group(1)
             captcha = SolveMedia(self)
-            challenge, response = captcha.challenge(captchaKey)
+
+            captcha_key = captcha.detect_key()
+            if captcha_key is None:
+                self.parseError("SolveMedia key not found")
+
+            challenge, response = captcha.challenge(captcha_key)
 
             inputs['adcopy_challenge'] = challenge
             inputs['adcopy_response'] = response
diff --git a/module/plugins/hoster/SecureUploadEu.py b/module/plugins/hoster/SecureUploadEu.py
index 187480973..e8978e658 100644
--- a/module/plugins/hoster/SecureUploadEu.py
+++ b/module/plugins/hoster/SecureUploadEu.py
@@ -18,7 +18,6 @@ class SecureUploadEu(XFileSharingPro):
     HOSTER_NAME = "secureupload.eu"
 
     FILE_INFO_PATTERN = r'<h3>Downloading (?P<N>[^<]+) \((?P<S>[^<]+)\)</h3>'
-    OFFLINE_PATTERN = r'The file was removed|File Not Found'
 
 
 getInfo = create_getInfo(SecureUploadEu)
diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py
index 13c730b05..999430bc2 100644
--- a/module/plugins/hoster/TurbobitNet.py
+++ b/module/plugins/hoster/TurbobitNet.py
@@ -36,8 +36,8 @@ class TurbobitNet(SimpleHoster):
 
     LINK_PATTERN = r'(?P<url>/download/redirect/[^"\']+)'
     LIMIT_WAIT_PATTERN = r"<div id='timeout'>(\d+)<"
-    CAPTCHA_KEY_PATTERN = r'src="http://api\.recaptcha\.net/challenge\?k=([^"]+)"'
-    CAPTCHA_SRC_PATTERN = r'<img alt="Captcha" src="(.+?)"'
+
+    CAPTCHA_URL_PATTERN = r'<img alt="Captcha" src="(.+?)"'
 
 
     def handleFree(self):
@@ -71,12 +71,13 @@ class TurbobitNet(SimpleHoster):
 
             if inputs['captcha_type'] == 'recaptcha':
                 recaptcha = ReCaptcha(self)
-                m = re.search(self.CAPTCHA_KEY_PATTERN, self.html)
-                captcha_key = m.group(1) if m else '6LcTGLoSAAAAAHCWY9TTIrQfjUlxu6kZlTYP50_c'
-                inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(
-                    captcha_key)
+                captcha_key = recaptcha.detect_key()
+                if captcha_key is None:
+                    self.parseError("ReCaptcha captcha key not found")
+
+                inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge(captcha_key)
             else:
-                m = re.search(self.CAPTCHA_SRC_PATTERN, self.html)
+                m = re.search(self.CAPTCHA_URL_PATTERN, self.html)
                 if m is None:
                     self.parseError('captcha')
                 captcha_url = m.group(1)
diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py
index 5293ce01d..cdd1abe76 100644
--- a/module/plugins/hoster/UpstoreNet.py
+++ b/module/plugins/hoster/UpstoreNet.py
@@ -39,9 +39,9 @@ class UpstoreNet(SimpleHoster):
         # STAGE 2: solv captcha and wait
         # first get the infos we need: recaptcha key and wait time
         recaptcha = ReCaptcha(self)
-        if not recaptcha.detect_key(self.html):
-            self.parseError("could not find recaptcha pattern")
-        self.logDebug("Using captcha key " + recaptcha.recaptcha_key)
+        if recaptcha.detect_key() is None:
+            self.parseError("ReCaptcha key not found")
+        self.logDebug("Using captcha key " + recaptcha.key)
         # try the captcha 5 times
         for i in xrange(5):
             m = re.search(self.WAIT_PATTERN, self.html)
diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py
index dec0ef4d9..4363820ce 100644
--- a/module/plugins/hoster/UptoboxCom.py
+++ b/module/plugins/hoster/UptoboxCom.py
@@ -21,7 +21,6 @@ class UptoboxCom(XFileSharingPro):
 
     FILE_INFO_PATTERN = r'"para_title">(?P<N>.+) \((?P<S>[\d.]+) (?P<U>\w+)\)'
     OFFLINE_PATTERN = r'>(File not found|Access Denied|404 Not Found)'
-    TEMP_OFFLINE_PATTERN = r'>This server is in maintenance mode'
 
     WAIT_PATTERN = r'>(\d+)</span> seconds<'
     LINK_PATTERN = r'"(https?://\w+\.uptobox\.com/d/.*?)"'
diff --git a/module/plugins/hoster/VidPlayNet.py b/module/plugins/hoster/VidPlayNet.py
index eb7a13e4c..fce68b29e 100644
--- a/module/plugins/hoster/VidPlayNet.py
+++ b/module/plugins/hoster/VidPlayNet.py
@@ -19,7 +19,6 @@ class VidPlayNet(XFileSharingPro):
 
     HOSTER_NAME = "vidplay.net"
 
-    OFFLINE_PATTERN = r'<b>File Not Found</b><br>\s*<br>'
     FILE_NAME_PATTERN = r'<b>Password:</b></div>\s*<h[1-6]>(?P<N>[^<]+)</h[1-6]>'
     LINK_PATTERN = r'(http://([^/]*?%s|\d+\.\d+\.\d+\.\d+)(:\d+)?(/d/|(?:/files)?/\d+/\w+/)[^"\'<&]+)' % HOSTER_NAME
 
-- 
cgit v1.2.3


From e339621f96e548e0710493dbdae4da807a54ebe8 Mon Sep 17 00:00:00 2001
From: Walter Purcaro <vuolter@gmail.com>
Date: Fri, 3 Oct 2014 09:25:04 +0200
Subject: [OboomCom] Revert captcha changes

---
 module/plugins/hoster/OboomCom.py | 50 ++++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 22 deletions(-)

(limited to 'module/plugins/hoster')

diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py
index 637735fd9..378e4c219 100644
--- a/module/plugins/hoster/OboomCom.py
+++ b/module/plugins/hoster/OboomCom.py
@@ -22,14 +22,38 @@ class OboomCom(Hoster):
     __author_mail__ = "stanley.foerster@gmail.com"
 
 
+    RECAPTCHA_KEY = "6LdqpO0SAAAAAJGHXo63HyalP7H4qlRs_vff0kJX"
+
+
+    def setup(self):
+        self.chunkLimit = 1
+        self.multiDL = self.premium
+
+
+    def process(self, pyfile):
+        self.pyfile.url.replace(".com/#id=", ".com/#")
+        self.pyfile.url.replace(".com/#/", ".com/#")
+        self.getFileId(self.pyfile.url)
+        self.getSessionToken()
+        self.getFileInfo(self.sessionToken, self.fileId)
+        self.pyfile.name = self.fileName
+        self.pyfile.size = self.fileSize
+        if not self.premium:
+            self.solveCaptcha()
+        self.getDownloadTicket()
+        self.download("https://%s/1.0/dlh" % self.downloadDomain, get={"ticket": self.downloadTicket, "http_errors": 0})
+
+
     def loadUrl(self, url, get=None):
         if get is None:
             get = dict()
         return json_loads(self.load(url, get, decode=True))
 
+
     def getFileId(self, url):
         self.fileId = re.match(OboomCom.__pattern__, url).group('ID')
 
+
     def getSessionToken(self):
         if self.premium:
             accountInfo = self.account.getAccountInfo(self.user, True)
@@ -45,15 +69,12 @@ class OboomCom(Hoster):
             else:
                 self.fail("Could not retrieve token for guest session. Error code %s" % result[0])
 
+
     def solveCaptcha(self):
         recaptcha = ReCaptcha(self)
 
-        captcha_key = recaptcha.detect_key()
-        if captcha_key is None:
-            self.parseError("ReCaptcha key not found")
-
         for _ in xrange(5):
-            challenge, response = recaptcha.challenge(captcha_key)
+            challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY)
             apiUrl = "https://www.oboom.com/1.0/download/ticket"
             params = {"recaptcha_challenge_field": challenge,
                       "recaptcha_response_field": response,
@@ -86,6 +107,7 @@ class OboomCom(Hoster):
             self.invalidCaptcha()
             self.fail("Received invalid captcha 5 times")
 
+
     def getFileInfo(self, token, fileId):
         apiUrl = "https://api.oboom.com/1.0/info"
         params = {"token": token, "items": fileId, "http_errors": 0}
@@ -101,6 +123,7 @@ class OboomCom(Hoster):
         else:
             self.fail("Could not retrieve file info. Error code %s: %s" % (result[0], result[1]))
 
+
     def getDownloadTicket(self):
         apiUrl = "https://api.oboom.com/1.0/dl"
         params = {"item": self.fileId, "http_errors": 0}
@@ -116,20 +139,3 @@ class OboomCom(Hoster):
             self.downloadTicket = result[2]
         else:
             self.fail("Could not retrieve download ticket. Error code %s" % result[0])
-
-    def setup(self):
-        self.chunkLimit = 1
-        self.multiDL = self.premium
-
-    def process(self, pyfile):
-        self.pyfile.url.replace(".com/#id=", ".com/#")
-        self.pyfile.url.replace(".com/#/", ".com/#")
-        self.getFileId(self.pyfile.url)
-        self.getSessionToken()
-        self.getFileInfo(self.sessionToken, self.fileId)
-        self.pyfile.name = self.fileName
-        self.pyfile.size = self.fileSize
-        if not self.premium:
-            self.solveCaptcha()
-        self.getDownloadTicket()
-        self.download("https://%s/1.0/dlh" % self.downloadDomain, get={"ticket": self.downloadTicket, "http_errors": 0})
-- 
cgit v1.2.3


From 0d4b92d58e6d4e959aeaa780cf29b8d88f46610a Mon Sep 17 00:00:00 2001
From: Walter Purcaro <vuolter@gmail.com>
Date: Fri, 3 Oct 2014 14:00:46 +0200
Subject: Spare code cosmetics

---
 module/plugins/hoster/BillionuploadsCom.py |  4 ++--
 module/plugins/hoster/KingfilesNet.py      | 10 ++--------
 module/plugins/hoster/XFileSharingPro.py   |  6 +++---
 3 files changed, 7 insertions(+), 13 deletions(-)

(limited to 'module/plugins/hoster')

diff --git a/module/plugins/hoster/BillionuploadsCom.py b/module/plugins/hoster/BillionuploadsCom.py
index c070e18b9..90e296e0d 100644
--- a/module/plugins/hoster/BillionuploadsCom.py
+++ b/module/plugins/hoster/BillionuploadsCom.py
@@ -17,8 +17,8 @@ class BillionuploadsCom(XFileSharingPro):
 
     HOSTER_NAME = "billionuploads.com"
 
-    FILE_NAME_PATTERN = r'<b>Filename:</b>(?P<N>.*?)<br>'
-    FILE_SIZE_PATTERN = r'<b>Size:</b>(?P<S>.*?)<br>'
+    FILE_NAME_PATTERN = r'<td class="dofir" title="(?P<N>.+?)"'
+    FILE_SIZE_PATTERN = r'<td class="dofir">(?P<S>[\d.]+) (?P<U>\w+)'
 
 
 getInfo = create_getInfo(BillionuploadsCom)
diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py
index 66a639a14..e8aefa53b 100644
--- a/module/plugins/hoster/KingfilesNet.py
+++ b/module/plugins/hoster/KingfilesNet.py
@@ -11,7 +11,7 @@ class KingfilesNet(SimpleHoster):
     __type__ = "hoster"
     __version__ = "0.01"
 
-    __pattern__ = r'http://(?:www\.)?kingfiles\.net/\w{12}'
+    __pattern__ = r'http://(?:www\.)?kingfiles\.net/(?P<ID>\w{12})'
 
     __description__ = """Kingfiles.net hoster plugin"""
     __author_name__ = ("zapp-brannigan", "Walter Purcaro")
@@ -23,7 +23,6 @@ class KingfilesNet(SimpleHoster):
 
     OFFLINE_PATTERN = r'>(File Not Found</b><br><br>|File Not Found</h2>)'
 
-    FILE_ID_PATTERN = r'<input type=\"hidden\" name=\"id\" value=\"(.+)\">'
     RAND_ID_PATTERN = r'type=\"hidden\" name=\"rand\" value=\"(.+)\">'
 
     LINK_PATTERN = r'var download_url = \'(.+)\';'
@@ -35,15 +34,10 @@ class KingfilesNet(SimpleHoster):
 
 
     def handleFree(self):
-        # Load main page and find file-id
-        a = self.load(self.pyfile.url, cookies=True, decode=True)
-        file_id = re.search(self.FILE_ID_PATTERN, a).group(1)
-        self.logDebug("file_id", file_id)
-
         # Click the free user button
         post_data = {'op': "download1",
                      'usr_login': "",
-                     'id': file_id,
+                     'id': file_info['ID'],
                      'fname': self.pyfile.name,
                      'referer': "",
                      'method_free': "+"}
diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py
index c95e52e73..18e0920fc 100644
--- a/module/plugins/hoster/XFileSharingPro.py
+++ b/module/plugins/hoster/XFileSharingPro.py
@@ -173,7 +173,7 @@ class XFileSharingPro(SimpleHoster):
         self.html = self.load(self.pyfile.url, post=self.getPostParameters())
         m = re.search(self.LINK_PATTERN, self.html)
         if m is None:
-            self.parseError('DIRECT LINK')
+            self.parseError('LINK_PATTERN not found')
         self.startDownload(m.group(1))
 
 
@@ -194,7 +194,7 @@ class XFileSharingPro(SimpleHoster):
 
         action, inputs = self.parseHtmlForm('F1')
         if not inputs:
-            self.parseError('TEXTAREA')
+            self.parseError('TEXTAREA not found')
         self.logDebug(self.HOSTER_NAME, inputs)
         if inputs['st'] == 'OK':
             self.html = self.load(action, post=inputs)
@@ -206,7 +206,7 @@ class XFileSharingPro(SimpleHoster):
         #get easybytez.com link for uploaded file
         m = re.search(self.OVR_LINK_PATTERN, self.html)
         if m is None:
-            self.parseError('DIRECT LINK (OVR)')
+            self.parseError('OVR_LINK_PATTERN not found')
         self.pyfile.url = m.group(1)
         header = self.load(self.pyfile.url, just_header=True)
         if 'location' in header:  # Direct link
-- 
cgit v1.2.3