summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/UloziskoSk.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-07-10 03:02:26 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-07-10 03:02:26 +0200
commit04038a2cf0c4c2d9cc9a0c8e8bf9beb6426afae8 (patch)
tree703010e32f62bf869551ce0d323dacf62bc448ff /module/plugins/hoster/UloziskoSk.py
parent[SimpleCrypter] Support parseError (diff)
downloadpyload-04038a2cf0c4c2d9cc9a0c8e8bf9beb6426afae8.tar.xz
Use parseError instead PluginParseError + unified all download pattern attributes as LINK_PATTERN + removed some old patterns (not used anymore) + other code cosmetics
Diffstat (limited to 'module/plugins/hoster/UloziskoSk.py')
-rw-r--r--module/plugins/hoster/UloziskoSk.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py
index 259f415ca..2778efa6b 100644
--- a/module/plugins/hoster/UloziskoSk.py
+++ b/module/plugins/hoster/UloziskoSk.py
@@ -18,7 +18,7 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class UloziskoSk(SimpleHoster):
@@ -30,14 +30,16 @@ class UloziskoSk(SimpleHoster):
__author_name__ = "zoidberg"
__author_mail__ = "zoidberg@mujmail.cz"
- URL_PATTERN = r'<form name = "formular" action = "([^"]+)" method = "post">'
- ID_PATTERN = r'<input type = "hidden" name = "id" value = "([^"]+)" />'
FILE_NAME_PATTERN = r'<div class="down1">(?P<N>[^<]+)</div>'
FILE_SIZE_PATTERN = ur'Veľkosť súboru: <strong>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</strong><br />'
- CAPTCHA_PATTERN = r'<img src="(/obrazky/obrazky.php\?fid=[^"]+)" alt="" />'
OFFLINE_PATTERN = ur'<span class = "red">Zadaný súbor neexistuje z jedného z nasledujúcich dôvodov:</span>'
+
+ LINK_PATTERN = r'<form name = "formular" action = "([^"]+)" method = "post">'
+ ID_PATTERN = r'<input type = "hidden" name = "id" value = "([^"]+)" />'
+ CAPTCHA_PATTERN = r'<img src="(/obrazky/obrazky.php\?fid=[^"]+)" alt="" />'
IMG_PATTERN = ur'<strong>PRE ZVÄČŠENIE KLIKNITE NA OBRÁZOK</strong><br /><a href = "([^"]+)">'
+
def process(self, pyfile):
self.html = self.load(pyfile.url, decode=True)
self.getFileInfo()
@@ -50,21 +52,21 @@ class UloziskoSk(SimpleHoster):
self.handleFree()
def handleFree(self):
- found = re.search(self.URL_PATTERN, self.html)
+ found = re.search(self.LINK_PATTERN, self.html)
if found is None:
- raise PluginParseError('URL')
+ self.parseError('URL')
parsed_url = 'http://www.ulozisko.sk' + found.group(1)
found = re.search(self.ID_PATTERN, self.html)
if found is None:
- raise PluginParseError('ID')
+ self.parseError('ID')
id = found.group(1)
self.logDebug('URL:' + parsed_url + ' ID:' + id)
found = re.search(self.CAPTCHA_PATTERN, self.html)
if found is None:
- raise PluginParseError('CAPTCHA')
+ self.parseError('CAPTCHA')
captcha_url = 'http://www.ulozisko.sk' + found.group(1)
captcha = self.decryptCaptcha(captcha_url, cookies=True)