summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nitzo <nitzo2001@yahoo.com> 2016-07-04 21:43:05 +0200
committerGravatar Nitzo <nitzo2001@yahoo.com> 2016-07-04 21:43:05 +0200
commitce84ca3d44090eca8daa2d7f1dc7715883c809e4 (patch)
tree12b8aaf0e98b68cf9ead007d65baedb721184e98
parent[YoutubeCom] fix #2531 (diff)
downloadpyload-ce84ca3d44090eca8daa2d7f1dc7715883c809e4.tar.xz
[New Hoster] UploadrocketNet - fix #2532
-rw-r--r--module/plugins/hoster/UploadrocketNet.py68
1 files changed, 68 insertions, 0 deletions
diff --git a/module/plugins/hoster/UploadrocketNet.py b/module/plugins/hoster/UploadrocketNet.py
new file mode 100644
index 000000000..5a76949c5
--- /dev/null
+++ b/module/plugins/hoster/UploadrocketNet.py
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from module.plugins.internal.XFSHoster import XFSHoster
+
+
+class UploadrocketNet(XFSHoster):
+ __name__ = "UploadrocketNet"
+ __type__ = "hoster"
+ __version__ = "0.01"
+ __status__ = "testing"
+
+ __pattern__ = r'http://(?:www\.)?uploadrocket\.net/\w{12}'
+ __config__ = [("activated" , "bool", "Activated" , True),
+ ("use_premium" , "bool", "Use premium account if available" , True),
+ ("fallback" , "bool", "Fallback to free download if premium fails" , True),
+ ("chk_filesize", "bool", "Check file size" , True),
+ ("max_wait" , "int" , "Reconnect if waiting time is greater than minutes", 10 )]
+
+ __description__ = """Uploadrocket.net hoster plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("Nico5206", "nico5206git@gmail.com")]
+
+ PLUGIN_DOMAIN = "uploadrocket.net"
+ OFFLINE_PATTERN = r'>The file was removed'
+ TEMP_OFFLINE_PATTERN = ''
+ LINK_PATTERN = r'(https?://(?:www\.)?(?:[^/]*?uploadrocket\.net|\d+\.\d+\.\d+\.\d+)(?:\:\d+)?(?:/d/|(?:/files)?/\d+/\w+/).+?)["\'<]'
+
+
+ def setup(self):
+ self.resume_download = True
+ self.multiDL = True
+
+
+ def _post_parameters(self):
+ inputs = super(UploadrocketNet, self)._post_parameters()
+
+ # Remove parameters added by XFSHoster (method_free/method_premium) and remove the inappropriate inputs
+ if not self.premium:
+ if 'method_isfree' in inputs:
+ inputs.pop('method_free', None)
+ inputs.pop('method_ispremium', None)
+ elif 'method_ispremium' in inputs:
+ inputs.pop('method_isfree', None)
+ inputs.pop('method_premium', None)
+
+ return inputs
+
+
+ def process(self, pyfile):
+ # If filename present in url, remove it (else hoster will redirect)
+ m = re.search("(.*)/.*.html", pyfile.url, re.S)
+
+ if m is not None and m.group(1):
+ self.pyfile.url = m.group(1)
+
+ super(UploadrocketNet, self).process(pyfile)
+
+
+ def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=True, resume=None, chunks=None):
+ # Read filename from download url as only present there
+ m = re.search(".*/(.*)", url, re.S)
+
+ if m is not None and m.group(1):
+ self.pyfile.name = m.group(1)
+
+ super(UploadrocketNet, self).download(url, get, post, ref, cookies, disposition, resume, chunks) \ No newline at end of file