diff options
author | Pedro Algarvio <pedro@algarvio.me> | 2012-02-05 07:41:43 +0100 |
---|---|---|
committer | Pedro Algarvio <pedro@algarvio.me> | 2012-02-05 07:41:43 +0100 |
commit | a50ce96cda140c24e225d816c29f206407438a4b (patch) | |
tree | ab77312bfb1bff4aadf579e6ad30757e2a164716 /module/plugins/hoster/RealdebridCom.py | |
parent | fix ul.to (diff) | |
download | pyload-a50ce96cda140c24e225d816c29f206407438a4b.tar.xz |
Stop Real-Debrid from returning streaming responses instead of file downloads.
Diffstat (limited to 'module/plugins/hoster/RealdebridCom.py')
-rw-r--r-- | module/plugins/hoster/RealdebridCom.py | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index 8c1882daa..80d0c7637 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -2,14 +2,17 @@ # -*- coding: utf-8 -*-
import re
+from time import time
from urllib import quote, unquote
from random import randrange
+from module.utils import parseFileSize
+from module.common.json_layer import json_loads
from module.plugins.Hoster import Hoster
class RealdebridCom(Hoster):
__name__ = "RealdebridCom"
- __version__ = "0.43"
+ __version__ = "0.44"
__type__ = "hoster"
__pattern__ = r"https?://.*real-debrid\..*"
@@ -44,26 +47,25 @@ class RealdebridCom(Hoster): password = self.getPassword().splitlines()
if not password: password = ""
else: password = password[0]
-
- url = "http://real-debrid.com/lib/ajax/generator.php?lang=en&sl=1&link=%s&passwort=%s" % (quote(pyfile.url, ""), password)
- page = self.load(url)
- if page.strip() == 'Your file is unavailable on the hoster.':
- self.offline()
+ url = "http://real-debrid.com/ajax/unrestrict.php?lang=en&link=%s&password=%s&time=%s" % (quote(pyfile.url, ""), password, int(time()*1000))
+ page = self.load(url)
+ data = json_loads(page)
- error = re.search(r'<span id="generation-error">(.*)</span>', page)
+ self.logDebug("Returned Data: %s" % data)
- if error:
- msg = error.group(1).strip()
- self.logDebug(page)
- if msg == "Your file is unavailable on the hoster.":
+ if data["error"] != 0:
+ if data["message"] == "Your file is unavailable on the hoster.":
self.offline()
+ elif data["message"] == "File's hoster is in maintenance. Try again later.":
+ self.logWarning(data["message"])
+ self.tempOffline()
else:
- self.fail(msg)
- elif url == 'error':
- self.fail("Your IP is most likely blocked. Please contact RealDebrid support")
+ self.logError(page)
else:
- new_url = page
+ self.pyfile.name = data["file_name"]
+ self.pyfile.size = parseFileSize(data["file_size"])
+ new_url = data['generated_links'].split('|')[-1]
if self.getConfig("https"):
new_url = new_url.replace("http://", "https://")
@@ -72,7 +74,6 @@ class RealdebridCom(Hoster): self.log.debug("Real-Debrid: New URL: %s" % new_url)
-
if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"):
#only use when name wasnt already set
pyfile.name = self.getFilename(new_url)
|