summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-01 04:45:27 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-01 04:45:27 +0200
commit01c5c24e6aa993b2060618e244f47a476725657d (patch)
tree836cb44ff85c4140f5eaed53583645faad2f7a70 /module
parent[CatShareNet] Fixed and improved (diff)
downloadpyload-01c5c24e6aa993b2060618e244f47a476725657d.tar.xz
[OneFichierCom] Fixed wait pattern + code optimizations
Diffstat (limited to 'module')
-rw-r--r--module/plugins/hoster/Keep2shareCC.py11
-rw-r--r--module/plugins/hoster/OneFichierCom.py56
2 files changed, 31 insertions, 36 deletions
diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py
index 78d6aaba7..f17faae46 100644
--- a/module/plugins/hoster/Keep2shareCC.py
+++ b/module/plugins/hoster/Keep2shareCC.py
@@ -1,7 +1,4 @@
# -*- coding: utf-8 -*-
-#
-# Test links:
-# http://k2s.cc/file/55fb73e1c00c5/random.bin
import re
@@ -22,13 +19,14 @@ class Keep2shareCC(SimpleHoster):
__author_name__ = "stickell"
__author_mail__ = "l.stickell@yahoo.it"
+
FILE_NAME_PATTERN = r'File: <span>(?P<N>.+)</span>'
FILE_SIZE_PATTERN = r'Size: (?P<S>[^<]+)</div>'
OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404'
LINK_PATTERN = r'To download this file with slow speed, use <a href="([^"]+)">this link</a>'
WAIT_PATTERN = r'Please wait ([\d:]+) to download this file'
- ALREADY_DOWNLOADING_PATTERN = r'Free account does not allow to download more than one file at the same time'
+ MULTIDL_ERROR = r'Free account does not allow to download more than one file at the same time'
RECAPTCHA_KEY = "6LcYcN0SAAAAABtMlxKj7X0hRxOY8_2U86kI1vbb"
@@ -59,7 +57,7 @@ class Keep2shareCC(SimpleHoster):
self.wait(wait_time, reconnect=True)
self.retry()
- m = re.search(self.ALREADY_DOWNLOADING_PATTERN, self.html)
+ m = re.search(self.MULTIDL_ERROR, self.html)
if m:
# if someone is already downloading on our line, wait 30min and retry
self.logDebug("Already downloading, waiting for 30 minutes")
@@ -71,6 +69,7 @@ class Keep2shareCC(SimpleHoster):
self.parseError("Unable to detect direct link")
self.startDownload(m.group(1))
+
def handleCaptcha(self):
recaptcha = ReCaptcha(self)
for _ in xrange(5):
@@ -94,11 +93,13 @@ class Keep2shareCC(SimpleHoster):
else:
self.fail("All captcha attempts failed")
+
def startDownload(self, url):
d = urljoin(self.base_url, url)
self.logDebug("Direct Link: " + d)
self.download(d, disposition=True)
+
def sanitize_url(self):
header = self.load(self.pyfile.url, just_header=True)
if 'location' in header:
diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py
index 8a962d062..984e2bb2d 100644
--- a/module/plugins/hoster/OneFichierCom.py
+++ b/module/plugins/hoster/OneFichierCom.py
@@ -1,7 +1,4 @@
# -*- coding: utf-8 -*-
-#
-# Test links:
-# http://5pnm24ltcw.1fichier.com/
import re
@@ -13,41 +10,39 @@ class OneFichierCom(SimpleHoster):
__type__ = "hoster"
__version__ = "0.61"
- __pattern__ = r'(http://(?P<id>\w+)\.(?P<host>(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))/?'
+ __pattern__ = r'https?://(?P<ID>\w+)\.(?P<HOST>(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)'
__description__ = """1fichier.com hoster plugin"""
__author_name__ = ("fragonib", "the-razer", "zoidberg", "imclem", "stickell", "Elrick69")
__author_mail__ = ("fragonib[AT]yahoo[DOT]es", "daniel_ AT gmx DOT net", "zoidberg@mujmail.cz",
"imclem on github", "l.stickell@yahoo.it", "elrick69[AT]rocketmail[DOT]com")
- FILE_NAME_PATTERN = r'">Filename :</th>\s*<td>(?P<N>[^<]+)</td>'
- FILE_SIZE_PATTERN = r'<th>Size :</th>\s*<td>(?P<S>[^<]+)</td>'
- OFFLINE_PATTERN = r'The (requested)? file (could not be found|has been deleted)'
- FILE_URL_REPLACEMENTS = [(__pattern__, r'http://\g<id>.\g<host>/en/')]
+ FILE_NAME_PATTERN = r'>Filename :</th>\s*<td>(?P<N>.+?)<'
+ FILE_SIZE_PATTERN = r'>Size :</th>\s*<td>(?P<S>[\d.,]+) (?P<U>\w+)'
+ OFFLINE_PATTERN = r'>The (requested)? file (could not be found|has been deleted)'
- WAITING_PATTERN = r'Warning ! Without premium status, you must wait between each downloads'
- NOT_PARALLEL = r'Warning ! Without premium status, you can download only one file at a time'
- WAIT_TIME = 10 * 60 # Retry time between each free download
- RETRY_TIME = 15 * 60 # Default retry time in seconds (if detected parallel download)
+ FILE_URL_REPLACEMENTS = [(__pattern__, r'http://\g<ID>.\g<HOST>/')]
+ COOKIES = [(".1fichier.com", "LG", "en")]
+
+ WAIT_PATTERN = r'>You must wait (\d+)'
def setup(self):
- self.multiDL = self.premium
+ self.multiDL = True
self.resumeDownload = True
+
def handleFree(self):
self.html = self.load(self.pyfile.url, decode=True)
-
- if self.WAITING_PATTERN in self.html:
- self.logInfo("You have to wait been each free download! Retrying in %d seconds." % self.WAIT_TIME)
- self.waitAndRetry(self.WAIT_TIME)
- else: # detect parallel download
- m = re.search(self.NOT_PARALLEL, self.html)
- if m:
- self.waitAndRetry(self.RETRY_TIME)
-
- url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['id'])
+ m = re.search(self.WAIT_PATTERN, self.html)
+ if m:
+ time = int(m.group(1)) + 1 * 60 #: One minute more than what the page displays to be safe
+ self.logInfo("You have to wait been each free download", "Retrying in %d minutes." % minutes)
+ self.wait(time, True)
+ self.retry()
+
+ url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['ID'])
if not url:
self.parseError("Download link not found")
@@ -61,8 +56,9 @@ class OneFichierCom(SimpleHoster):
# Check download
self.checkDownloadedFile()
+
def handlePremium(self):
- url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['id'])
+ url, inputs = self.parseHtmlForm('action="http://%s' % self.file_info['ID'])
if not url:
self.parseError("Download link not found")
@@ -76,15 +72,13 @@ class OneFichierCom(SimpleHoster):
# Check download
self.checkDownloadedFile()
+
def checkDownloadedFile(self):
- check = self.checkDownload({"wait": self.WAITING_PATTERN})
+ check = self.checkDownload({'wait': self.WAIT_PATTERN})
if check == "wait":
- self.waitAndRetry(int(self.lastcheck.group(1)) * 60)
-
- def waitAndRetry(self, wait_time):
- self.wait(wait_time, True)
- self.retry()
-
+ time = int(self.lastcheck.group(1)) * 60
+ self.wait(time, True)
+ self.retry()
getInfo = create_getInfo(OneFichierCom)