summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-05-21 00:48:34 +0200
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-05-21 00:48:34 +0200
commit66546318cd9faf655318ff56722294565fa8397a (patch)
tree847a3862a92df8d0f3180e8cd8f8f640ef0a43c9
parentclosed #602, #588 (diff)
downloadpyload-66546318cd9faf655318ff56722294565fa8397a.tar.xz
update filefactory, add datei.to, jumbofiles.com
-rw-r--r--module/plugins/hoster/DateiTo.py92
-rw-r--r--module/plugins/hoster/FilefactoryCom.py68
-rw-r--r--module/plugins/hoster/JumbofilesCom.py19
-rw-r--r--module/plugins/hoster/XFileSharingPro.py2
4 files changed, 141 insertions, 40 deletions
diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py
new file mode 100644
index 000000000..529a5a06f
--- /dev/null
+++ b/module/plugins/hoster/DateiTo.py
@@ -0,0 +1,92 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: zoidberg
+"""
+
+import re
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.plugins.ReCaptcha import ReCaptcha
+
+class DateiTo(SimpleHoster):
+ __name__ = "DateiTo"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?datei\.to/datei/(?P<ID>\w+)\.html"
+ __version__ = "0.01"
+ __description__ = """Datei.to plugin - free only"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_NAME_PATTERN = r'Dateiname:</td>\s*<td colspan="2"><strong>(?P<N>.*?)</'
+ FILE_SIZE_PATTERN = r'Dateigr&ouml;&szlig;e:</td>\s*<td colspan="2">(?P<S>.*?)</'
+ FILE_OFFLINE_PATTERN = r'>Datei wurde nicht gefunden<|>Bitte wähle deine Datei aus... <'
+ PARALELL_PATTERN = r'>Du lädst bereits eine Datei herunter<'
+
+ WAIT_PATTERN = r'countdown\({seconds: (\d+)'
+ DATA_PATTERN = r'url: "(.*?)", data: "(.*?)",'
+ RECAPTCHA_KEY_PATTERN = r'Recaptcha.create\("(.*?)"'
+
+ def handleFree(self):
+ url = 'http://datei.to/ajax/download.php'
+ data = {'P': 'I', 'ID': self.file_info['ID']}
+
+ recaptcha = ReCaptcha(self)
+
+ for i in range(10):
+ self.logDebug("URL", url, "POST", data)
+ self.html = self.load(url, post = data)
+ self.checkErrors()
+
+ if url.endswith('download.php') and 'P' in data:
+ if data['P'] == 'I':
+ self.doWait()
+
+ elif data['P'] == 'IV':
+ break
+
+ found = re.search(self.DATA_PATTERN, self.html)
+ if not found: self.parseError('data')
+ url = 'http://datei.to/' + found.group(1)
+ data = dict(x.split('=') for x in found.group(2).split('&'))
+
+ if url.endswith('recaptcha.php'):
+ found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html)
+ recaptcha_key = found.group(1) if found else "6LdBbL8SAAAAAI0vKUo58XRwDd5Tu_Ze1DA7qTao"
+
+ data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge(recaptcha_key)
+
+ else:
+ self.fail('Too bad...')
+
+ download_url = self.html
+ self.logDebug('Download URL', download_url)
+ self.download(download_url)
+
+ def checkErrors(self):
+ found = re.search(self.PARALELL_PATTERN, self.html)
+ if found:
+ self.setWait(wait_time + 1, False)
+ self.wait(300)
+ self.retry()
+
+ def doWait(self):
+ found = re.search(self.WAIT_PATTERN, self.html)
+ wait_time = int(found.group(1)) if found else 30
+ self.setWait(wait_time + 1, False)
+
+ self.load('http://datei.to/ajax/download.php', post = {'P': 'Ads'})
+ self.wait()
+
+getInfo = create_getInfo(DateiTo)
diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py
index 4f6666675..135dd90a1 100644
--- a/module/plugins/hoster/FilefactoryCom.py
+++ b/module/plugins/hoster/FilefactoryCom.py
@@ -4,6 +4,7 @@ from module.plugins.Hoster import Hoster
from module.plugins.ReCaptcha import ReCaptcha
from module.utils import parseFileSize
from module.plugins.Plugin import chunks
+from module.common.json_layer import json_loads
import re
@@ -16,7 +17,7 @@ def checkFile(plugin, urls):
url_ids = url_dict.keys()
urls = map(lambda url_id: 'http://www.filefactory.com/file/' + url_id, url_ids)
- html = getURL("http://filefactory.com/tool/links.php", post = {"func": "links", "links": "\n".join(urls)}, decode=True)
+ html = getURL("http://www.filefactory.com/tool/links.php", post = {"func": "links", "links": "\n".join(urls)}, decode=True)
for m in re.finditer(plugin.LC_INFO_PATTERN, html):
if m.group('id') in url_ids:
@@ -34,29 +35,28 @@ class FilefactoryCom(Hoster):
__name__ = "FilefactoryCom"
__type__ = "hoster"
__pattern__ = r"http://(?:www\.)?filefactory\.com/file/(?P<id>[a-zA-Z0-9]+).*" # URLs given out are often longer but this is the requirement
- __version__ = "0.33"
+ __version__ = "0.34"
__description__ = """Filefactory.Com File Download Hoster"""
__author_name__ = ("paulking", "zoidberg")
- LC_INFO_PATTERN = r'<tr class="(even|odd)">\s*<td>\s*<a href="http://www.filefactory.com/file/(?P<id>\w+)[^"]*">(?P<name>[^<]+)</a>\s*.*\s*</td>\s*<td>(?P<size>[0-9.]+ \w+)</td>'
- LC_OFFLINE_PATTERN = r'<li class="(even|odd)">\s*<div class="metadata">http://www.filefactory.com/file/(?P<id>\w+)/</div>'
-
+ LC_INFO_PATTERN = r'<h1 class="name">(?P<name>[^<]+) \((?P<size>[0-9.]+ \w+)\)</h1>\s*<p>http://www.filefactory.com/file/(?P<id>\w+)/'
+ LC_OFFLINE_PATTERN = r'<p>http://www.filefactory.com/file/(?P<id>\w+)/</p>\s*<p class="errorResponse">'
+
FILE_OFFLINE_PATTERN = r'<title>File Not Found'
FILE_NAME_PATTERN = r'<span class="last">(?P<name>.*?)</span>'
FILE_INFO_PATTERN = r'<span>(?P<size>\d(\d|\.)*) (?P<units>..) file uploaded'
- FILE_CHECK_PATTERN = r'check:\'(?P<check>.*?)\''
- CAPTCHA_KEY_PATTERN = r'Recaptcha.create\("(?P<recaptchakey>.*?)",'
- WAIT_PATH_PATTERN = r'path:"(?P<path>.*?)"'
+ FILE_CHECK_PATTERN = r'check:\s*\'(?P<check>.*?)\''
+ CAPTCHA_KEY_PATTERN = r'Recaptcha.create\(\s*"(.*?)",'
WAIT_PATTERN = r'id="startWait" value="(?P<wait>\d+)"'
- FILE_URL_PATTERN = r'<a href="(?P<url>.*?)" id="downloadLinkTarget">'
+ FILE_URL_PATTERN = r'<p[^>]*?id="downloadLinkTarget"[^>]*>\s*<a href="(?P<url>.*?)"'
def setup(self):
self.multiDL = self.resumeDownloads = self.premium
def process(self, pyfile):
# Check file
- pyfile.name, pyfile.size, status, self.url = checkFile(self, [pyfile.url])[0]
+ pyfile.name, pyfile.size, status, self.url = checkFile(self, [pyfile.url])[0]
if status != 2: self.offline()
self.logDebug("File Name: %s Size: %d" % (pyfile.name, pyfile.size))
@@ -93,42 +93,41 @@ class FilefactoryCom(Hoster):
# Check Id
self.check = re.search(self.FILE_CHECK_PATTERN, self.html).group('check')
- self.log.debug("%s: File check code is [%s]" % (self.__name__, self.check))
+ self.logDebug("File check code is [%s]" % self.check)
# Resolve captcha
- self.log.debug("%s: File is captcha protected" % self.__name__)
- id = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group('recaptchakey')
+ found = re.search(self.CAPTCHA_KEY_PATTERN, self.html)
+ recaptcha_key = found.group(1) if found else "6LeN8roSAAAAAPdC1zy399Qei4b1BwmSBSsBN8zm"
+ recaptcha = ReCaptcha(self)
+
# Try up to 5 times
- for i in range(5):
- self.log.debug("%s: Resolving ReCaptcha with key [%s], round %d" % (self.__name__, id, i+1))
- recaptcha = ReCaptcha(self)
- challenge, code = recaptcha.challenge(id)
- response = self.load("http://www.filefactory.com/file/checkCaptcha.php",
- post={"check" : self.check, "recaptcha_challenge_field" : challenge, "recaptcha_response_field" : code})
- captchavalid = self.handleCaptchaErrors(response)
- if captchavalid:
+ for i in range(5):
+ challenge, code = recaptcha.challenge(recaptcha_key)
+ response = json_loads(self.load("http://www.filefactory.com/file/checkCaptcha.php",
+ post={"check" : self.check, "recaptcha_challenge_field" : challenge, "recaptcha_response_field" : code}))
+ if response['status'] == 'ok':
+ self.correctCaptcha()
break
- if not captchavalid:
+ else:
+ self.invalidCaptcha()
+ else:
self.fail("No valid captcha after 5 attempts")
-
- # Get wait URL
- waitpath = re.search(self.WAIT_PATH_PATTERN, response).group('path')
- waiturl = "http://www.filefactory.com" + waitpath
# This will take us to a wait screen
- self.log.debug("%s: fetching wait with url [%s]" % (self.__name__, waiturl))
+ waiturl = "http://www.filefactory.com" + response['path']
+ self.logDebug("Fetching wait with url [%s]" % waiturl)
waithtml = self.load(waiturl, decode=True)
# Find the wait value and wait
wait = int(re.search(self.WAIT_PATTERN, waithtml).group('wait'))
- self.log.debug("%s: Waiting %d seconds." % (self.__name__, wait))
+ self.logDebug("Waiting %d seconds." % wait)
self.setWait(wait, True)
self.wait()
# Now get the real download url and retrieve the file
url = re.search(self.FILE_URL_PATTERN,waithtml).group('url')
# this may either download our file or forward us to an error page
- self.log.debug("%s: download url %s" % (self.__name__, url))
+ self.logDebug("Download URL: %s" % url)
dl = self.download(url)
check = self.checkDownload({"multiple": "You are currently downloading too many files at once.",
@@ -136,20 +135,11 @@ class FilefactoryCom(Hoster):
if check == "multiple":
self.setWait(15*60)
- self.log.debug("%s: Parallel downloads detected waiting 15 minutes" % self.__name__)
+ self.logDebug("Parallel downloads detected; waiting 15 minutes")
self.wait()
self.retry()
elif check == "error":
self.fail("Unknown error")
-
- def handleCaptchaErrors(self, response):
- self.log.debug("%s: Result of captcha resolving [%s]" % (self.__name__, response))
- if 'status:"ok"' in response:
- self.correctCaptcha()
- return True
-
- self.log.debug("%s: Wrong captcha" % self.__name__)
- self.invalidCaptcha()
def handlePremium(self):
self.fail('Please enable direct downloads')
diff --git a/module/plugins/hoster/JumbofilesCom.py b/module/plugins/hoster/JumbofilesCom.py
new file mode 100644
index 000000000..a338b31cc
--- /dev/null
+++ b/module/plugins/hoster/JumbofilesCom.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+import re
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
+from module.utils import html_unescape
+
+class JumbofilesCom(XFileSharingPro):
+ __name__ = "JumbofilesCom"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:\w*\.)*(jumbofiles.com)/\w{12}"
+ __version__ = "0.01"
+ __description__ = """JumboFiles.com hoster plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ FILE_INFO_PATTERN = '<TR><TD>(?P<N>[^<]+?)\s*<small>\((?P<S>[\d.]+)\s*(?P<U>[KMG][bB])\)</small></TD></TR>'
+ FILE_OFFLINE_PATTERN = 'Not Found or Deleted / Disabled due to inactivity or DMCA'
+ DIRECT_LINK_PATTERN = '<FORM METHOD="LINK" ACTION="(.*?)"'
+
+getInfo = create_getInfo(JumbofilesCom) \ No newline at end of file
diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py
index b7b7803f5..6b98b4d08 100644
--- a/module/plugins/hoster/XFileSharingPro.py
+++ b/module/plugins/hoster/XFileSharingPro.py
@@ -154,7 +154,7 @@ class XFileSharingPro(SimpleHoster):
self.wait()
elif 'captcha' in self.errmsg:
self.invalidCaptcha()
- elif 'countdown' in self.errmsg:
+ elif 'countdown' or 'Expired session' in self.errmsg:
self.retry(3)
elif 'maintenance' in self.errmsg:
self.tempOffline()