summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-09-27 20:28:32 +0200
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-09-27 20:28:32 +0200
commitdf0b35be0bc0e2b13be8c6787bbce03082f0e08e (patch)
treeda100584baca6641693ed3b2ca5d67fb12720dbd /module/plugins/hoster
parentfilebeer.info (free only) - closed #687 (diff)
downloadpyload-df0b35be0bc0e2b13be8c6787bbce03082f0e08e.tar.xz
add filebeer.info/fastshare.cz/quickshare.cz premium, closed #688
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r--module/plugins/hoster/CramitIn.py4
-rw-r--r--module/plugins/hoster/FastshareCz.py20
-rw-r--r--module/plugins/hoster/FilebeerInfo.py46
-rw-r--r--module/plugins/hoster/FilerioCom.py12
-rw-r--r--module/plugins/hoster/QuickshareCz.py95
-rw-r--r--module/plugins/hoster/RarefileNet.py6
6 files changed, 124 insertions, 59 deletions
diff --git a/module/plugins/hoster/CramitIn.py b/module/plugins/hoster/CramitIn.py
index a7935c744..171fba0ff 100644
--- a/module/plugins/hoster/CramitIn.py
+++ b/module/plugins/hoster/CramitIn.py
@@ -5,7 +5,7 @@ class CramitIn(XFileSharingPro):
__name__ = "CramitIn"
__type__ = "hoster"
__pattern__ = r"http://(?:\w*\.)*cramit.in/\w{12}"
- __version__ = "0.03"
+ __version__ = "0.04"
__description__ = """Cramit.in hoster plugin"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
@@ -15,6 +15,6 @@ class CramitIn(XFileSharingPro):
HOSTER_NAME = "cramit.in"
def setup(self):
- self.multiDL = self.premium
+ self.resumeDownload = self.multiDL = self.premium
getInfo = create_getInfo(CramitIn) \ No newline at end of file
diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py
index 654a1abe8..d71684166 100644
--- a/module/plugins/hoster/FastshareCz.py
+++ b/module/plugins/hoster/FastshareCz.py
@@ -23,7 +23,7 @@ class FastshareCz(SimpleHoster):
__name__ = "FastshareCz"
__type__ = "hoster"
__pattern__ = r"http://(?:\w*\.)?fastshare.cz/\d+/.+"
- __version__ = "0.12"
+ __version__ = "0.13"
__description__ = """FastShare.cz"""
__author_name__ = ("zoidberg")
@@ -31,8 +31,11 @@ class FastshareCz(SimpleHoster):
FILE_SIZE_PATTERN = r'<tr><td>Velikost: </td><td style=font-weight:bold>(?P<S>[^<]+)</td></tr>'
FILE_OFFLINE_PATTERN = r'<div id="content">\s*<div style=background-color:white'
SH_HTML_ENCODING = 'cp1250'
+ FILE_URL_REPLACEMENTS = [('#.*','')]
FREE_URL_PATTERN = ur'<form method=post action=(/free/.*?)><b>Stáhnout FREE.*?<img src="([^"]*)">'
+ PREMIUM_URL_PATTERN = r'(http://data\d+\.fastshare\.cz/download\.php\?id=\d+\&[^\s\"\'<>]+)'
+ NOT_ENOUGH_CREDIC_PATTERN = "Nem.te dostate.n. kredit pro sta.en. tohoto souboru"
def handleFree(self):
found = re.search(self.FREE_URL_PATTERN, self.html)
@@ -49,4 +52,19 @@ class FastshareCz(SimpleHoster):
self.wait()
self.retry()
+ def handlePremium(self):
+ if self.NOT_ENOUGH_CREDIC_PATTERN in self.html:
+ self.logWarning('Not enough traffic left')
+ self.resetAccount()
+
+ found = re.search(self.PREMIUM_URL_PATTERN, self.html)
+ if not found: self.parseError("Premium URL")
+ url = found.group(1)
+ self.logDebug("PREMIUM URL: %s" % url)
+ self.download(url)
+
+ check = self.checkDownload({"credit": re.compile(self.NOT_ENOUGH_CREDIC_PATTERN)})
+ if check == "credit":
+ self.resetAccount()
+
getInfo = create_getInfo(FastshareCz) \ No newline at end of file
diff --git a/module/plugins/hoster/FilebeerInfo.py b/module/plugins/hoster/FilebeerInfo.py
index d7d3640a8..a51f70a09 100644
--- a/module/plugins/hoster/FilebeerInfo.py
+++ b/module/plugins/hoster/FilebeerInfo.py
@@ -24,37 +24,42 @@ from pycurl import FOLLOWLOCATION
class FilebeerInfo(SimpleHoster):
__name__ = "FilebeerInfo"
__type__ = "hoster"
- __pattern__ = r"http://(?:www\.)?filebeer\.info/(?!\d*~f)\w+"
- __version__ = "0.01"
+ __pattern__ = r"http://(?:www\.)?filebeer\.info/(?!\d*~f)(?P<ID>\w+).*"
+ __version__ = "0.02"
__description__ = """Filebeer.info plugin"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
+ FILE_NAME_PATTERN = r'Filename:\s*</td>\s*<td>\s*(?P<N>.+?)&nbsp;&nbsp;'
+ FILE_SIZE_PATTERN = r'Filesize:\s*</td>\s*<td>\s*(?P<S>[0-9.]+) (?P<U>[kKMG])i?B'
FILE_INFO_PATTERN = r'<strong>\s*(?P<N>.+?) \((?P<S>[0-9.]+) (?P<U>[kKMG])i?B\)(<br/>\s*)?</strong>'
FILE_OFFLINE_PATTERN = r'<title>Upload Files - FileBeer.info</title>'
+ FILE_URL_REPLACEMENTS = [(__pattern__, 'http://filebeer.info/\g<ID>~i')]
+
RECAPTCHA_KEY_PATTERN = r'http://www.google.com/recaptcha/api/(?:challenge|noscript)?k=(\w+)'
- FREE_URL_PATTERN = r"<a href='(http://filebeer.info/.+?\?d=1)'>"
+ DOWNLOAD_URL_PATTERN = r"\[url\](.+?)\[/url\]"
WAIT_TIME_PATTERN = r"\(\'\.download-timer-seconds\'\)\.html\((\d+)\)"
def setup(self):
self.resumeDownload = True
- self.multiDL = False
-
- def handleFree(self):
- if not 'id="form-join"' in self.html:
- found = re.search(self.FREE_URL_PATTERN, self.html)
- url = found.group(1) if found else "%s?d=1" % self.pyfile.url.rstrip('/')
-
- found = re.search(self.WAIT_TIME_PATTERN, self.html)
- self.setWait(int(found.group(1)) if found else 60)
- self.wait()
-
- self.html = self.load(url)
+ self.multiDL = self.premium
+ def handleFree(self):
+ url = self.getDownloadUrl()
+
+ for i in range(5):
+ self.html = self.load(url)
+ if i == 4 or 'id="form-join"' in self.html:
+ break
+ else:
+ found = re.search(self.WAIT_TIME_PATTERN, self.html)
+ self.setWait(int(found.group(1)) +1 if found else 61)
+ self.wait()
+
action, inputs = self.parseHtmlForm('form-join')
if not action:
- self.retry(max_tries=5, wait_time=60, reason='Form not found')
+ self.fail('Form not found')
found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html)
recaptcha_key = found.group(1) if found else '6LeuAc4SAAAAAOSry8eo2xW64K1sjHEKsQ5CaS10'
@@ -83,6 +88,13 @@ class FilebeerInfo(SimpleHoster):
self.multiDL = True
self.req.http.lastURL = action
- self.download(download_url)
+ self.download(download_url)
+
+ def handlePremium(self):
+ self.download(self.getDownloadUrl())
+
+ def getDownloadUrl(self):
+ found = re.search(self.DOWNLOAD_URL_PATTERN, self.html)
+ return ("%s?d=1" % found.group(1)) if found else ("http://filebeer.info/%s?d=1" % self.file_info['ID'])
getInfo = create_getInfo(FilebeerInfo) \ No newline at end of file
diff --git a/module/plugins/hoster/FilerioCom.py b/module/plugins/hoster/FilerioCom.py
index 3d983bedf..7be0fa4f6 100644
--- a/module/plugins/hoster/FilerioCom.py
+++ b/module/plugins/hoster/FilerioCom.py
@@ -4,17 +4,17 @@ from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInf
class FilerioCom(XFileSharingPro):
__name__ = "FilerioCom"
__type__ = "hoster"
- __pattern__ = r"http://(?:\w*\.)*file(rio|keen).com/\w{12}"
- __version__ = "0.01"
- __description__ = """FileRio.com hoster plugin"""
+ __pattern__ = r"http://(?:\w*\.)*(filerio\.(in|com)|filekeen\.com)/\w{12}"
+ __version__ = "0.02"
+ __description__ = """FileRio.in hoster plugin"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
FILE_OFFLINE_PATTERN = '<b>&quot;File Not Found&quot;</b>|File has been removed due to Copyright Claim'
- HOSTER_NAME = "filerio.com"
- DIRECT_LINK_PATTERN = r'Download Link:.*?<a href="(.*?)"'
+ HOSTER_NAME = "filerio.in"
+ FILE_URL_REPLACEMENTS = [(r'http://.*?/','http://filerio.in/')]
def setup(self):
- self.multiDL = False
+ self.resumeDownload = self.multiDL = self.premium
getInfo = create_getInfo(FilerioCom) \ No newline at end of file
diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py
index ef33d3263..4ea485672 100644
--- a/module/plugins/hoster/QuickshareCz.py
+++ b/module/plugins/hoster/QuickshareCz.py
@@ -18,51 +18,82 @@
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from pycurl import FOLLOWLOCATION
class QuickshareCz(SimpleHoster):
__name__ = "QuickshareCz"
__type__ = "hoster"
__pattern__ = r"http://.*quickshare.cz/stahnout-soubor/.*"
- __version__ = "0.52"
+ __version__ = "0.53"
__description__ = """Quickshare.cz"""
__author_name__ = ("zoidberg")
- VAR_PATTERN = r"var ID1 = '(?P<ID1>[^']+)';var ID2 = '(?P<ID2>[^']+)';var ID3 = '(?P<ID3>[^']+)';var ID4 = '(?P<ID4>[^']+)';var ID5 = '[^']*';var UU_prihlasen = '[^']*';var UU_kredit = [^;]*;var velikost = [^;]*;var kredit_odecet = [^;]*;var CaptchaText = '(?P<CaptchaText>[^']+)';var server = '(?P<Server>[^']+)';"
- FILE_OFFLINE_PATTERN = r'<script type="text/javascript">location.href=\'/chyba\';</script>'
FILE_NAME_PATTERN = r'<th width="145px">Název:</th>\s*<td style="word-wrap:break-word;">(?P<N>[^<]+)</td>'
FILE_SIZE_PATTERN = r'<th>Velikost:</th>\s*<td>(?P<S>[0-9.]+) (?P<U>[kKMG])i?B</td>'
-
- def setup(self):
- self.multiDL = False
+ FILE_OFFLINE_PATTERN = r'<script type="text/javascript">location.href=\'/chyba\';</script>'
def process(self, pyfile):
- self.html = self.load(pyfile.url, decode=True)
+ self.html = self.load(pyfile.url, decode = True)
self.getFileInfo()
-
- # parse the name from the site and set attribute in pyfile
- parsed_vars = re.search(self.VAR_PATTERN, self.html)
- if parsed_vars is None: self.parseError("VARs")
- pyfile.name = parsed_vars.group('ID3')
-
- # download the file, destination is determined by pyLoad
- download_url = parsed_vars.group('Server') + "/download.php"
- self.log.debug("File:" + pyfile.name)
- self.log.debug("URL:" + download_url)
-
- self.download(download_url, post={
- "ID1": parsed_vars.group('ID1'),
- "ID2": parsed_vars.group('ID2'),
- "ID3": parsed_vars.group('ID3'),
- "ID4": parsed_vars.group('ID4')
- })
-
- # check download
- check = self.checkDownload({
- "no_slots": "obsazen na 100 %"
- })
+ # parse js variables
+ self.jsvars = dict((x, y.strip("'")) for x,y in re.findall(r"var (\w+) = ([0-9.]+|'[^']*')", self.html))
+ self.logDebug(self.jsvars)
+ pyfile.name = self.jsvars['ID3']
+
+ # determine download type - free or premium
+ if self.premium:
+ if 'UU_prihlasen' in self.jsvars:
+ if self.jsvars['UU_prihlasen'] == '0':
+ self.logWarning('User not logged in')
+ self.relogin(user)
+ self.retry()
+ elif float(self.jsvars['UU_kredit']) < float(self.jsvars['kredit_odecet']):
+ self.logWarning('Not enough credit left')
+ self.premium = False
+
+ if self.premium:
+ self.handlePremium()
+ else:
+ self.handleFree()
+
+ check = self.checkDownload({"err": re.compile(r"\AChyba!")}, max_size=100)
+ if check == "err":
+ self.fail("File not found or plugin defect")
+
+ def handleFree(self):
+ # get download url
+ download_url = '%s/download.php' % self.jsvars['server']
+ data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ('ID1', 'ID2', 'ID3', 'ID4'))
+ self.logDebug("FREE URL1:" + download_url, data)
+
+ self.req.http.c.setopt(FOLLOWLOCATION, 0)
+ self.load(download_url, post=data)
+ self.header = self.req.http.header
+ self.req.http.c.setopt(FOLLOWLOCATION, 1)
+
+ found = re.search("Location\s*:\s*(.*)", self.header, re.I)
+ if not found: self.fail('File not found')
+ download_url = found.group(1)
+ self.logDebug("FREE URL2:" + download_url)
+
+ # check errors
+ found = re.search(r'/chyba/(\d+)', download_url)
+ if found:
+ if found.group(1) == '1':
+ self.retry(max_tries=60, wait_time=120, reason="This IP is already downloading")
+ elif found.group(1) == '2':
+ self.retry(max_tries=60, wait_time=60, reason="No free slots available")
+ else:
+ self.fail('Error %d' % found.group(1))
- if check == "no_slots":
- self.retry(5, 600, "No free slots")
+ # download file
+ self.download(download_url)
+
+ def handlePremium(self):
+ download_url = '%s/download_premium.php' % self.jsvars['server']
+ data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ('ID1', 'ID2', 'ID4', 'ID5'))
+ self.logDebug("PREMIUM URL:" + download_url, data)
+ self.download(download_url, get=data)
-create_getInfo(QuickshareCz) \ No newline at end of file
+getInfo = create_getInfo(QuickshareCz) \ No newline at end of file
diff --git a/module/plugins/hoster/RarefileNet.py b/module/plugins/hoster/RarefileNet.py
index 8339d40eb..7c5543cc8 100644
--- a/module/plugins/hoster/RarefileNet.py
+++ b/module/plugins/hoster/RarefileNet.py
@@ -7,13 +7,17 @@ class RarefileNet(XFileSharingPro):
__name__ = "RarefileNet"
__type__ = "hoster"
__pattern__ = r"http://(?:\w*\.)*rarefile.net/\w{12}"
- __version__ = "0.01"
+ __version__ = "0.02"
__description__ = """Rarefile.net hoster plugin"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
FILE_NAME_PATTERN = r'<td><font color="red">(?P<N>.*?)</font></td>'
FILE_SIZE_PATTERN = r'<td>Size : (?P<S>.+?)&nbsp;'
+ HOSTER_NAME = "rarefile.net"
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = self.premium
def handleCaptcha(self, inputs):
captcha_div = re.search(r'<b>Enter code.*?<div.*?>(.*?)</div>', self.html, re.S).group(1)