summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2011-06-10 13:09:33 +0200
committerGravatar mkaay <mkaay@mkaay.de> 2011-06-10 13:09:33 +0200
commita40cf88920e94490d5c851fb273b8d2f48aef6fb (patch)
tree8de448bbf50535901a35a26c2a145403ed166107
parenternieb's rapidshare patch (diff)
downloadpyload-a40cf88920e94490d5c851fb273b8d2f48aef6fb.tar.xz
ernieb's hoster patches
-rw-r--r--module/database/DatabaseBackend.py1
-rw-r--r--module/plugins/accounts/X7To.py7
-rw-r--r--module/plugins/hoster/BitshareCom.py14
-rw-r--r--module/plugins/hoster/DepositfilesCom.py3
-rw-r--r--module/plugins/hoster/EasyShareCom.py3
-rw-r--r--module/plugins/hoster/FileserveCom.py6
-rw-r--r--module/plugins/hoster/FreakshareCom.py9
-rw-r--r--module/plugins/hoster/ShragleCom.py17
-rw-r--r--module/plugins/hoster/YourfilesTo.py10
-rw-r--r--module/plugins/hoster/ZippyshareCom.py11
10 files changed, 56 insertions, 25 deletions
diff --git a/module/database/DatabaseBackend.py b/module/database/DatabaseBackend.py
index c147aa018..9f5e86fb7 100644
--- a/module/database/DatabaseBackend.py
+++ b/module/database/DatabaseBackend.py
@@ -130,6 +130,7 @@ class DatabaseBackend(Thread):
convert = self._checkVersion() #returns None or current version
self.conn = sqlite3.connect("files.db")
+ self.conn.text_factory = str
chmod("files.db", 0600)
self.c = self.conn.cursor() #compatibility
diff --git a/module/plugins/accounts/X7To.py b/module/plugins/accounts/X7To.py
index 1e3ef782e..abfb13e5e 100644
--- a/module/plugins/accounts/X7To.py
+++ b/module/plugins/accounts/X7To.py
@@ -36,10 +36,9 @@ class X7To(Account):
valid = re.search("Premium-Mitglied bis ([0-9]*-[0-9]*-[0-9]*)", page, re.IGNORECASE).group(1)
valid = int(mktime(strptime(valid, "%Y-%m-%d")))
- trafficleft = re.search('<em style="white-space:nowrap">([\d]*)[,]?[\d]?[\d]? (KB|MB|GB)</em>', page,
- re.IGNORECASE)
+ trafficleft = re.search(r'<em style="white-space:nowrap">([\d]*[,]?[\d]?[\d]?) (KB|MB|GB)</em>', page, re.IGNORECASE)
if trafficleft:
- units = float(trafficleft.group(1))
+ units = float(trafficleft.group(1).replace(",", "."))
pow = {'KB': 0, 'MB': 1, 'GB': 2}[trafficleft.group(2)]
trafficleft = int(units * 1024 ** pow)
else:
@@ -55,4 +54,4 @@ class X7To(Account):
{"redirect": "http://www.x7.to/", "id": user, "pw": data['password'], "submit": "submit"})
if "Username and password are not matching." in page:
- self.wrongPassword() \ No newline at end of file
+ self.wrongPassword()
diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py
index dc9cc455c..ca651c3c7 100644
--- a/module/plugins/hoster/BitshareCom.py
+++ b/module/plugins/hoster/BitshareCom.py
@@ -52,7 +52,7 @@ class BitshareCom(Hoster):
HOSTER_DOMAIN = "bitshare.com"
FILE_OFFLINE_PATTERN = r'''(>We are sorry, but the requested file was not found in our database|>Error - File not available<|The file was deleted either by the uploader, inactivity or due to copyright claim)'''
- FILE_INFO_PATTERN = r'<h1>Downloading\s(?P<name>.+?)\s-\s(?P<size>\d+)\s(?P<units>..)yte</h1>'
+ FILE_INFO_PATTERN = r'<h1>Downloading\s(?P<name>.+?)\s-\s(?P<size>[\d.]+)\s(?P<units>..)yte</h1>'
FILE_AJAXID_PATTERN = r'var ajaxdl = "(.*?)";'
CAPTCHA_KEY_PATTERN = r"http://api\.recaptcha\.net/challenge\?k=(.*?) "
@@ -78,8 +78,16 @@ class BitshareCom(Hoster):
self.offline()
# File name
- name1 = re.search(BitshareCom.__pattern__, self.pyfile.url).group('name')
- name2 = re.search(BitshareCom.FILE_INFO_PATTERN, self.html).group('name')
+ name1 = re.search(BitshareCom.__pattern__, self.pyfile.url)
+ if name1:
+ name1 = name1.group('name')
+ else:
+ name1 = ""
+ name2 = re.search(BitshareCom.FILE_INFO_PATTERN, self.html)
+ if name2:
+ name2 = name2.group('name')
+ else:
+ name2 = ""
self.pyfile.name = max(name1, name2)
# Ajax file id
diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py
index b2cab30de..24b168f07 100644
--- a/module/plugins/hoster/DepositfilesCom.py
+++ b/module/plugins/hoster/DepositfilesCom.py
@@ -21,6 +21,9 @@ class DepositfilesCom(Hoster):
def process(self, pyfile):
+ if re.search(r"(.*)\.html", self.pyfile.url):
+ self.pyfile.url = re.search(r"(.*)\.html", self.pyfile.url).group(1)
+
self.html = self.load(self.pyfile.url, cookies=True if self.account else False)
if '<span class="html_download_api-not_exists"></span>' in self.html:
diff --git a/module/plugins/hoster/EasyShareCom.py b/module/plugins/hoster/EasyShareCom.py
index 9d185f4b5..b389c5262 100644
--- a/module/plugins/hoster/EasyShareCom.py
+++ b/module/plugins/hoster/EasyShareCom.py
@@ -23,6 +23,9 @@ class EasyShareCom(Hoster):
self.pyfile = pyfile
self.html = self.load(self.pyfile.url)
+ if re.search("Die von ihnen angeforderte Datei wurde gel\xc3\xb6scht.", self.html):
+ self.offline();
+
self.pyfile.name = self.getFileName()
self.download( self.getFileUrl() )
diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py
index 8086437a8..9b853dc3c 100644
--- a/module/plugins/hoster/FileserveCom.py
+++ b/module/plugins/hoster/FileserveCom.py
@@ -53,14 +53,12 @@ class FileserveCom(Hoster):
LONG_WAIT_PATTERN = r"You need to wait (\d+) seconds to start another download"
def init(self):
+ self.multiDL = False
if self.account:
self.premium = self.account.getAccountInfo(self.user)["premium"]
if not self.premium:
- self.multiDL = False
self.resumeDownload = False
self.chunkLimit = 1
- else:
- self.multiDL = False
def process(self, pyfile):
self.checkFile()
@@ -178,4 +176,4 @@ class FileserveCom(Hoster):
else:
self.correctCaptcha()
break
- \ No newline at end of file
+
diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py
index 795cafadf..1c4e04dee 100644
--- a/module/plugins/hoster/FreakshareCom.py
+++ b/module/plugins/hoster/FreakshareCom.py
@@ -81,12 +81,15 @@ class FreakshareCom(Hoster):
def get_waiting_time(self):
if self.html is None:
self.download_html()
-
+
if "Der Traffic f\xc3\xbcr heute ist verbraucht!" in self.html or "Your Traffic is used up for today" in self.html:
self.wantReconnect = True
return 24*3600
-
- timestring = re.search('\s*var\stime\s=\s(\d*?)\.\d*;', self.html).group(1)
+
+ if re.search(r"This file does not exist!", self.html) is not None:
+ self.offline()
+
+ timestring = re.search('\s*var\sdownloadWait\s=\s(\d*);', self.html).group(1)
if timestring:
sec = int(timestring) + 1 #add 1 sec as tenths of seconds are cut off
else:
diff --git a/module/plugins/hoster/ShragleCom.py b/module/plugins/hoster/ShragleCom.py
index c1cef9f3e..9ebf4917b 100644
--- a/module/plugins/hoster/ShragleCom.py
+++ b/module/plugins/hoster/ShragleCom.py
@@ -35,8 +35,12 @@ class ShragleCom(Hoster):
def get_waiting_time(self):
if self.html is None:
self.download_html()
-
- return int(re.search('Please wait (\d+) seconds', self.html).group(1))
+
+ timestring = re.search('\s*var\sdownloadWait\s=\s(\d*);', self.html)
+ if timestring:
+ return int(timestring.group(1))
+ else:
+ return 10
def download_html(self):
self.html = self.load(self.pyfile.url)
@@ -58,8 +62,13 @@ class ShragleCom(Hoster):
if self.html is None:
self.download_html()
- file_name_pattern = r'You want to download \xc2\xbb<strong>(.*?)</strong>\xc2\xab'
- return re.search(file_name_pattern, self.html).group(1)
+ #file_name_pattern = r'You want to download \xc2\xbb<strong>(.*?)</strong>\xc2\xab'
+ file_name_pattern = r'<h2 class="colorgrey center" style="overflow:hidden;width:1000px;"> (.*)<br /><span style="font-size:12px;font-weight:normal; width:100px;"> ([\d\.]*) MB</span></h2>'
+ res = re.search(file_name_pattern, self.html)
+ if res:
+ return res.group(1)
+ else:
+ self.fail("filename cant be extracted")
def file_exists(self):
""" returns True or False
diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py
index 2c3656c95..f2f44d41b 100644
--- a/module/plugins/hoster/YourfilesTo.py
+++ b/module/plugins/hoster/YourfilesTo.py
@@ -55,9 +55,13 @@ class YourfilesTo(Hoster):
def get_file_url(self):
""" returns the absolute downloadable filepath
"""
- url = re.search(r"var bla = '(.*?)';", self.html).group(1)
- url = urllib.unquote(url.replace("http://http:/http://", "http://").replace("dumdidum", ""))
- return url
+ url = re.search(r"var bla = '(.*?)';", self.html)
+ if url:
+ url = url.group(1)
+ url = urllib.unquote(url.replace("http://http:/http://", "http://").replace("dumdidum", ""))
+ return url
+ else:
+ self.fail("absolute filepath could not be found. offline? ")
def get_file_name(self):
if self.html is None:
diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py
index 9c0b88e58..335f218d4 100644
--- a/module/plugins/hoster/ZippyshareCom.py
+++ b/module/plugins/hoster/ZippyshareCom.py
@@ -26,8 +26,11 @@ class ZippyshareCom(Hoster):
self.offline()
pyfile.name = self.get_file_name()
- self.download(self.get_file_url())
-
+ pyfile.url = self.get_file_url()
+ if pyfile.url:
+ self.download(pyfile.url)
+ else:
+ self.fail("URL could not be extracted")
def download_html(self):
url = self.pyfile.url
@@ -49,8 +52,8 @@ class ZippyshareCom(Hoster):
seed_pattern = r"seed: (\d*)"
seed_search = re.search(seed_pattern, self.html)
if seed_search is None:
- return False
-
+ self.fail("Problem downloading file.. offline?")
+
file_seed = int(seed_search.group(1))
time = str((file_seed * 24) % 6743256)