diff options
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/accounts/ShareonlineBiz.py | 2 | ||||
-rw-r--r-- | module/plugins/accounts/ZeveraCom.py | 146 | ||||
-rw-r--r-- | module/plugins/hooks/ZeveraCom.py | 33 | ||||
-rw-r--r-- | module/plugins/hoster/BitshareCom.py | 32 | ||||
-rw-r--r-- | module/plugins/hoster/XFileSharingPro.py | 17 | ||||
-rw-r--r-- | module/plugins/hoster/ZeveraCom.py | 108 |
6 files changed, 317 insertions, 21 deletions
diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index cdc4ebb63..1aac2282c 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -29,6 +29,8 @@ class ShareonlineBiz(Account): __author_name__ = ("mkaay", "zoidberg") __author_mail__ = ("mkaay@mkaay.de", "zoidberg@mujmail.cz") + info_threshold = 60 + def getUserAPI(self, user, req): return req.load("http://api.share-online.biz/account.php?username=%s&password=%s&act=userDetails" % (user, self.accounts[user]["password"])) diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py new file mode 100644 index 000000000..65d1d0bc2 --- /dev/null +++ b/module/plugins/accounts/ZeveraCom.py @@ -0,0 +1,146 @@ +# -*- coding: utf-8 -*-
+from module.plugins.Account import Account
+
+import re
+from time import mktime, strptime
+
+class ZeveraCom(Account):
+ __name__ = "ZeveraCom"
+ __version__ = "0.20"
+ __type__ = "account"
+ __description__ = """Zevera.com account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ def loadAccountInfo(self, user, req):
+ data = self.getAPIData(req)
+ if data == "No traffic":
+ account_info = {"trafficleft": 0, "validuntil": 0, "premium": False}
+ else:
+ account_info = {
+ "trafficleft": int(data['availabletodaytraffic']) * 1024,
+ "validuntil": mktime(strptime(data['endsubscriptiondate'],"%Y/%m/%d %H:%M:%S")),
+ "premium": True
+ }
+ return account_info
+
+ def login(self, user, data, req):
+ self.loginname = user
+ self.password = data["password"]
+ if self.getAPIData(req) == "No traffic":
+ self.wrongPassword()
+
+ def getAPIData(self, req, just_header = False, **kwargs):
+ get_data = {
+ 'cmd': 'accountinfo',
+ 'login': self.loginname,
+ 'pass': self.password
+ }
+ get_data.update(kwargs)
+
+ response = req.load("http://www.zevera.com/jDownloader.ashx", get = get_data, decode = True, just_header = just_header)
+ self.logDebug(response)
+
+ if ':' in response:
+ if not just_header:
+ response = response.replace(',','\n')
+ return {y.strip().lower(): z.strip() for y,z in [x.split(':',1) for x in response.splitlines() if ':' in x]}
+ else:
+ return response
+
+
+
+ """
+ # BitAPI not used - defunct, probably abandoned by Zevera
+
+ def loadAccountInfo(self, user, req):
+ dataRet = self.loadAPIRequest(req)
+ account_info = {
+ "trafficleft": dataRet['AccountInfo']['AvailableTODAYTrafficForUseInMBytes'] * 1024,
+ "validuntil": -1 #dataRet['AccountInfo']['EndSubscriptionDate']
+ }
+
+ return account_info
+
+ def login(self, user, data, req):
+ self.loginname = user
+ self.password = data["password"]
+ if self.loadAPIRequest(req, parse = False) == 'Login Error':
+ self.wrongPassword()
+
+
+ def loadAPIRequest(self, req, parse = True, **kwargs):
+ get_dict = {
+ 'cmd': 'download_request',
+ 'login': self.loginname,
+ 'pass': self.password
+ }
+ get_dict.update(kwargs)
+
+ response = req.load(self.api_url, get = get_dict, decode = True)
+ self.logDebug(response)
+ return self.parseAPIRequest(response) if parse else response
+
+ def parseAPIRequest(self, api_response):
+
+ try:
+ arFields = iter(api_response.split('TAG BEGIN DATA#')[1].split('#END DATA')[0].split('#'))
+
+ retData = {
+ 'VersionMajor': arFields.next(),
+ 'VersionMinor': arFields.next(),
+ 'ErrorCode': int(arFields.next()),
+ 'ErrorMessage': arFields.next(),
+ 'Update_Wait': arFields.next()
+ }
+ serverInfo = {
+ 'DateTimeOnServer': mktime(strptime(arFields.next(),"%Y/%m/%d %H:%M:%S")),
+ 'DAY_Traffic_LimitInMBytes': int(arFields.next())
+ }
+ accountInfo = {
+ 'EndSubscriptionDate': mktime(strptime(arFields.next(),"%Y/%m/%d %H:%M:%S")),
+ 'TrafficUsedInMBytesDayToday': int(arFields.next()),
+ 'AvailableEXTRATrafficForUseInMBytes': int(arFields.next()),
+ 'AvailableTODAYTrafficForUseInMBytes': int(arFields.next())
+ }
+ fileInfo = {
+ 'FileID': arFields.next(),
+ 'Title': arFields.next(),
+ 'RealFileName': arFields.next(),
+ 'FileNameOnServer': arFields.next(),
+ 'StorageServerURL': arFields.next(),
+ 'Token': arFields.next(),
+ 'FileSizeInBytes': int(arFields.next()),
+ 'StatusID': int(arFields.next())
+ }
+ progress = {
+ 'BytesReceived': int(arFields.next()),
+ 'TotalBytesToReceive': int(arFields.next()),
+ 'Percentage': arFields.next(),
+ 'StatusText': arFields.next(),
+ 'ProgressText': arFields.next()
+ }
+ fileInfo.update({
+ 'Progress': progress,
+ 'FilePassword': arFields.next(),
+ 'Keywords': arFields.next(),
+ 'ImageURL4Download': arFields.next(),
+ 'CategoryID': arFields.next(),
+ 'CategoryText': arFields.next(),
+ 'Notes': arFields.next()
+ })
+ retData.update({
+ 'ServerInfo': serverInfo,
+ 'AccountInfo': accountInfo,
+ 'FileInfo': fileInfo
+ })
+
+ #self.infos[self.loginname]['trafficleft'] = accountInfo['AvailableTODAYTrafficForUseInMBytes'] * 1024
+
+ except Exception, e:
+ self.logError(e)
+ return None
+
+ self.logDebug(retData)
+ return retData
+ """
\ No newline at end of file diff --git a/module/plugins/hooks/ZeveraCom.py b/module/plugins/hooks/ZeveraCom.py new file mode 100644 index 000000000..46c752c21 --- /dev/null +++ b/module/plugins/hooks/ZeveraCom.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +from module.network.RequestFactory import getURL +from module.plugins.internal.MultiHoster import MultiHoster + +class ZeveraCom(MultiHoster): + __name__ = "ZeveraCom" + __version__ = "0.01" + __type__ = "hook" + __config__ = [("activated", "bool", "Activated", "False"), + ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + ("hosterList", "str", "Hoster list (comma separated)", "")] + __description__ = """Real-Debrid.com hook plugin""" + __author_name__ = ("Devirex, Hazzard") + __author_mail__ = ("naibaf_11@yahoo.de") + + replacements = [("freakshare.net", "freakshare.com"), ("2shared.com", "twoshared.com"), ("4shared.com", "fourshared.com"), + ("easy-share.com", "crocko.com"), ("hellshare.com", "hellshare.cz")] + + def getHoster(self): + page = getURL("http://www.zevera.com/jDownloader.ashx?cmd=gethosters") + hosters = set([x.strip() for x in page.replace("\"", "").split(",")]) + + configMode = self.getConfig('hosterListMode') + if configMode in ("listed", "unlisted"): + configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) + configList.discard(u'') + if configMode == "listed": + hosters &= configList + else: + hosters -= configList + + return list(hosters)
\ No newline at end of file diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index d6288883d..1c7d79510 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -2,6 +2,7 @@ from __future__ import with_statement import re +from pycurl import FOLLOWLOCATION from module.plugins.Hoster import Hoster from module.plugins.ReCaptcha import ReCaptcha @@ -45,7 +46,7 @@ class BitshareCom(Hoster): __name__ = "BitshareCom" __type__ = "hoster" __pattern__ = r"http://(www\.)?bitshare\.com/(files/(?P<id1>[a-zA-Z0-9]+)(/(?P<name>.*?)\.html)?|\?f=(?P<id2>[a-zA-Z0-9]+))" - __version__ = "0.41" + __version__ = "0.42" __description__ = """Bitshare.Com File Download Hoster""" __author_name__ = ("paulking", "fragonib") __author_mail__ = (None, "fragonib[AT]yahoo[DOT]es") @@ -71,7 +72,7 @@ class BitshareCom(Hoster): # Load main page self.req.cj.setCookie(self.HOSTER_DOMAIN, "language_selection", "EN") - self.html = self.load(self.pyfile.url, ref=False, decode=True) + self.html = self.load(self.pyfile.url, ref=False, decode=True, cookies = False) # Check offline if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None: @@ -87,14 +88,20 @@ class BitshareCom(Hoster): # Ajax file id self.ajaxid = re.search(BitshareCom.FILE_AJAXID_PATTERN, self.html).group(1) self.logDebug("File ajax id is [%s]" % self.ajaxid) + + # This may either download our file or forward us to an error page + url = self.getDownloadUrl() + self.logDebug("Downloading file with url [%s]" % url) + self.download(url) - # Handle free downloading - self.handleFree() - - def handleFree(self): - if "Only Premium members can access this file" in self.html: - self.fail("Only Premium members can access this file") - + + def getDownloadUrl(self): + # Return location if direct download is active + if self.premium: + header = self.load(self.pyfile.url, cookies = True, just_header = True) + if 'location' in header: + return header['location'] + # Get download info self.logDebug("Getting download info") response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", @@ -133,11 +140,8 @@ class BitshareCom(Hoster): post={"request" : "getDownloadURL", "ajaxid" : self.ajaxid}) self.handleErrors(response, '#') url = response.split("#")[-1] - - # Request download URL - # This may either download our file or forward us to an error page - self.logDebug("Downloading file with url [%s]" % url) - self.download(url) + + return url def handleErrors(self, response, separator): self.logDebug("Checking response [%s]" % response) diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index c7a59c81e..0d44300af 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -19,19 +19,22 @@ import re from random import random from urllib import unquote +from urlparse import urlparse from pycurl import FOLLOWLOCATION from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo from module.plugins.ReCaptcha import ReCaptcha +from module.utils import html_unescape class XFileSharingPro(SimpleHoster): """ Common base for XFileSharingPro hosters like EasybytezCom, CramitIn, FiledinoCom... Some hosters may work straight away when added to __pattern__ + However, most of them will NOT work because they are either down or running a customized version """ __name__ = "XFileSharingPro" __type__ = "hoster" - __pattern__ = r"http://(?:\w*\.)*(boosterking\.com|migahost\.com|fileband\.com|ravishare\.com)/\w{12}" - __version__ = "0.01" + __pattern__ = r"http://(?:\w*\.)*((aieshare|amonshare|asixfiles|azsharing|banashare|batubia|bebasupload|boosterking|buckshare|bulletupload|crocshare|ddlanime|divxme|dopeshare|downupload|eyesfile|eyvx|fik1|file(4safe|4sharing|band|beep|bit|box|dove|fat|forth|made|mak|planet|playgroud|race|rio|strack|upper|velocity)|fooget|4bytez|freefilessharing|glumbouploads|grupload|heftyfile|hipfile|host4desi|hulkshare.com|idupin|imageporter|isharefast|jalurcepat|kingsupload|laoupload|linkzhost|loombo|maknyos|migahost|mlfat4arab|movreel|netuploaded|ok2upload|180upload|1hostclick|ovfile|putshare|pyramidfiles|q4share|queenshare|ravishare|rockdizfile|sendmyway|share(76|beast|hut|run|swift)|sharingonline|6ybh-upload|skipfile|spaadyshare|space4file|speedoshare|upload(baz|boost|c|dot|floor|ic|dville)|uptobox|vidbull|zalaa|zomgupload)\.com|(kupload|movbay|multishare|omegave|toucansharing|uflinq)\.org|(annonhost|fupload|muchshare|supashare|tusfiles|usershare|xuploading)\.net|(banicrazy|flowhot|upbrasil)\.info|(shareyourfilez)|.biz|(bzlink|)\.us|(cloudcache|fileserver)\.cc|(farshare|kingshare)\.to|(filemaze|filehost)\.ws|(goldfile|xfileshare)\.eu|(filestock|moidisk)\.ru|4up\.me|kfiles\.kz|odsiebie\.pl|upchi\.co\.il|upit\.in|verzend\.be)/\w{12}" + __version__ = "0.02" __description__ = """XFileSharingPro common hoster base""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") @@ -65,8 +68,11 @@ class XFileSharingPro(SimpleHoster): self.fail("Only premium users can download from other hosters with %s" % self.HOSTER_NAME) else: self.html = self.load(pyfile.url, cookies = False, decode = True) - self.file_info = self.getFileInfo() - + try: + self.file_info = self.getFileInfo() + except: + pyfile.name = html_unescape(unquote(urlparse(pyfile.url).path.split("/")[-1])) + self.header = self.load(self.pyfile.url, just_header = True, cookies = True) self.logDebug(self.header) @@ -217,8 +223,5 @@ class XFileSharingPro(SimpleHoster): inputs['code'] = self.decryptCaptcha(captcha_url) return 2 return 0 - - def urlParseFileName(self): - return html_unescape(urlparse(self.pyfile.url).path.split("/")[-1]) getInfo = create_getInfo(XFileSharingPro)
\ No newline at end of file diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py new file mode 100644 index 000000000..cbedfcb68 --- /dev/null +++ b/module/plugins/hoster/ZeveraCom.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from module.plugins.Hoster import Hoster
+from module.utils import html_unescape
+from urllib import quote, unquote
+from time import sleep
+
+class ZeveraCom(Hoster):
+ __name__ = "ZeveraCom"
+ __version__ = "0.20"
+ __type__ = "hoster"
+ __pattern__ = r"http://zevera.com/.*"
+ __description__ = """zevera.com hoster plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ def setup(self):
+ self.resumeDownload = self.multiDL = True
+ self.chunkLimit = 1
+
+ def process(self, pyfile):
+ if not self.account:
+ self.logError(_("Please enter your zevera.com account or deactivate this plugin"))
+ self.fail("No zevera.com account provided")
+
+ self.logDebug("zevera.com: Old URL: %s" % pyfile.url)
+
+ if self.account.getAPIData(self.req, cmd = "checklink", olink = pyfile.url) != "Alive":
+ self.fail("Offline or not downloadable - contact Zevera support")
+
+ header = self.account.getAPIData(self.req, just_header = True, cmd="generatedownloaddirect", olink = pyfile.url)
+ if not "location" in header:
+ self.fail("Unable to initialize download - contact Zevera support")
+
+ self.download(header['location'], disposition = True)
+
+ check = self.checkDownload({"error" : 'action="ErrorDownload.aspx'})
+ if check == "error":
+ self.fail("Error response received - contact Zevera support")
+
+ """
+ # BitAPI not used - defunct, probably abandoned by Zevera
+
+ api_url = "http://zevera.com/API.ashx"
+
+ def process(self, pyfile):
+ if not self.account:
+ self.logError(_("Please enter your zevera.com account or deactivate this plugin"))
+ self.fail("No zevera.com account provided")
+
+ self.logDebug("zevera.com: Old URL: %s" % pyfile.url)
+
+ last_size = retries = 0
+ olink = self.pyfile.url #quote(self.pyfile.url.encode('utf_8'))
+
+ for i in range(100):
+ self.retData = self.account.loadAPIRequest(self.req, cmd = 'download_request', olink = olink)
+ self.checkAPIErrors(self.retData)
+
+ if self.retData['FileInfo']['StatusID'] == 100:
+ break
+ elif self.retData['FileInfo']['StatusID'] == 99:
+ self.fail('Failed to initialize download (99)')
+ else:
+ if self.retData['FileInfo']['Progress']['BytesReceived'] <= last_size:
+ if retries >= 6:
+ self.fail('Failed to initialize download (%d)' % self.retData['FileInfo']['StatusID'] )
+ retries += 1
+ else:
+ retries = 0
+
+ last_size = self.retData['FileInfo']['Progress']['BytesReceived']
+
+ self.setWait(self.retData['Update_Wait'])
+ self.wait()
+
+ pyfile.name = self.retData['FileInfo']['RealFileName']
+ pyfile.size = self.retData['FileInfo']['FileSizeInBytes']
+
+ self.retData = self.account.loadAPIRequest(self.req, cmd = 'download_start', FileID = self.retData['FileInfo']['FileID'])
+ self.checkAPIErrors(self.retData)
+
+ self.download(self.api_url, get = {
+ 'cmd': "open_stream",
+ 'login': self.account.loginname,
+ 'pass': self.account.password,
+ 'FileID': self.retData['FileInfo']['FileID'],
+ 'startBytes': 0
+ }
+ )
+
+ def checkAPIErrors(self, retData):
+ if not retData:
+ self.fail('Unknown API response')
+
+ if retData['ErrorCode']:
+ self.logError(retData['ErrorCode'], retData['ErrorMessage'])
+ #self.fail('ERROR: ' + retData['ErrorMessage'])
+
+ if self.pyfile.size / 1024000 > retData['AccountInfo']['AvailableTODAYTrafficForUseInMBytes']:
+ self.logWarning("Not enough data left to download the file")
+
+ def crazyDecode(self, ustring):
+ # accepts decoded ie. unicode string - API response is double-quoted, double-utf8-encoded
+ # no idea what the proper order of calling these functions would be :-/
+ return html_unescape(unquote(unquote(ustring.replace('@DELIMITER@','#'))).encode('raw_unicode_escape').decode('utf-8'))
+ """
\ No newline at end of file |