# -*- coding: utf-8 -*- from __future__ import with_statement import re import unicodedata from os import remove from module.plugins.Hoster import Hoster from module.plugins.ReCaptcha import ReCaptcha from module.network.RequestFactory import getURL def unicode2str(unitext): return unicodedata.normalize('NFKD', unitext).encode('ascii', 'ignore') def getInfo(urls): result = [] for url in urls: # Get html html = getURL(url) pattern = r'''

File not available

|The file could not be found\. Please check the download link''' if re.search(pattern, html): result.append((url, 0, 1, url)) continue # Name pattern = r'''
(.*?)
''' name = re.search(pattern, html).group(1) # Size pattern = r'''
File size: (.*?) (KB|MB|GB)''' m = re.search(pattern, html) value = float(m.group(1)) pow = {'KB' : 1, 'MB' : 2, 'GB' : 3}[m.group(2)] size = int(value*1024**pow) # Return info result.append((name, size, 2, url)) yield result class UploadStationCom(Hoster): __name__ = "UploadStationCom" __type__ = "hoster" __pattern__ = r"http://(www\.)?uploadstation\.com/file/[A-Za-z0-9]+" __version__ = "0.2" __description__ = """UploadStation.Com File Download Hoster""" __author_name__ = ("fragonib") __author_mail__ = ("fragonib[AT]yahoo[DOT]es") def setup(self): self.multiDL = False self.fileId = re.search(r"uploadstation\.com/file/([a-zA-Z0-9]+)(http:.*)?", self.pyfile.url).group(1) self.pyfile.url = "http://www.uploadstation.com/file/" + self.fileId def process(self, pyfile): # Get URL self.html = self.load(self.pyfile.url, ref=False, cookies=True, utf8=True) # Is offline? pattern = r'''

File not available

|The file could not be found\. Please check the download link''' m = re.search(pattern, self.html) if m is not None: self.offline() # Title pattern = r'''
(.*?)
''' title = re.search(pattern, self.html).group(1) self.pyfile.name = unicode2str(title) # Free account self.handleFree() def handleFree(self): # Not needed yet #pattern = r'''\"(/landing/.*?/download_captcha\.js)\"''' #jsPage = re.search(pattern, self.html).group(1) #self.jsPage = self.load("http://uploadstation.com" + jsPage) # Check download response = self.load(self.pyfile.url, post={"checkDownload" : "check"}) if not '"success":"showCaptcha"' in response: self.handleErrors(response) # We got a captcha? if '