From a9f81c043c62abcb3ce38971237693736833fdbe Mon Sep 17 00:00:00 2001
From: Walter Purcaro <vuolter@gmail.com>
Date: Sun, 20 Jul 2014 03:28:23 +0200
Subject: Fix hosters SH_COOKIES syntax

---
 module/plugins/hoster/BitshareCom.py     | 13 ++++++++-----
 module/plugins/hoster/DepositfilesCom.py |  5 ++---
 module/plugins/hoster/FilefactoryCom.py  |  4 +++-
 module/plugins/hoster/GigapetaCom.py     |  4 +++-
 module/plugins/hoster/LoadTo.py          | 13 ++++---------
 module/plugins/hoster/TurbobitNet.py     |  2 +-
 module/plugins/hoster/UploadheroCom.py   |  2 +-
 module/plugins/hoster/UploadingCom.py    |  8 ++++----
 module/plugins/hoster/WrzucTo.py         |  6 ++++--
 module/plugins/hoster/ZippyshareCom.py   |  3 ++-
 10 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py
index e8e0f9203..a6ed51d94 100644
--- a/module/plugins/hoster/BitshareCom.py
+++ b/module/plugins/hoster/BitshareCom.py
@@ -4,28 +4,31 @@ from __future__ import with_statement
 
 import re
 
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
 from module.plugins.internal.CaptchaService import ReCaptcha
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
 
 
 class BitshareCom(SimpleHoster):
     __name__ = "BitshareCom"
+    __version__ = "0.50"
     __type__ = "hoster"
+
     __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P<id1>[a-zA-Z0-9]+)(/(?P<name>.*?)\.html)?|\?f=(?P<id2>[a-zA-Z0-9]+))'
-    __version__ = "0.50"
+
     __description__ = """Bitshare.com hoster plugin"""
     __author_name__ = ("Paul King", "fragonib")
     __author_mail__ = ("", "fragonib[AT]yahoo[DOT]es")
 
-    HOSTER_NAME = "bitshare.com"
-    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_INFO_PATTERN = r'Downloading (?P<N>.+) - (?P<S>[\d.]+) (?P<U>\w+)</h1>'
+    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!'
 
+
     def setup(self):
-        self.req.cj.setCookie(self.HOSTER_NAME, "language_selection", "EN")
+        self.req.cj.setCookie(".bitshare.com", "language_selection", "EN")
         self.multiDL = self.premium
         self.chunkLimit = 1
 
diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py
index 5274f0f16..0192859b7 100644
--- a/module/plugins/hoster/DepositfilesCom.py
+++ b/module/plugins/hoster/DepositfilesCom.py
@@ -15,9 +15,10 @@ class DepositfilesCom(SimpleHoster):
     __author_name__ = ("spoob", "zoidberg")
     __author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz")
 
-    FILE_SIZE_PATTERN = r': <b>(?P<S>[0-9.]+)&nbsp;(?P<U>[kKMG])i?B</b>'
     FILE_NAME_PATTERN = r'<script type="text/javascript">eval\( unescape\(\'(?P<N>.*?)\''
+    FILE_SIZE_PATTERN = r': <b>(?P<S>[0-9.]+)&nbsp;(?P<U>[kKMG])i?B</b>'
     OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>'
+
     FILE_URL_REPLACEMENTS = [(r"\.com(/.*?)?/files", ".com/en/files"), (r"\.html$", "")]
     FILE_NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))),
                               (r'.*<b title="(?P<N>[^"]+).*', "\g<N>")]
@@ -27,8 +28,6 @@ class DepositfilesCom(SimpleHoster):
 
     def handleFree(self):
         self.html = self.load(self.pyfile.url, post={"gateway_result": "1"}, cookies=True)
-        if re.search(self.OFFLINE_PATTERN, self.html):
-            self.offline()
 
         if re.search(r'File is checked, please try again in a minute.', self.html) is not None:
             self.logInfo("DepositFiles.com: The file is being checked. Waiting 1 minute.")
diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py
index 0874e1410..013448b09 100644
--- a/module/plugins/hoster/FilefactoryCom.py
+++ b/module/plugins/hoster/FilefactoryCom.py
@@ -44,7 +44,9 @@ class FilefactoryCom(SimpleHoster):
     LINK_PATTERN = r'<a href="(https?://[^"]+)"[^>]*><i[^>]*></i> Download with FileFactory Premium</a>'
     OFFLINE_PATTERN = r'<h2>File Removed</h2>|This file is no longer available'
     PREMIUM_ONLY_PATTERN = r'>Premium Account Required<'
-    SH_COOKIES = [('.filefactory.com', 'locale', 'en_US.utf8')]
+
+    SH_COOKIES = [(".filefactory.com", "locale", "en_US.utf8")]
+
 
     def handleFree(self):
         self.html = self.load(self.pyfile.url, decode=True)
diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py
index bda11fc6f..566d044b4 100644
--- a/module/plugins/hoster/GigapetaCom.py
+++ b/module/plugins/hoster/GigapetaCom.py
@@ -31,11 +31,13 @@ class GigapetaCom(SimpleHoster):
     __author_name__ = "zoidberg"
     __author_mail__ = "zoidberg@mujmail.cz"
 
-    SH_COOKIES = [("http://gigapeta.com", "lang", "us")]
     FILE_NAME_PATTERN = r'<img src=".*" alt="file" />-->\s*(?P<N>.*?)\s*</td>'
     FILE_SIZE_PATTERN = r'<th>\s*Size\s*</th>\s*<td>\s*(?P<S>.*?)\s*</td>'
     OFFLINE_PATTERN = r'<div id="page_error">'
 
+    SH_COOKIES = [(".gigapeta.com", "lang", "us")]
+
+
     def handleFree(self):
         captcha_key = str(randint(1, 100000000))
         captcha_url = "http://gigapeta.com/img/captcha.gif?x=%s" % captcha_key
diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py
index 780e42ac2..14c071cc4 100644
--- a/module/plugins/hoster/LoadTo.py
+++ b/module/plugins/hoster/LoadTo.py
@@ -26,9 +26,11 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
 
 class LoadTo(SimpleHoster):
     __name__ = "LoadTo"
+    __version__ = "0.15"
     __type__ = "hoster"
+
     __pattern__ = r'http://(?:www\.)?load\.to/\w+'
-    __version__ = "0.15"
+
     __description__ = """Load.to hoster plugin"""
     __author_name__ = ("halfman", "stickell")
     __author_mail__ = ("Pulpan3@gmail.com", "l.stickell@yahoo.it")
@@ -46,14 +48,7 @@ class LoadTo(SimpleHoster):
         self.multiDL = True
         self.chunkLimit = 1
 
-    def process(self, pyfile):
-        self.html = self.load(pyfile.url, decode=True)
-        self.getFileInfo()
-
-        # Check if File is online
-        if re.search(self.OFFLINE_PATTERN, self.html):
-            self.offline()
-
+    def handleFree(self):
         # Search for Download URL
         m = re.search(self.LINK_PATTERN, self.html)
         if m is None:
diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py
index cb0166ef8..9819257c7 100644
--- a/module/plugins/hoster/TurbobitNet.py
+++ b/module/plugins/hoster/TurbobitNet.py
@@ -43,7 +43,7 @@ class TurbobitNet(SimpleHoster):
 
     FILE_URL_REPLACEMENTS = [(r"http://(?:www\.)?(turbobit.net|unextfiles.com)/(?:download/free/)?(?P<ID>\w+).*",
                               "http://turbobit.net/\g<ID>.html")]
-    SH_COOKIES = [("turbobit.net", "user_lang", "en")]
+    SH_COOKIES = [(".turbobit.net", "user_lang", "en")]
 
     LINK_PATTERN = r'(?P<url>/download/redirect/[^"\']+)'
     LIMIT_WAIT_PATTERN = r'<div id="time-limit-text">\s*.*?<span id=\'timeout\'>(\d+)</span>'
diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py
index c7850f81a..aefd30023 100644
--- a/module/plugins/hoster/UploadheroCom.py
+++ b/module/plugins/hoster/UploadheroCom.py
@@ -35,7 +35,7 @@ class UploadheroCom(SimpleHoster):
     FILE_SIZE_PATTERN = r'Taille du fichier : </span><strong>(?P<S>.*?)</strong>'
     OFFLINE_PATTERN = r'<p class="titre_dl_2">|<div class="raison"><strong>Le lien du fichier ci-dessus n\'existe plus.'
 
-    SH_COOKIES = [("http://uploadhero.co", "lang", "en")]
+    SH_COOKIES = [(".uploadhero.co", "lang", "en")]
 
     IP_BLOCKED_PATTERN = r'href="(/lightbox_block_download.php\?min=.*?)"'
     IP_WAIT_PATTERN = r'<span id="minutes">(\d+)</span>.*\s*<span id="seconds">(\d+)</span>'
diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py
index f2dc0cba2..acb833dae 100644
--- a/module/plugins/hoster/UploadingCom.py
+++ b/module/plugins/hoster/UploadingCom.py
@@ -37,10 +37,10 @@ class UploadingCom(SimpleHoster):
 
     def process(self, pyfile):
         # set lang to english
-        self.req.cj.setCookie("uploading.com", "lang", "1")
-        self.req.cj.setCookie("uploading.com", "language", "1")
-        self.req.cj.setCookie("uploading.com", "setlang", "en")
-        self.req.cj.setCookie("uploading.com", "_lang", "en")
+        self.req.cj.setCookie(".uploading.com", "lang", "1")
+        self.req.cj.setCookie(".uploading.com", "language", "1")
+        self.req.cj.setCookie(".uploading.com", "setlang", "en")
+        self.req.cj.setCookie(".uploading.com", "_lang", "en")
 
         if not "/get/" in pyfile.url:
             pyfile.url = pyfile.url.replace("/files", "/files/get")
diff --git a/module/plugins/hoster/WrzucTo.py b/module/plugins/hoster/WrzucTo.py
index b0cb54c75..3bcd8dccc 100644
--- a/module/plugins/hoster/WrzucTo.py
+++ b/module/plugins/hoster/WrzucTo.py
@@ -30,9 +30,11 @@ class WrzucTo(SimpleHoster):
     __author_name__ = "zoidberg"
     __author_mail__ = "zoidberg@mujmail.cz"
 
-    SH_COOKIES = [("http://www.wrzuc.to", "language", "en")]
-    FILE_SIZE_PATTERN = r'class="info">\s*<tr>\s*<td>(?P<S>.*?)</td>'
     FILE_NAME_PATTERN = r'id="file_info">\s*<strong>(?P<N>.*?)</strong>'
+    FILE_SIZE_PATTERN = r'class="info">\s*<tr>\s*<td>(?P<S>.*?)</td>'
+
+    SH_COOKIES = [(".wrzuc.to", "language", "en")]
+
 
     def setup(self):
         self.multiDL = True
diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py
index ea168246a..0c04d68e5 100644
--- a/module/plugins/hoster/ZippyshareCom.py
+++ b/module/plugins/hoster/ZippyshareCom.py
@@ -22,7 +22,8 @@ class ZippyshareCom(SimpleHoster):
     FILE_INFO_PATTERN = r'document\.getElementById\(\'dlbutton\'\)\.href = "[^;]*/(?P<N>[^"]+)";'
     OFFLINE_PATTERN = r'>File does not exist on this server</div>'
 
-    SH_COOKIES = [('zippyshare.com', 'ziplocale', 'en')]
+    SH_COOKIES = [(".zippyshare.com", "ziplocale", "en")]
+
 
     def setup(self):
         self.multiDL = True
-- 
cgit v1.2.3