diff options
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/accounts/MultishareCz.py | 2 | ||||
-rw-r--r-- | module/plugins/accounts/UploadedTo.py | 8 | ||||
-rw-r--r-- | module/plugins/hoster/MegauploadCom.py | 23 | ||||
-rw-r--r-- | module/plugins/hoster/MultishareCz.py | 26 |
4 files changed, 26 insertions, 33 deletions
diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py index 6b5402c08..cc3e430af 100644 --- a/module/plugins/accounts/MultishareCz.py +++ b/module/plugins/accounts/MultishareCz.py @@ -39,7 +39,7 @@ class MultishareCz(Account): html = req.load("http://www.multishare.cz/profil/", decode = True) found = re.search(self.TRAFFIC_LEFT_PATTERN, html) - trafficleft = parseFileSize(found.group('S'), found.group('U')) if found else 0 + trafficleft = parseFileSize(found.group('S'), found.group('U')) / 1024 if found else 0 self.premium = True if trafficleft else False html = req.load("http://www.multishare.cz/", decode = True) diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index 0bc7c2fd0..b4d194396 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -23,7 +23,7 @@ from time import time class UploadedTo(Account): __name__ = "UploadedTo" - __version__ = "0.2" + __version__ = "0.21" __type__ = "account" __description__ = """ul.to account plugin""" __author_name__ = ("mkaay") @@ -45,8 +45,10 @@ class UploadedTo(Account): if raw_valid == "unlimited": validuntil = -1 else: - raw_valid = re.findall(r"\d+", raw_valid) - validuntil = time() + 24 * 60 * 60 * int(raw_valid[0]) + 60 * 60 * int(raw_valid[1]) + raw_valid = re.findall(r"(\d+) (weeks|days|hours)", raw_valid) + validuntil = time() + for n, u in raw_valid: + validuntil += 3600 * int(n) * {"weeks": 168, "days": 24, "hours": 1}[u] return {"validuntil":validuntil, "trafficleft":traffic, "maxtraffic":50*1024*1024} else: diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index 87ac3f7f9..100553ebf 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -65,13 +65,15 @@ class MegauploadCom(Hoster): __name__ = "MegauploadCom"
__type__ = "hoster"
__pattern__ = r"http://[\w\.]*?(megaupload)\.com/.*?(\?|&)d=(?P<id>[0-9A-Za-z]+)"
- __version__ = "0.27"
+ __version__ = "0.28"
__description__ = """Megaupload.com Download Hoster"""
__author_name__ = ("spoob")
__author_mail__ = ("spoob@pyload.org")
API_URL = "http://megaupload.com/mgr_linkcheck.php"
- API_STATUS_MAPPING = {"0": statusMap['online'], "1": statusMap['offline'], "3": statusMap['temp. offline']}
+ API_STATUS_MAPPING = {"0": statusMap['online'], "1": statusMap['offline'], "3": statusMap['temp. offline']}
+
+ FILE_URL_PATTERN = r'<a href="([^"]+)" class="download_regular_usual"'
def init(self):
self.html = [None, None]
@@ -96,15 +98,13 @@ class MegauploadCom(Hoster): if not self.file_exists():
self.offline()
+ url = self.get_file_url()
+ if not url: self.fail("URL could not be retrieved")
+
time = self.get_wait_time()
self.setWait(time)
self.wait()
- pyfile.name = self.get_file_name()
- url = self.get_file_url()
- if url is None:
- return self.fail("URL could not be retrieved")
-
try:
self.download(url)
except BadHeader, e:
@@ -114,7 +114,7 @@ class MegauploadCom(Hoster): check = self.checkDownload({"limit": "Download limit exceeded"})
if check == "limit":
self.checkWait()
-
+
else:
self.download_api()
pyfile.name = self.get_file_name()
@@ -233,9 +233,8 @@ class MegauploadCom(Hoster): self.offline()
def get_file_url(self):
- file_url_pattern = 'id="downloadlink"><a href="(.*)"\s+(?:onclick|class)="'
- search = re.search(file_url_pattern, self.html[1])
- return search.group(1).replace(" ", "%20")
+ search = re.search(self.FILE_URL_PATTERN, self.html[1])
+ return search.group(1).replace(" ", "%20") if search else None
def get_file_name(self):
try:
@@ -251,7 +250,7 @@ class MegauploadCom(Hoster): if time:
return time.group(1)
else:
- return 45
+ return 60
def file_exists(self):
#self.download_html()
diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index e2150a3aa..a0dda30b8 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -23,20 +23,22 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MultishareCz(SimpleHoster): __name__ = "MultishareCz" __type__ = "hoster" - __pattern__ = r"http://(\w*\.)?multishare.cz/stahnout/.*" - __version__ = "0.33" + __pattern__ = r"http://(?:\w*\.)?multishare.cz/stahnout/(?P<ID>\d+).*" + __version__ = "0.34" __description__ = """MultiShare.cz""" __author_name__ = ("zoidberg") - FILE_ID_PATTERN = r'/stahnout/(?P<ID>\d+)/' FILE_INFO_PATTERN = ur'(?:<li>Název|Soubor): <strong>(?P<N>[^<]+)</strong><(?:/li><li|br)>Velikost: <strong>(?P<S>[^<]+)</strong>' FILE_OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>Požadovaný soubor neexistuje.</strong></p>' FILE_SIZE_REPLACEMENTS = [(' ', '')] def process(self, pyfile): - if re.match(self.__pattern__, pyfile.url): + msurl = re.match(self.__pattern__, pyfile.url) + if msurl: + self.fileID = msurl.group('ID') self.html = self.load(pyfile.url, decode = True) - self.getFileInfo() + self.getFileInfo() + if self.premium: self.handlePremium() else: @@ -45,18 +47,14 @@ class MultishareCz(SimpleHoster): self.handleOverriden() def handleFree(self): - self.download("http://www.multishare.cz/html/download_free.php", get={ - "ID": self.getFileID() - }) + self.download("http://www.multishare.cz/html/download_free.php?ID=%s" % self.fileID) def handlePremium(self): if not self.checkCredit(): self.logWarning("Not enough credit left to download file") self.resetAccount() - self.download("http://www.multishare.cz/html/download_premium.php", get={ - "ID": self.getFileID() - }) + self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.fileID) def handleOverriden(self): if not self.premium: @@ -73,12 +71,6 @@ class MultishareCz(SimpleHoster): self.logDebug(url, params) self.download(url, get = params) - def getFileID(self): - found = re.search(self.FILE_ID_PATTERN, self.pyfile.url) - if not found: self.fail("Parse error (ID)") - - return found.group('ID') - def checkCredit(self): self.acc_info = self.account.getAccountInfo(self.user, True) self.logInfo("User %s has %i MB left" % (self.user, self.acc_info["trafficleft"]/1024)) |