summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/RealdebridCom.py
diff options
context:
space:
mode:
authorGravatar GammaC0de <GammaC0de@users.noreply.github.com> 2015-05-29 23:33:10 +0200
committerGravatar GammaC0de <GammaC0de@users.noreply.github.com> 2015-05-29 23:33:10 +0200
commit844dfd92f590e531ca2f7fd86305fcbc13a03721 (patch)
tree5303bd07749b362dab071ada6197fe37dda85b27 /module/plugins/hoster/RealdebridCom.py
parent[BitshareCom] Code cosmetics (diff)
parent[SimpleHoster] Fix DB error (diff)
downloadpyload-844dfd92f590e531ca2f7fd86305fcbc13a03721.tar.xz
Merge pull request #1 from pyload/stable
sync stable
Diffstat (limited to 'module/plugins/hoster/RealdebridCom.py')
-rw-r--r--module/plugins/hoster/RealdebridCom.py58
1 files changed, 14 insertions, 44 deletions
diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py
index 0de78226d..4500fcefc 100644
--- a/module/plugins/hoster/RealdebridCom.py
+++ b/module/plugins/hoster/RealdebridCom.py
@@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-
import re
-
-from random import randrange
-from urllib import quote, unquote
-from time import time
+import time
+import urllib
from module.common.json_layer import json_loads
from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
@@ -14,36 +12,26 @@ from module.utils import parseFileSize
class RealdebridCom(MultiHoster):
__name__ = "RealdebridCom"
__type__ = "hoster"
- __version__ = "0.58"
+ __version__ = "0.67"
- __pattern__ = r'https?://(?:[^/]*\.)?real-debrid\..*'
+ __pattern__ = r'https?://((?:www\.|s\d+\.)?real-debrid\.com/dl/|[\w^_]\.rdb\.so/d/)[\w^_]+'
+ __config__ = [("use_premium", "bool", "Use premium account if available", True)]
- __description__ = """Real-Debrid.com hoster plugin"""
+ __description__ = """Real-Debrid.com multi-hoster plugin"""
__license__ = "GPLv3"
__authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")]
- def getFilename(self, url):
- try:
- name = unquote(url.rsplit("/", 1)[1])
- except IndexError:
- name = "Unknown_Filename..."
- if not name or name.endswith(".."): #: incomplete filename, append random stuff
- name += "%s.tmp" % randrange(100, 999)
- return name
-
-
def setup(self):
- self.chunkLimit = 3
- self.resumeDownload = True
+ self.chunkLimit = 3
- def handlePremium(self):
+ def handlePremium(self, pyfile):
data = json_loads(self.load("https://real-debrid.com/ajax/unrestrict.php",
get={'lang' : "en",
- 'link' : quote(self.pyfile.url, ""),
+ 'link' : pyfile.url,
'password': self.getPassword(),
- 'time' : int(time() * 1000)}))
+ 'time' : int(time.time() * 1000)}))
self.logDebug("Returned Data: %s" % data)
@@ -54,33 +42,15 @@ class RealdebridCom(MultiHoster):
self.logWarning(data['message'])
self.tempOffline()
else:
- if self.pyfile.name is not None and self.pyfile.name.endswith('.tmp') and data['file_name']:
- self.pyfile.name = data['file_name']
- self.pyfile.size = parseFileSize(data['file_size'])
+ if pyfile.name and pyfile.name.endswith('.tmp') and data['file_name']:
+ pyfile.name = data['file_name']
+ pyfile.size = parseFileSize(data['file_size'])
self.link = data['generated_links'][0][-1]
- if self.getConfig("https"):
+ if self.getConfig('ssl'):
self.link = self.link.replace("http://", "https://")
else:
self.link = self.link.replace("https://", "http://")
- if self.link != self.pyfile.url:
- self.logDebug("New URL: %s" % self.link)
-
- if self.pyfile.name.startswith("http") or self.pyfile.name.startswith("Unknown") or self.pyfile.name.endswith('..'):
- #only use when name wasnt already set
- self.pyfile.name = self.getFilename(self.link)
-
-
- def checkFile(self):
- super(RealdebridCom, self).checkFile()
-
- check = self.checkDownload(
- {"error": "<title>An error occured while processing your request</title>"})
-
- if check == "error":
- #usual this download can safely be retried
- self.retry(wait_time=60, reason=_("An error occured while generating link"))
-
getInfo = create_getInfo(RealdebridCom)