summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Thierry Merle <thierry.merle@free.fr> 2014-03-23 17:57:08 +0100
committerGravatar Stefano <l.stickell@yahoo.it> 2014-04-21 17:08:56 +0200
commit7ee2ba5b708c175035eb36ddbd778a2a5f89a879 (patch)
treec43f019833f6412d3e7d39640a799eeb3a4edc40
parentFreeWayMe: cosmetics (diff)
downloadpyload-7ee2ba5b708c175035eb36ddbd778a2a5f89a879.tar.xz
1fichier: fixed #553
Merges #556 (cherry picked from commit 3f101407b75e35c2460f725fc68777ac75451302)
-rw-r--r--pyload/plugins/hoster/OneFichierCom.py35
1 files changed, 21 insertions, 14 deletions
diff --git a/pyload/plugins/hoster/OneFichierCom.py b/pyload/plugins/hoster/OneFichierCom.py
index 9fa0a4b90..4142eaece 100644
--- a/pyload/plugins/hoster/OneFichierCom.py
+++ b/pyload/plugins/hoster/OneFichierCom.py
@@ -11,7 +11,7 @@ class OneFichierCom(SimpleHoster):
__name__ = "OneFichierCom"
__type__ = "hoster"
__pattern__ = r"(http://(\w+)\.((1fichier|d(es)?fichiers|pjointe)\.(com|fr|net|org)|(cjoint|mesfichiers|piecejointe|oi)\.(org|net)|tenvoi\.(com|org|net)|dl4free\.com|alterupload\.com|megadl.fr))"
- __version__ = "0.49"
+ __version__ = "0.50"
__description__ = """1fichier.com download hoster"""
__author_name__ = ("fragonib", "the-razer", "zoidberg", "imclem")
__author_mail__ = ("fragonib[AT]yahoo[DOT]es", "daniel_ AT gmx DOT net", "zoidberg@mujmail.cz", "imclem on github")
@@ -23,35 +23,42 @@ class OneFichierCom(SimpleHoster):
DOWNLOAD_LINK_PATTERN = r"""location\s*.\s*'(?P<N>http://.*?)'"""
PASSWORD_PROTECTED_TOKEN = "protected by password"
- WAITING_PATTERN = "Warning ! Without premium status, you can download only one file at a time and you must wait up to (\d+) minutes between each downloads."
+ WAITING_PATTERN = "Warning ! Without premium status, you must wait up to (\d+) minutes between each downloads"
+ LAST_DOWNLOAD_DELAY = "Your last download finished (\d+) minutes ago"
+ NOT_PARALLEL = r"Warning ! Without premium status, you can download only one file at a time"
+ RETRY_TIME = 15*60 #Default retry time in seconds (if detected parallel download)
def process(self, pyfile):
found = re.search(self.__pattern__, pyfile.url)
file_id = found.group(2)
url = "http://%s.%s/en/" % (found.group(2), found.group(3))
- self.html = self.load(url, post="submit", decode=True)
+ self.html = self.load(url, decode=True)
+
+ self.getFileInfo()
found = re.search(self.WAITING_PATTERN, self.html)
if found:
- self.waitAndRetry(int(found.group(1)) * 60)
-
- self.getFileInfo()
+ last_delay=0
+ # retrieve the delay from the last download to substract from required delay
+ found_delay = re.search(self.LAST_DOWNLOAD_DELAY, self.html)
+ if found_delay:
+ last_delay=int(found_delay.group(1))
+ self.waitAndRetry((int(found.group(1)) - last_delay) * 60)
+ else: #detect parallel download
+ found = re.search(self.NOT_PARALLEL, self.html)
+ if found:
+ self.waitAndRetry(self.RETRY_TIME)
url, inputs = self.parseHtmlForm('action="http://%s' % file_id)
- if not url or not inputs:
+ if not url:
self.parseError("Download link not found")
# Check for protection
if "pass" in inputs:
inputs['pass'] = self.getPassword()
+ inputs['submit'] = "Download"
- self.html = self.load(url, post=inputs)
- m = re.search(self.DOWNLOAD_LINK_PATTERN, self.html)
- if not m:
- self.parseError("Unable to detect download link")
- download_url = m.group(1)
-
- self.download(download_url)
+ self.download(url, post=inputs)
# Check download
self.checkDownloadedFile()