summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-04-21 01:11:27 +0200
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-04-21 01:11:27 +0200
commit44e49db14c4b96a228def7c871aea40dd07e1dd9 (patch)
treeb8ae49a102c71f66ef2a7917efde5bfac7afc35b /module/plugins/hoster
parentupdate uloz.to, uploading.com - closed #466 (diff)
downloadpyload-44e49db14c4b96a228def7c871aea40dd07e1dd9.tar.xz
update ifile.it - closed #583, XFileSharingPro, add rapidgator.net
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r--module/plugins/hoster/IfileIt.py34
-rw-r--r--module/plugins/hoster/RapidgatorNet.py113
2 files changed, 129 insertions, 18 deletions
diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py
index cdb5a7919..1626b1853 100644
--- a/module/plugins/hoster/IfileIt.py
+++ b/module/plugins/hoster/IfileIt.py
@@ -26,7 +26,7 @@ class IfileIt(SimpleHoster):
__name__ = "IfileIt"
__type__ = "hoster"
__pattern__ = r"http://(?:\w*\.)*(?:ifile\.it|mihd\.net)/(\w+).*"
- __version__ = "0.25"
+ __version__ = "0.26"
__description__ = """Ifile.it"""
__author_name__ = ("zoidberg")
@@ -35,29 +35,29 @@ class IfileIt(SimpleHoster):
DOWNLOAD_LINK_PATTERN = r'</span> If it doesn\'t, <a target="_blank" href="([^"]+)">'
RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';"
FILE_INFO_PATTERN = r'<span style="cursor: default;[^>]*>\s*(?P<N>.*?)\s*&nbsp;\s*<strong>\s*(?P<S>[0-9.]+)\s*(?P<U>[kKMG])i?B\s*</strong>\s*</span>'
- FILE_OFFLINE_PATTERN = r'$\("#errorPnl"\)\.empty\(\)\.append\( "no such file" \);'
+ FILE_OFFLINE_PATTERN = r'<span style="cursor: default;[^>]*>\s*&nbsp;\s*<strong>\s*</strong>\s*</span>'
TEMP_OFFLINE_PATTERN = r'<span class="msg_red">Downloading of this file is temporarily disabled</span>'
def handleFree(self):
ukey = re.search(self.__pattern__, self.pyfile.url).group(1)
- json_url = 'http://ifile.it/download-request2.json?ukey=' + ukey
-
- json_response = json_loads(self.load(json_url))
+ json_url = 'http://ifile.it/new_download-request.json'
+ post_data = {"ukey" : ukey, "ab": "0"}
+
+ json_response = json_loads(self.load(json_url, post = post_data))
self.logDebug(json_response)
+ if json_response['status'] == 3:
+ self.offline()
+
if json_response["captcha"]:
captcha_key = re.search(self.RECAPTCHA_KEY_PATTERN, self.html).group(1)
recaptcha = ReCaptcha(self)
+ post_data["ctype"] = "recaptcha"
for i in range(5):
- captcha_challenge, captcha_response = recaptcha.challenge(captcha_key)
-
- json_response = json_loads(self.load(json_url, post={
- "ctype": "recaptcha",
- "recaptcha_challenge": captcha_challenge,
- "recaptcha_response": captcha_response
- }))
-
+ post_data["recaptcha_challenge"], post_data["recaptcha_response"] = recaptcha.challenge(captcha_key)
+ json_response = json_loads(self.load(json_url, post = post_data))
self.logDebug(json_response)
+
if json_response["retry"]:
self.invalidCaptcha()
else:
@@ -66,11 +66,9 @@ class IfileIt(SimpleHoster):
else:
self.fail("Incorrect captcha")
- # load twice
- self.html = self.load(self.pyfile.url)
- self.html = self.load(self.pyfile.url)
- download_url = re.search(self.DOWNLOAD_LINK_PATTERN, self.html).group(1)
+ if not "ticket_url" in json_response:
+ self.parseError("Download URL")
- self.download(download_url)
+ self.download(json_response["ticket_url"])
getInfo = create_getInfo(IfileIt) \ No newline at end of file
diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py
new file mode 100644
index 000000000..a8c55f0ba
--- /dev/null
+++ b/module/plugins/hoster/RapidgatorNet.py
@@ -0,0 +1,113 @@
+# -*- 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 pycurl import HTTPHEADER
+
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
+from module.common.json_layer import json_loads
+from module.plugins.ReCaptcha import ReCaptcha
+
+class RapidgatorNet(SimpleHoster):
+ __name__ = "RapidgatorNet"
+ __type__ = "hoster"
+ __pattern__ = r"http://(?:www\.)?(rapidgator.net)/file/(\d+)"
+ __version__ = "0.01"
+ __description__ = """rapidgator.net"""
+ __author_name__ = ("zoidberg")
+
+ FILE_INFO_PATTERN = r'Downloading:\s*</strong>\s*(?P<N>.*?)\s*</p>\s*<div>\s*File size:\s*<strong>(?P<S>.*?)</strong>'
+ FILE_OFFLINE_PATTERN = r'<title>File not found</title>'
+
+ JSVARS_PATTERN = r"\s+var\s*(startTimerUrl|getDownloadUrl|captchaUrl|fid|secs)\s*=\s*'?(.*?)'?;"
+ DOWNLOAD_LINK_PATTERN = r"location.href = '(.*?)'"
+ RECAPTCHA_KEY_PATTERN = r'"http://api.recaptcha.net/challenge?k=(.*?)"'
+
+ def handleFree(self):
+ self.checkWait()
+
+ jsvars = dict(re.findall(self.JSVARS_PATTERN, self.html))
+ self.logDebug(jsvars)
+
+ self.req.http.lastURL = self.pyfile.url
+ self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
+
+ url = "http://rapidgator.net%s?fid=%s" % (jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars["fid"])
+ jsvars.update(self.getJsonResponse(url))
+
+ self.setWait(int(jsvars.get('secs', 30)) + 1, False)
+ self.wait()
+
+ url = "http://rapidgator.net%s?sid=%s" % (jsvars.get('getDownloadUrl', '/download/AjaxGetDownload'), jsvars["sid"])
+ jsvars.update(self.getJsonResponse(url))
+
+ self.req.http.lastURL = self.pyfile.url
+ self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"])
+
+ url = "http://rapidgator.net%s" % jsvars.get('captchaUrl', '/download/captcha')
+ self.html = self.load(url)
+ found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html)
+ captcha_key = found.group(1) if found else "6Lc3yccSAAAAACb1PdeP4xZm1oTZrYzhlhRPjQd_"
+ recaptcha = ReCaptcha(self)
+
+ for i in range(5):
+ self.checkWait()
+ captcha_challenge, captcha_response = recaptcha.challenge(captcha_key)
+
+ self.html = self.load(url, post={
+ "DownloadCaptchaForm[captcha]": "",
+ "recaptcha_challenge_field": captcha_challenge,
+ "recaptcha_response_field": captcha_response
+ })
+
+ if 'The verification code is incorrect' in self.html:
+ self.invalidCaptcha()
+ else:
+ self.correctCaptcha()
+ break
+ else:
+ self.fail("No valid captcha solution received")
+
+ found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html)
+ if not found:
+ self.parseError("download link")
+ download_url = found.group(1)
+ self.logDebug(download_url)
+ self.download(download_url)
+
+ def checkWait(self):
+ wait_time = 0
+ if "Delay between downloads must be not less than" in self.html:
+ wait_time = 5 * 60
+ elif "You have reached your daily downloads limit" in self.html:
+ self.logInfo("Daily limit reached")
+ wait_time = 60 * 60
+
+ if wait_time:
+ self.setWait(wait_time, True)
+ self.wait()
+ self.retry(max_tries = 24)
+
+ def getJsonResponse(self, url):
+ response = self.load(url, decode = True)
+ if not response.startswith('{'):
+ self.retry()
+ self.logDebug(url, response)
+ return json_loads(response)
+
+getInfo = create_getInfo(RapidgatorNet) \ No newline at end of file