Skip to content

Commit

Permalink
share-online.biz free account fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mkaay committed Feb 3, 2011
1 parent 600c9ce commit ccadf32
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
4 changes: 4 additions & 0 deletions module/plugins/Account.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ def getAccountInfo(self, name, force=False):

data.update(self.infos[name])
return data

def isPremium(self, user):
info = self.getAccountInfo(user)
return info["premium"]

def loadAccountInfo(self, name, req=None):
return {
Expand Down
9 changes: 8 additions & 1 deletion module/plugins/accounts/ShareonlineBiz.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,15 @@ def loadAccountInfo(self, user, req):
validuntil = int(mktime(strptime(validuntil.group(1), "%m/%d/%y")))
else:
validuntil = -1

acctype = re.search(r'<td align="left" ><b>Your Package:</b></td>\s*<td align="left">\s*<b>(.*?)</b>\s*</td>', src)
if acctype:
if acctype.group(1) == "Collector account (free)":
premium = False
else:
premium = True

tmp = {"validuntil":validuntil, "trafficleft":-1}
tmp = {"validuntil": validuntil, "trafficleft": -1, "premium": premium}
return tmp

def login(self, user, data, req):
Expand Down
10 changes: 5 additions & 5 deletions module/plugins/hoster/ShareonlineBiz.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ShareonlineBiz(Hoster):
def setup(self):
#self.req.canContinue = self.multiDL = True if self.account else False
# range request not working?
self.multiDL = True if self.account else False
self.multiDL = True if self.account and self.account.isPremium(self.user) else False

def process(self, pyfile):
self.convertURL()
Expand Down Expand Up @@ -75,7 +75,7 @@ def downloadAPIData(self):

def downloadHTML(self):
self.html = self.load(self.pyfile.url, cookies=True)
if not self.account:
if not self.account or not self.account.isPremium(self.user):
self.html = self.load("%s/free/" % self.pyfile.url, post={"dl_free":"1"}, cookies=True)
if re.search(r"/failure/full/1", self.req.lastEffectiveURL):
self.setWait(120)
Expand All @@ -94,7 +94,7 @@ def downloadHTML(self):
if r"Der Download ist Ihnen zu langsam" not in self.html and r"The download is too slow for you" not in self.html:
self.fail("Plugin defect. Save dumps and report.")

m = re.search("var timeout='(\d+)';", self.html[1])
m = re.search("var wait=(\d+);", self.html[1])
wait_time = int(m.group(1)) if m else 30
self.setWait(wait_time)
self.log.debug("%s: Waiting %d seconds." % (self.__name__, wait_time))
Expand All @@ -108,7 +108,7 @@ def downloadHTML(self):
return True

def convertURL(self):
if self.account:
if self.account and self.account.isPremium(self.user):
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:
Expand All @@ -119,7 +119,7 @@ def convertURL(self):
def getFileUrl(self):
""" returns the absolute downloadable filepath
"""
if self.account:
if self.account and self.account.isPremium(self.user):
try:
return re.search('loadfilelink\.decode\("(.*?)"\);', self.html, re.S).group(1)
except:
Expand Down
2 changes: 1 addition & 1 deletion testlinks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ http://www.duckload.com/dl/QggW2
http://files.mail.ru/32EW66
http://www.fileserve.com/file/MxjZXjX
http://www.4shared.com/file/-O5CBhQV/random.html
http://hotfile.com/links/101569859/08d24d3/random.bin.html
http://hotfile.com/dl/101569859/2e01f04/random.bin.html
http://www.megaupload.com/?d=1JZLOP3B
http://www.share.cx/files/235687689252/random.bin.html
http://www.share-online.biz/download.php?id=PTCOX1GL6XAH
Expand Down

0 comments on commit ccadf32

Please sign in to comment.