summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Jeix <devnull@localhost> 2010-11-02 19:25:56 +0100
committerGravatar Jeix <devnull@localhost> 2010-11-02 19:25:56 +0100
commit7f7055e5579a20d1b0461e2c02d4e88262f191fb (patch)
treead4c0b939f0600a300e88ff70a3a57fe29ca1e94 /module/plugins
parentclosed #176 thanks for bug report (diff)
downloadpyload-7f7055e5579a20d1b0461e2c02d4e88262f191fb.tar.xz
files.mail.ru update
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/Plugin.py2
-rw-r--r--module/plugins/hoster/FilesMailRu.py48
2 files changed, 45 insertions, 5 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index 0e78686c7..502f7bc24 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -288,7 +288,7 @@ class Plugin(object):
if not exists(join("tmp", self.__name__)):
makedirs(join("tmp", self.__name__))
- f = open(join("tmp", self.__name__, "%s_line%s.dump" % (frame.f_back.f_code.co_name, frame.f_back.f_lineno)), "wb")
+ f = open(join("tmp", self.__name__, "%s_line%s.dump.html" % (frame.f_back.f_code.co_name, frame.f_back.f_lineno)), "wb")
f.write(res)
f.close()
diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py
index 028fcc465..cb180a858 100644
--- a/module/plugins/hoster/FilesMailRu.py
+++ b/module/plugins/hoster/FilesMailRu.py
@@ -3,24 +3,50 @@
import re
from module.plugins.Hoster import Hoster
+from module.network.Request import getURL
+
+
+def getInfo(urls):
+ result = []
+ for url in urls:
+ src = getURL(url)
+ if r'<div class="errorMessage mb10">' in src:
+ result.append(url, 0, 1, url)
+ elif r'Page cannot be displayed' in src:
+ result.append(url, 0, 1, url)
+ else:
+ try:
+ url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>'
+ file_name = re.search(url_pattern, src).group(0).split(', event)">')[1].split('</a>')[0]
+ result.append(file_name, 0, 2, url)
+ except:
+ result.append(url, 0, 1, url)
+
+
+ # status 1=OFFLINE, 2=OK, 3=UNKNOWN
+ # result.append(#name,#size,#status,#url)
+ yield result
class FilesMailRu(Hoster):
__name__ = "FilesMailRu"
__type__ = "hoster"
__pattern__ = r"http://files\.mail\.ru/.*"
- __version__ = "0.1"
+ __version__ = "0.2"
__description__ = """Files.Mail.Ru One-Klick Hoster"""
__author_name__ = ("oZiRiz")
__author_mail__ = ("ich@oziriz.de")
+
def process(self, pyfile):
self.html = self.load(pyfile.url)
self.url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>'
#marks the file as "offline" when the pattern was found on the html-page'''
- if re.search(r'<div class="errorMessage mb10">', self.html) is not None:
+ if r'<div class="errorMessage mb10">' in self.html:
self.offline()
+ elif r'Page cannot be displayed' in self.html:
+ self.offline()
#the filename that will be showed in the list (e.g. test.part1.rar)'''
pyfile.name = self.getFileName()
@@ -28,8 +54,7 @@ class FilesMailRu(Hoster):
#prepare and download'''
self.prepare()
self.download(self.getFileUrl())
-
-
+ self.myPostProcess(pyfile.name)
def prepare(self):
@@ -48,3 +73,18 @@ class FilesMailRu(Hoster):
'''gives you the Name for each file. Also extracted from the HTML-Page'''
file_name = re.search(self.url_pattern, self.html).group(0).split(', event)">')[1].split('</a>')[0]
return file_name
+
+ def myPostProcess(self,filename):
+ # searches the file for HTMl-Code. Sometimes the Redirect
+ # doesn't work (maybe a curl Problem) and you get only a small
+ # HTML file and the Download is marked as "finished"
+ # then the download will be restarted. It's only bad for these
+ # who want download a HTML-File (it's one in a million ;-) )
+ #
+ # The maximum UploadSize allowed on files.mail.ru at the moment is 100MB
+ # so i set it to check every download because sometimes there are downloads
+ # that contain the HTML-Text and 60MB ZEROs after that in a xyzfile.part1.rar file
+ check = self.checkDownload({"empty": "<meta name="}, max_size=110000000)
+ if check == "empty":
+ self.log.info(_("There was HTML Code in the Downloaded File("+ filename +")...redirect error? The Download will be restarted."))
+ self.retry()