summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/FileSharkPl.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/FileSharkPl.py')
-rw-r--r--module/plugins/hoster/FileSharkPl.py57
1 files changed, 17 insertions, 40 deletions
diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py
index d686be480..5be339896 100644
--- a/module/plugins/hoster/FileSharkPl.py
+++ b/module/plugins/hoster/FileSharkPl.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 FileSharkPl(SimpleHoster):
__name__ = "FileSharkPl"
__type__ = "hoster"
- __version__ = "0.06"
+ __version__ = "0.11"
- __pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d{6}/\w{5}'
+ __pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d+/\w+'
+ __config__ = [("use_premium", "bool", "Use premium account if available", True)]
__description__ = """FileShark.pl hoster plugin"""
__license__ = "GPLv3"
@@ -20,25 +20,25 @@ class FileSharkPl(SimpleHoster):
("Walter Purcaro", "vuolter@gmail.com")]
- NAME_PATTERN = r'<h2 class="name-file">(?P<N>.+)</h2>'
- SIZE_PATTERN = r'<p class="size-file">(.*?)<strong>(?P<S>\d+\.?\d*)\s(?P<U>\w+)</strong></p>'
-
- OFFLINE_PATTERN = '(P|p)lik zosta. (usuni.ty|przeniesiony)'
+ NAME_PATTERN = r'<h2 class="name-file">(?P<N>.+?)</h2>'
+ SIZE_PATTERN = r'<p class="size-file">(.*?)<strong>(?P<S>\d+\.?\d*)\s(?P<U>\w+)</strong></p>'
+ OFFLINE_PATTERN = r'(P|p)lik zosta. (usuni.ty|przeniesiony)'
- LINK_FREE_PATTERN = r'<a href="(.*?)" class="btn-upload-free">'
- LINK_PREMIUM_PATTERN = r'<a href="(.*?)" class="btn-upload-premium">'
+ LINK_FREE_PATTERN = r'<a rel="nofollow" href="(.*?)" class="btn-upload-free">'
+ LINK_PREMIUM_PATTERN = r'<a rel="nofollow" href="(.*?)" class="btn-upload-premium">'
WAIT_PATTERN = r'var timeToDownload = (\d+);'
ERROR_PATTERN = r'<p class="lead text-center alert alert-warning">(.*?)</p>'
IP_ERROR_PATTERN = r'Strona jest dost.pna wy..cznie dla u.ytkownik.w znajduj.cych si. na terenie Polski'
SLOT_ERROR_PATTERN = r'Osi.gni.to maksymaln. liczb. .ci.ganych jednocze.nie plik.w\.'
- CAPTCHA_PATTERN = '<img src="data:image/jpeg;base64,(.*?)" title="captcha"'
+ CAPTCHA_PATTERN = r'<img src="data:image/jpeg;base64,(.*?)" title="captcha"'
TOKEN_PATTERN = r'name="form\[_token\]" value="(.*?)" />'
def setup(self):
self.resumeDownload = True
+
if self.premium:
self.multiDL = True
self.limitDL = 20
@@ -53,7 +53,7 @@ class FileSharkPl(SimpleHoster):
errmsg = self.info['error'] = _("Another download already run")
self.retry(15, int(m.group(1)), errmsg)
- m = re.search(self.ERROR_PATTERN, self.html):
+ m = re.search(self.ERROR_PATTERN, self.html)
if m:
alert = m.group(1)
@@ -72,19 +72,14 @@ class FileSharkPl(SimpleHoster):
self.info.pop('error', None)
- #@NOTE: handlePremium method was never been tested
- def handlePremium(self, pyfile):
- super(FilerNet, self).handlePremium(pyfile)
- if self.link:
- self.link = urljoin("http://fileshark.pl/", self.link)
-
-
def handleFree(self, pyfile):
m = re.search(self.LINK_FREE_PATTERN, self.html)
if m is None:
self.error(_("Download url not found"))
- link = urljoin("http://fileshark.pl", m.group(1))
+ link = urlparse.urljoin("http://fileshark.pl", m.group(1))
+
+ self.html = self.load(link)
m = re.search(self.WAIT_PATTERN, self.html)
if m:
@@ -112,29 +107,11 @@ class FileSharkPl(SimpleHoster):
self.load = tmp_load
- self.download(link, post=inputs, cookies=True, disposition=True)
-
-
- def checkFile(self):
- check = self.checkDownload({'wrong_captcha': re.compile(r'<label for="form_captcha" generated="true" class="error">(.*?)</label>'),
- 'wait_pattern' : re.compile(self.SECONDS_PATTERN),
- 'DL-found' : re.compile('<a href="(.*)">')})
-
- if check == "DL-found":
- self.correctCaptcha()
-
- elif check == "wrong_captcha":
- self.invalidCaptcha()
- self.retry(10, 1, _("Wrong captcha solution"))
-
- elif check == "wait_pattern":
- self.retry()
-
- return super(FileSharkPl, self).checkFile()
+ self.download(link, post=inputs, disposition=True)
def _decode64(self, data, *args, **kwargs):
- return data.decode("base64")
+ return data.decode('base64')
getInfo = create_getInfo(FileSharkPl)