summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/RapidshareCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/RapidshareCom.py')
-rw-r--r--module/plugins/hoster/RapidshareCom.py43
1 files changed, 19 insertions, 24 deletions
diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py
index e5ab6b445..19d6cf772 100644
--- a/module/plugins/hoster/RapidshareCom.py
+++ b/module/plugins/hoster/RapidshareCom.py
@@ -1,12 +1,5 @@
# -*- coding: utf-8 -*-
-# v1.36
-# * fixed call checkfiles subroutine
-# v1.35
-# * fixed rs-urls in handleFree(..) and freeWait(..)
-# * removed getInfo(..) function as it was not used anywhere (in this file)
-# * removed some (old?) comment blocks
-
import re
from module.network.RequestFactory import getURL
@@ -51,15 +44,18 @@ def getInfo(urls):
class RapidshareCom(Hoster):
__name__ = "RapidshareCom"
__type__ = "hoster"
- __pattern__ = r'https?://(?:www\.)?rapidshare.com/(?:files/(?P<id>\d*?)/(?P<name>[^?]+)|#!download\|(?:\w+)\|(?P<id_new>\d+)\|(?P<name_new>[^|]+))'
__version__ = "1.39"
- __description__ = """Rapidshare.com hoster plugin"""
+
+ __pattern__ = r'https?://(?:www\.)?rapidshare.com/(?:files/(?P<id>\d*?)/(?P<name>[^?]+)|#!download\|(?:\w+)\|(?P<id_new>\d+)\|(?P<name_new>[^|]+))'
__config__ = [("server",
"Cogent;Deutsche Telekom;Level(3);Level(3) #2;GlobalCrossing;Level(3) #3;Teleglobe;GlobalCrossing #2;TeliaSonera #2;Teleglobe #2;TeliaSonera #3;TeliaSonera",
"Preferred Server", "None")]
+
+ __description__ = """Rapidshare.com hoster plugin"""
__author_name__ = ("spoob", "RaNaN", "mkaay")
__author_mail__ = ("spoob@pyload.org", "ranan@pyload.org", "mkaay@mkaay.de")
+
def setup(self):
self.no_download = True
self.api_data = None
@@ -87,7 +83,7 @@ class RapidshareCom(Hoster):
self.name = m.group("name_new")
self.download_api_data()
- if self.api_data["status"] == "1":
+ if self.api_data['status'] == "1":
self.pyfile.name = self.get_file_name()
if self.premium:
@@ -95,21 +91,20 @@ class RapidshareCom(Hoster):
else:
self.handleFree()
- elif self.api_data["status"] == "2":
+ elif self.api_data['status'] == "2":
self.logInfo(_("Rapidshare: Traffic Share (direct download)"))
self.pyfile.name = self.get_file_name()
self.download(self.pyfile.url, get={"directstart": 1})
- elif self.api_data["status"] in ("0", "4", "5"):
+ elif self.api_data['status'] in ("0", "4", "5"):
self.offline()
- elif self.api_data["status"] == "3":
+ elif self.api_data['status'] == "3":
self.tempOffline()
else:
self.fail("Unknown response code.")
def handleFree(self):
-
while self.no_download:
self.dl_dict = self.freeWait()
@@ -134,7 +129,7 @@ class RapidshareCom(Hoster):
def handlePremium(self):
info = self.account.getAccountInfo(self.user, True)
self.logDebug("%s: Use Premium Account" % self.__name__)
- url = self.api_data["mirror"]
+ url = self.api_data['mirror']
self.download(url, get={"directstart": 1})
def download_api_data(self, force=False):
@@ -164,12 +159,12 @@ class RapidshareCom(Hoster):
self.api_data = {"fileid": fields[0], "filename": fields[1], "size": int(fields[2]), "serverid": fields[3],
"status": fields[4], "shorthost": fields[5], "checksum": fields[6].strip().lower()}
- if int(self.api_data["status"]) > 100:
- self.api_data["status"] = str(int(self.api_data["status"]) - 100)
- elif int(self.api_data["status"]) > 50:
- self.api_data["status"] = str(int(self.api_data["status"]) - 50)
+ if int(self.api_data['status']) > 100:
+ self.api_data['status'] = str(int(self.api_data['status']) - 100)
+ elif int(self.api_data['status']) > 50:
+ self.api_data['status'] = str(int(self.api_data['status']) - 50)
- self.api_data["mirror"] = "http://rs%(serverid)s%(shorthost)s.rapidshare.com/files/%(fileid)s/%(filename)s" % self.api_data
+ self.api_data['mirror'] = "http://rs%(serverid)s%(shorthost)s.rapidshare.com/files/%(fileid)s/%(filename)s" % self.api_data
def freeWait(self):
"""downloads html with the important information
@@ -215,14 +210,14 @@ class RapidshareCom(Hoster):
"name": name,
"host": data[0],
"auth": data[1],
- "server": self.api_data["serverid"],
- "size": self.api_data["size"]}
+ "server": self.api_data['serverid'],
+ "size": self.api_data['size']}
self.setWait(int(data[2]) + 2 + self.offset)
self.wait()
return dl_dict
def get_file_name(self):
- if self.api_data["filename"]:
- return self.api_data["filename"]
+ if self.api_data['filename']:
+ return self.api_data['filename']
return self.url.split("/")[-1]