diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2011-12-10 00:12:58 +0100 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2011-12-10 00:12:58 +0100 |
commit | 68248f809d1cad27c10bac1e84afb52d5bf49ed0 (patch) | |
tree | fc33c921676429883175da3fd07a39669b2b4b30 /module/plugins/hoster | |
parent | multishare.cz premium (diff) | |
download | pyload-68248f809d1cad27c10bac1e84afb52d5bf49ed0.tar.xz |
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r-- | module/plugins/hoster/MegauploadCom.py | 23 | ||||
-rw-r--r-- | module/plugins/hoster/MultishareCz.py | 26 |
2 files changed, 20 insertions, 29 deletions
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)) |