summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/FastshareCz.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/FastshareCz.py')
-rw-r--r--module/plugins/hoster/FastshareCz.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py
index 6fe871ad4..330a6e3b9 100644
--- a/module/plugins/hoster/FastshareCz.py
+++ b/module/plugins/hoster/FastshareCz.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urlparse import urljoin
+import urlparse
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -10,9 +9,10 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class FastshareCz(SimpleHoster):
__name__ = "FastshareCz"
__type__ = "hoster"
- __version__ = "0.27"
+ __version__ = "0.29"
__pattern__ = r'http://(?:www\.)?fastshare\.cz/\d+/.+'
+ __config__ = [("use_premium", "bool", "Use premium account if available", True)]
__description__ = """FastShare.cz hoster plugin"""
__license__ = "GPLv3"
@@ -22,11 +22,12 @@ class FastshareCz(SimpleHoster):
COOKIES = [("fastshare.cz", "lang", "en")]
- INFO_PATTERN = r'<h1 class="dwp">(?P<N>[^<]+)</h1>\s*<div class="fileinfo">\s*Size\s*: (?P<S>\d+) (?P<U>[\w^_]+),'
+ NAME_PATTERN = r'<h3 class="section_title">(?P<N>.+?)<'
+ SIZE_PATTERN = r'>Size\s*:</strong> (?P<S>[\d.,]+) (?P<U>[\w^_]+)'
OFFLINE_PATTERN = r'>(The file has been deleted|Requested page not found)'
- LINK_FREE_PATTERN = r'action=(/free/.*?)>\s*<img src="([^"]*)"><br'
- LINK_PREMIUM_PATTERN = r'(http://data\d+\.fastshare\.cz/download\.php\?id=\d+&)'
+ LINK_FREE_PATTERN = r'>Enter the code\s*:</em>\s*<span><img src="(.+?)"'
+ LINK_PREMIUM_PATTERN = r'(http://\w+\.fastshare\.cz/download\.php\?id=\d+&)'
SLOT_ERROR = "> 100% of FREE slots are full"
CREDIT_ERROR = " credit for "
@@ -53,11 +54,11 @@ class FastshareCz(SimpleHoster):
self.error(_("FREE_URL_PATTERN not found"))
baseurl = "http://www.fastshare.cz"
- captcha = self.decryptCaptcha(urljoin(baseurl, captcha_src))
- self.download(urljoin(baseurl, action), post={'code': captcha, 'btn.x': 77, 'btn.y': 18})
+ captcha = self.decryptCaptcha(urlparse.urljoin(baseurl, captcha_src))
+ self.download(urlparse.urljoin(baseurl, action), post={'code': captcha, 'btn.x': 77, 'btn.y': 18})
- def checkFile(self):
+ def checkFile(self, rules={}):
check = self.checkDownload({
'paralell-dl' : re.compile(r"<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)"),
'wrong captcha': re.compile(r'Download for FREE'),
@@ -73,7 +74,7 @@ class FastshareCz(SimpleHoster):
elif check == "credit":
self.resetAccount()
- return super(FastshareCz, self).checkFile()
+ return super(FastshareCz, self).checkFile(rules)
getInfo = create_getInfo(FastshareCz)