diff options
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/hoster/CloudzerNet.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/Premium4Me.py | 45 | ||||
-rw-r--r-- | module/plugins/hoster/XvidstageCom.py | 187 |
3 files changed, 127 insertions, 109 deletions
diff --git a/module/plugins/hoster/CloudzerNet.py b/module/plugins/hoster/CloudzerNet.py index 08a54d509..7608b193d 100644 --- a/module/plugins/hoster/CloudzerNet.py +++ b/module/plugins/hoster/CloudzerNet.py @@ -20,7 +20,7 @@ class CloudzerNet(SimpleHoster): __name__ = "CloudzerNet" __type__ = "hoster" __pattern__ = r"http://(www\.)?(cloudzer\.net/file/|clz\.to/(file/)?)(?P<ID>\w+).*" - __version__ = "0.01" + __version__ = "0.02" __description__ = """Cloudzer.net hoster plugin""" __author_name__ = ("gs", "z00nx") __author_mail__ = ("I-_-I-_-I@web.de", "z00nx0@gmail.com") @@ -56,7 +56,7 @@ class CloudzerNet(SimpleHoster): self.retry() elif "Sie haben die max" in response["err"] or "You have reached the max" in response["err"]: self.logDebug("Download limit reached, waiting an hour") - self.setWait(3600) + self.setWait(3600, True) self.wait() if "type" in response: if response["type"] == "download": diff --git a/module/plugins/hoster/Premium4Me.py b/module/plugins/hoster/Premium4Me.py index 2679916e9..5dd907b9f 100644 --- a/module/plugins/hoster/Premium4Me.py +++ b/module/plugins/hoster/Premium4Me.py @@ -2,20 +2,22 @@ # -*- coding: utf-8 -*-
from urllib import quote
-from module.plugins.Hoster import Hoster
-from module.utils import fs_encode
from os.path import exists
from os import remove
+from module.plugins.Hoster import Hoster
+from module.utils import fs_encode
+
+
class Premium4Me(Hoster):
__name__ = "Premium4Me"
- __version__ = "0.04"
+ __version__ = "0.05"
__type__ = "hoster"
__pattern__ = r"http://premium4.me/.*"
__description__ = """premium4.me hoster plugin"""
- __author_name__ = ("RaNaN", "zoidberg")
- __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz")
+ __author_name__ = ("RaNaN", "zoidberg", "stickell")
+ __author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz", "l.stickell@yahoo.it")
def setup(self):
self.resumeDownload = True
@@ -29,33 +31,40 @@ class Premium4Me(Hoster): self.logDebug("premium4.me: Old URL: %s" % pyfile.url)
tra = self.getTraffic()
-
+
#raise timeout to 2min
self.req.setOption("timeout", 120)
-
- self.download("http://premium4.me/api/getfile.php?authcode=%s&link=%s" % (self.account.authcode, quote(pyfile.url, "")), disposition=True)
-
- err = ''
+
+ self.download(
+ "http://premium4.me/api/getfile.php?authcode=%s&link=%s" % (self.account.authcode, quote(pyfile.url, "")),
+ disposition=True)
+
+ check = self.checkDownload({"nopremium": "No premium account available"})
+
+ if check == "nopremium":
+ self.retry(3, 60, 'No premium account available')
+
+ err = ''
if self.req.http.code == '420':
# Custom error code send - fail
lastDownload = fs_encode(self.lastDownload)
-
- if exists(lastDownload):
+
+ if exists(lastDownload):
f = open(lastDownload, "rb")
err = f.read(256).strip()
f.close()
remove(lastDownload)
else:
err = 'File does not exist'
-
+
trb = self.getTraffic()
- self.logInfo("Filesize: %d, Traffic used %d, traffic left %d" % (pyfile.size, tra-trb, trb))
-
+ self.logInfo("Filesize: %d, Traffic used %d, traffic left %d" % (pyfile.size, tra - trb, trb))
+
if err: self.fail(err)
-
+
def getTraffic(self):
try:
- traffic = int(self.load ("http://premium4.me/api/traffic.php?authcode=%s" % self.account.authcode))
+ traffic = int(self.load("http://premium4.me/api/traffic.php?authcode=%s" % self.account.authcode))
except:
- traffic = 0
+ traffic = 0
return traffic
diff --git a/module/plugins/hoster/XvidstageCom.py b/module/plugins/hoster/XvidstageCom.py index 14079df43..4962c05af 100644 --- a/module/plugins/hoster/XvidstageCom.py +++ b/module/plugins/hoster/XvidstageCom.py @@ -1,105 +1,114 @@ # -*- coding: utf-8 -*- """ - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. - @author: 4Christopher + @author: 4Christopher """ -from module.plugins.Hoster import Hoster -from module.network.RequestFactory import getURL import re import HTMLParser +from module.plugins.Hoster import Hoster +from module.network.RequestFactory import getURL + + def setup(self): - self.wantReconnect = False - self.resumeDownload = True - self.multiDL = True + self.wantReconnect = False + self.resumeDownload = True + self.multiDL = True + def getInfo(urls): - result = [] - - for url in urls: - result.append(parseFileInfo(url, getInfoMode = True)) - yield result - -def parseFileInfo(url, getInfoMode = False): - html = getURL(url) - info = {"name" : url, "size" : 0, "status" : 3} - try: - info['name'] = re.search(r'(?:Filename|Dateiname):</b></td><td nowrap[^>]*?>(.*?)<', html).group(1) - info['size'] = re.search(r'(?:Size|Größe):</b></td><td>.*? <small>\((\d+?) bytes\)', html).group(1) - except: ## The file is offline - info['status'] = 1 - else: - info['status'] = 2 - - if getInfoMode: - return info['name'], info['size'], info['status'], url - else: - return info['name'], info['size'], info['status'], html + result = [] + + for url in urls: + result.append(parseFileInfo(url, getInfoMode=True)) + yield result + + +def parseFileInfo(url, getInfoMode=False): + html = getURL(url) + info = {"name": url, "size": 0, "status": 3} + try: + info['name'] = re.search(r'(?:Filename|Dateiname):</b></td><td nowrap[^>]*?>(.*?)<', html).group(1) + info['size'] = re.search(r'(?:Size|Größe):</b></td><td>.*? <small>\((\d+?) bytes\)', html).group(1) + except: ## The file is offline + info['status'] = 1 + else: + info['status'] = 2 + + if getInfoMode: + return info['name'], info['size'], info['status'], url + else: + return info['name'], info['size'], info['status'], html + class XvidstageCom(Hoster): - __name__ = 'XvidstageCom' - __version__ = '0.3' - __pattern__ = r'http://(?:www.)?xvidstage.com/(?P<id>[0-9A-Za-z]+)' - __type__ = 'hoster' - __description__ = """A Plugin that allows you to download files from http://xvidstage.com""" - __author_name__ = ('4Christopher') - __author_mail__ = ('4Christopher@gmx.de') - - - def process(self, pyfile): - pyfile.name, pyfile.size, pyfile.status, self.html = parseFileInfo(pyfile.url) - self.logDebug('Name: %s' % pyfile.name) - if pyfile.status == 1: ## offline - self.fail() - self.id = re.search(self.__pattern__, pyfile.url).group('id') - - wait_sec = int(re.search(r'countdown_str">.+?>(\d+?)<', self.html).group(1)) - self.setWait(wait_sec, reconnect=False) - self.logDebug('Waiting %d seconds before submitting the captcha' % wait_sec) - self.wait() - - rand = re.search(r'<input type="hidden" name="rand" value="(.*?)">', self.html).group(1) - self.logDebug('rand: %s, id: %s' % (rand, self.id)) - self.html = self.req.load(pyfile.url, post={'op': 'download2', 'id' : self.id, 'rand' : rand, 'code': self.get_captcha()}) - file_url = re.search(r'<a href="(?P<url>.*?)">(?P=url)</a>', self.html).group('url') - try: - hours_file_available = int(re.search(r'This direct link will be available for your IP next (?P<hours>\d+?) hours', self.html).group('hours')) - self.logDebug('You have %d hours to download this file with your current IP address.' % hours_file_available) - except: - self.logDebug('Failed') - self.logDebug('Download file: %s' % file_url) - self.download(file_url) - check = self.checkDownload({'empty': re.compile(r'^$')}) - - if check == 'empty': - self.logInfo('Downloaded File was empty') - # self.retry() - - def get_captcha(self): - ## <span style='position:absolute;padding-left:7px;padding-top:6px;'>1 … - cap_chars = {} - for pad_left, char in re.findall(r"position:absolute;padding-left:(\d+?)px;.*?;'>(.*?)<", self.html): - cap_chars[int(pad_left)] = char - - h = HTMLParser.HTMLParser() - ## Sorting after padding-left - captcha = '' - for pad_left in sorted(cap_chars): - captcha += h.unescape(cap_chars[pad_left]) - - self.logDebug('The captcha is: %s' % captcha) - return captcha + __name__ = 'XvidstageCom' + __version__ = '0.4' + __pattern__ = r'http://(?:www.)?xvidstage.com/(?P<id>[0-9A-Za-z]+)' + __type__ = 'hoster' + __description__ = """A Plugin that allows you to download files from http://xvidstage.com""" + __author_name__ = ('4Christopher') + __author_mail__ = ('4Christopher@gmx.de') + + + def process(self, pyfile): + pyfile.name, pyfile.size, pyfile.status, self.html = parseFileInfo(pyfile.url) + self.logDebug('Name: %s' % pyfile.name) + if pyfile.status == 1: ## offline + self.offline() + self.id = re.search(self.__pattern__, pyfile.url).group('id') + + wait_sec = int(re.search(r'countdown_str">.+?>(\d+?)<', self.html).group(1)) + self.setWait(wait_sec, reconnect=False) + self.logDebug('Waiting %d seconds before submitting the captcha' % wait_sec) + self.wait() + + rand = re.search(r'<input type="hidden" name="rand" value="(.*?)">', self.html).group(1) + self.logDebug('rand: %s, id: %s' % (rand, self.id)) + self.html = self.req.load(pyfile.url, + post={'op': 'download2', 'id': self.id, 'rand': rand, 'code': self.get_captcha()}) + file_url = re.search(r'<a href="(?P<url>.*?)">(?P=url)</a>', self.html).group('url') + try: + hours_file_available = int( + re.search(r'This direct link will be available for your IP next (?P<hours>\d+?) hours', + self.html).group('hours')) + self.logDebug( + 'You have %d hours to download this file with your current IP address.' % hours_file_available) + except: + self.logDebug('Failed') + self.logDebug('Download file: %s' % file_url) + self.download(file_url) + check = self.checkDownload({'empty': re.compile(r'^$')}) + + if check == 'empty': + self.logInfo('Downloaded File was empty') + # self.retry() + + def get_captcha(self): + ## <span style='position:absolute;padding-left:7px;padding-top:6px;'>1 … + cap_chars = {} + for pad_left, char in re.findall(r"position:absolute;padding-left:(\d+?)px;.*?;'>(.*?)<", self.html): + cap_chars[int(pad_left)] = char + + h = HTMLParser.HTMLParser() + ## Sorting after padding-left + captcha = '' + for pad_left in sorted(cap_chars): + captcha += h.unescape(cap_chars[pad_left]) + + self.logDebug('The captcha is: %s' % captcha) + return captcha |