From 78413c410e875db8d652f976183717cf3add33f4 Mon Sep 17 00:00:00 2001
From: Jeix <devnull@localhost>
Date: Sun, 3 Oct 2010 14:19:51 +0200
Subject: share-online premium fix (revert to old design, coz new one is still
 buggy)

---
 module/plugins/accounts/ShareonlineBiz.py | 36 ++++++++++++++++++++-----------
 module/plugins/hoster/ShareonlineBiz.py   | 11 ++++++----
 2 files changed, 30 insertions(+), 17 deletions(-)

(limited to 'module')

diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py
index e7405c659..a85dbbe71 100644
--- a/module/plugins/accounts/ShareonlineBiz.py
+++ b/module/plugins/accounts/ShareonlineBiz.py
@@ -29,19 +29,29 @@ class ShareonlineBiz(Account):
     __author_name__ = ("mkaay")
     __author_mail__ = ("mkaay@mkaay.de")
     
-    def loadAccountInfo(self, user):
-        req = self.getAccountRequest(user)
-        src = req.load("http://www.share-online.biz/alpha/lang/set/english")
-        validuntil = re.search(r"Account valid till:.*?<span class='.*?'>(.*?)</span>", src, re.S).group(1)
-        validuntil = int(mktime(strptime(validuntil, "%m/%d/%Y, %I:%M:%S %p")))
-
-        tmp = {"validuntil":validuntil, "trafficleft":-1}
-        return tmp
+    def getAccountInfo(self, user):
+        try:
+            req = self.core.requestFactory.getRequest(self.__name__, user)
+            src = req.load("http://www.share-online.biz/members.php?setlang=en")
+            validuntil = re.search(r'<td align="left"><b>Package Expire Date:</b></td>\s*<td align="left">(\d+/\d+/\d+</td>', src).group(1)
+            validuntil = int(mktime(strptime(validuntil, "%m/%d/%Y")))
+            
+            out = Account.getAccountInfo(self, user)
+            tmp = {"validuntil":validuntil, "trafficleft":-1}
+            out.update(tmp)
+            return out
+        except:
+            return Account.getAccountInfo(self, user)
         
     def login(self, user, data):
-        req = self.getAccountRequest(user)
-        post_vars = {"user": user,
+        req = self.core.requestFactory.getRequest(self.__name__, user)
+        post_vars = {
+                        "act": "login",
+                        "location": "index.php",
+                        "dieseid": "",
+                        "user": user,
                         "pass": data["password"],
-                        "l_rememberme":"1"}
-        req.lastURL = "http://www.share-online.biz/alpha/"
-        req.load("https://www.share-online.biz/alpha/user/login", cookies=True, post=post_vars)
+                        "login": "Login"
+                    }
+        req.lastURL = "http://www.share-online.biz/"
+        req.load("https://www.share-online.biz/login.php", cookies=True, post=post_vars)
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index 926e63a38..a441c1e30 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -75,7 +75,6 @@ class ShareonlineBiz(Hoster):
 
     def downloadHTML(self):
         self.html = self.load(self.pyfile.url, cookies=True)
-        
         if not self.account:
             html = self.load("%s/free/" % self.pyfile.url, post={"dl_free":"1"}, cookies=True)
             if re.search(r"/failure/full/1", self.req.lastEffectiveURL):
@@ -99,14 +98,18 @@ class ShareonlineBiz(Hoster):
             return True
     
     def convertURL(self):
-        self.pyfile.url = self.pyfile.url.replace("http://www.share-online.biz/download.php?id=", "http://www.share-online.biz/dl/")
-        self.pyfile.url = self.pyfile.url.replace("http://share-online.biz/download.php?id=", "http://www.share-online.biz/dl/")
+        if self.account:
+            self.pyfile.url = self.pyfile.url.replace("http://www.share-online.biz/dl/", "http://www.share-online.biz/download.php?id=")
+            self.pyfile.url = self.pyfile.url.replace("http://www.share-online.biz/dl/", "http://share-online.biz/download.php?id=")
+        else:
+            self.pyfile.url = self.pyfile.url.replace("http://www.share-online.biz/download.php?id=", "http://www.share-online.biz/dl/")
+            self.pyfile.url = self.pyfile.url.replace("http://share-online.biz/download.php?id=", "http://www.share-online.biz/dl/")
     
     def getFileUrl(self):
         """ returns the absolute downloadable filepath
         """
         if self.account:
-            return b64decode(re.search('var dl="(.*?)"', self.html).group(1))
+            return (re.search('<b>The following link contains a ticket to a valid mirror for your desired file\.</b>.*?<a href="(.*?)" onmouseout', self.html, re.S).group(1))
         file_url_pattern = 'loadfilelink\.decode\("([^"]+)'
         return b64decode(re.search(file_url_pattern, self.html).group(1))
 
-- 
cgit v1.2.3