summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/FilesMailRu.py
diff options
context:
space:
mode:
authorGravatar lazlev <lazlev@yopmail.com> 2015-08-09 00:50:54 +0200
committerGravatar lazlev <lazlev@yopmail.com> 2015-08-09 00:50:54 +0200
commitb0ef3f1673e1930916604bb1264ca3a38414bc8d (patch)
treec97936e4d2a4cd6eb1072c65c8a08a7d18816b18 /module/plugins/hoster/FilesMailRu.py
parent[XFileSharingPro][XFileSharingProFolder] Added default __pattern__ (diff)
parentFix https://github.com/pyload/pyload/issues/1707 (diff)
downloadpyload-b0ef3f1673e1930916604bb1264ca3a38414bc8d.tar.xz
Merge pull request #1 from pyload/stable
sync with stable
Diffstat (limited to 'module/plugins/hoster/FilesMailRu.py')
-rw-r--r--module/plugins/hoster/FilesMailRu.py76
1 files changed, 41 insertions, 35 deletions
diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py
index 7bd099282..a6dd56152 100644
--- a/module/plugins/hoster/FilesMailRu.py
+++ b/module/plugins/hoster/FilesMailRu.py
@@ -2,16 +2,16 @@
import re
-from module.network.RequestFactory import getURL
-from module.plugins.Hoster import Hoster
-from module.plugins.Plugin import chunks
+from module.network.RequestFactory import getURL as get_url
+from module.plugins.internal.Hoster import Hoster
+from module.plugins.internal.Plugin import chunks
-def getInfo(urls):
+def get_info(urls):
result = []
for chunk in chunks(urls, 10):
for url in chunk:
- html = getURL(url)
+ html = get_url(url)
if r'<div class="errorMessage mb10">' in html:
result.append((url, 0, 1, url))
elif r'Page cannot be displayed' in html:
@@ -24,15 +24,16 @@ def getInfo(urls):
except Exception:
pass
- # status 1=OFFLINE, 2=OK, 3=UNKNOWN
- # result.append((#name,#size,#status,#url))
+ #: status 1=OFFLINE, 2=OK, 3=UNKNOWN
+ #: result.append((#name,#size,#status,#url))
yield result
class FilesMailRu(Hoster):
__name__ = "FilesMailRu"
__type__ = "hoster"
- __version__ = "0.32"
+ __version__ = "0.34"
+ __status__ = "testing"
__pattern__ = r'http://(?:www\.)?files\.mail\.ru/.+'
@@ -49,57 +50,62 @@ class FilesMailRu(Hoster):
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'''
+ #: Marks the file as "offline" when the pattern was found on the html-page'''
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()
+ #: The filename that will be showed in the list (e.g. test.part1.rar)'''
+ pyfile.name = self.get_file_name()
- #prepare and download'''
+ #: Prepare and download'''
if not self.account:
self.prepare()
- self.download(self.getFileUrl())
- self.myPostProcess()
+ self.download(self.get_file_url())
+ self.my_post_process()
else:
- self.download(self.getFileUrl())
- self.myPostProcess()
+ self.download(self.get_file_url())
+ self.my_post_process()
def prepare(self):
- """You have to wait some seconds. Otherwise you will get a 40Byte HTML Page instead of the file you expected"""
- self.setWait(10)
- self.wait()
+ """
+ You have to wait some seconds. Otherwise you will get a 40Byte HTML Page instead of the file you expected
+ """
+ self.wait(10)
return True
- def getFileUrl(self):
- """gives you the URL to the file. Extracted from the Files.mail.ru HTML-page stored in self.html"""
+ def get_file_url(self):
+ """
+ Gives you the URL to the file. Extracted from the Files.mail.ru HTML-page stored in self.html
+ """
return re.search(self.url_pattern, self.html).group(0).split('<a href="')[1].split('" onclick="return Act')[0]
- def getFileName(self):
- """gives you the Name for each file. Also extracted from the HTML-Page"""
+ def get_file_name(self):
+ """
+ Gives you the Name for each file. Also extracted from the HTML-Page
+ """
return re.search(self.url_pattern, self.html).group(0).split(', event)">')[1].split('</a>')[0]
- def myPostProcess(self):
- # 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 ;-) )
+ def my_post_process(self):
+ #: 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
- # (Loading 100MB in to ram is not an option)
- check = self.checkDownload({"html": "<meta name="}, read_size=50000)
+ #: The maximum UploadSize allowed on files.mail.ru at the moment == 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
+ #: (Loading 100MB in to ram is not an option)
+ check = self.check_download({'html': "<meta name="}, read_size=50000)
if check == "html":
- self.logInfo(_(
+ self.log_info(_(
"There was HTML Code in the Downloaded File (%s)...redirect error? The Download will be restarted." %
self.pyfile.name))
self.retry()