summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/MultishareCz.py
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2011-11-13 00:47:02 +0100
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2011-11-13 00:47:02 +0100
commite3a62f8a2e9dcb4212f6fa8e1a94f832ad66d35a (patch)
tree121b107759d11e11890267355119ecf47e3e7fba /module/plugins/hoster/MultishareCz.py
parentMerged in nick_de/pyload (pull request #5) (diff)
downloadpyload-e3a62f8a2e9dcb4212f6fa8e1a94f832ad66d35a.tar.xz
Move getFileInfo to SimpleHoster.py; update Mediafire
Diffstat (limited to 'module/plugins/hoster/MultishareCz.py')
-rw-r--r--module/plugins/hoster/MultishareCz.py47
1 files changed, 8 insertions, 39 deletions
diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py
index d8dfeaed9..ac35d93e1 100644
--- a/module/plugins/hoster/MultishareCz.py
+++ b/module/plugins/hoster/MultishareCz.py
@@ -17,67 +17,36 @@
"""
import re
-from module.plugins.Hoster import Hoster
+from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
from module.network.RequestFactory import getURL
def getInfo(urls):
result = []
for url in urls:
- try:
- html = getURL(url, decode=True)
- except Exception:
- result.append((url, 0, 1, url))
- else:
- if re.search(MultishareCz.OFFLINE_PATTERN, html):
- # File offline
- result.append((url, 0, 1, url))
- else:
- # Get file info
- found = re.search(MultishareCz.FILE_INFO_PATTERN, html)
- if found is not None:
- name = found.group(1)
- size = float(found.group(2))
- units = found.group(3)
-
- pow = {'KB': 1, 'MB': 2, 'GB': 3}[units]
- size = int(size * 1024 ** pow)
-
- result.append((name, size, 2, url))
+ file_info = parseFileInfo(MultishareCz, url, getURL(url, decode=True))
+ result.append(file_info)
+
yield result
-
-class MultishareCz(Hoster):
+class MultishareCz(SimpleHoster):
__name__ = "MultishareCz"
__type__ = "hoster"
__pattern__ = r"http://(\w*\.)?multishare.cz/stahnout/.*"
- __version__ = "0.3"
+ __version__ = "0.31"
__description__ = """MultiShare.cz"""
__author_name__ = ("zoidberg")
FILE_ID_PATTERN = r'/stahnout/(\d+)/'
FILE_INFO_PATTERN = ur'<ul class="no-padding"><li>Název: <strong>([^<]+)</strong></li><li>Velikost: <strong>([^&]+)&nbsp;([^<]+)</strong>'
- OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>Požadovaný soubor neexistuje.</strong></p>'
-
- def setup(self):
- self.multiDL = False
-
- def process(self, pyfile):
- self.html = self.load(pyfile.url, decode=True)
-
- if re.search(self.OFFLINE_PATTERN, self.html) is not None:
- self.offline()
+ FILE_OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>Požadovaný soubor neexistuje.</strong></p>'
+ def handleFree(self):
found = re.search(self.FILE_ID_PATTERN, pyfile.url)
if found is None:
self.fail("Parse error (ID)")
file_id = found.group(1)
- found = re.search(self.FILE_INFO_PATTERN, self.html)
- if found is None:
- self.fail("Parse error (NAME)")
- pyfile.name = found.group(1)
-
self.download("http://www.multishare.cz/html/download_free.php", get={
"ID": file_id
}) \ No newline at end of file