summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-05 01:55:44 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-05 02:27:38 +0200
commitdf10dce103716acc293f51572650b3dbb7264bf2 (patch)
treeb4523f52f57ff81672a8bb7395c98784cb515c26 /module/plugins
parentUse load instead req.load in all crypters and CaptchaService (diff)
downloadpyload-df10dce103716acc293f51572650b3dbb7264bf2.tar.xz
Spare code fixes about COOKIES
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/hoster/BitshareCom.py7
-rw-r--r--module/plugins/hoster/DlFreeFr.py10
-rw-r--r--module/plugins/hoster/UploadingCom.py14
3 files changed, 22 insertions, 9 deletions
diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py
index d7143952b..86bc22860 100644
--- a/module/plugins/hoster/BitshareCom.py
+++ b/module/plugins/hoster/BitshareCom.py
@@ -22,15 +22,17 @@ class BitshareCom(SimpleHoster):
FILE_INFO_PATTERN = r'Downloading (?P<N>.+) - (?P<S>[\d.]+) (?P<U>\w+)</h1>'
OFFLINE_PATTERN = r'(>We are sorry, but the requested file was not found in our database|>Error - File not available<|The file was deleted either by the uploader, inactivity or due to copyright claim)'
+ COOKIES = [(".bitshare.com", "language_selection", "EN")]
+
FILE_AJAXID_PATTERN = r'var ajaxdl = "(.*?)";'
TRAFFIC_USED_UP = r'Your Traffic is used up for today. Upgrade to premium to continue!'
def setup(self):
- self.req.cj.setCookie(".bitshare.com", "language_selection", "EN")
self.multiDL = self.premium
self.chunkLimit = 1
+
def process(self, pyfile):
if self.premium:
self.account.relogin(self.user)
@@ -77,6 +79,7 @@ class BitshareCom(SimpleHoster):
elif check == "error":
self.retry(5, 5 * 60, "Bitshare host : Error occured")
+
def getDownloadUrl(self):
# Return location if direct download is active
if self.premium:
@@ -131,6 +134,7 @@ class BitshareCom(SimpleHoster):
return url
+
def handleErrors(self, response, separator):
self.logDebug("Checking response [%s]" % response)
if "ERROR:Session timed out" in response:
@@ -139,6 +143,7 @@ class BitshareCom(SimpleHoster):
msg = response.split(separator)[-1]
self.fail(msg)
+
def handleCaptchaErrors(self, response):
self.logDebug("Result of captcha resolving [%s]" % response)
if "SUCCESS" in response:
diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py
index e25de18b4..de282d443 100644
--- a/module/plugins/hoster/DlFreeFr.py
+++ b/module/plugins/hoster/DlFreeFr.py
@@ -40,10 +40,12 @@ class AdYouLike:
ADYOULIKE_CALLBACK = r'Adyoulike.g._jsonp_5579316662423138'
ADYOULIKE_CHALLENGE_PATTERN = ADYOULIKE_CALLBACK + r'\((.*?)\)'
+
def __init__(self, plugin, engine="adyoulike"):
self.plugin = plugin
self.engine = engine
+
def challenge(self, html):
adyoulike_data_string = None
m = re.search(self.ADYOULIKE_INPUT_PATTERN, html)
@@ -71,6 +73,7 @@ class AdYouLike:
return ayl_data, challenge_data
+
def result(self, ayl, challenge):
"""
Adyoulike.g._jsonp_5579316662423138
@@ -117,6 +120,7 @@ class DlFreeFr(SimpleHoster):
__author_name__ = ("the-razer", "zoidberg", "Toilal")
__author_mail__ = ("daniel_ AT gmx DOT net", "zoidberg@mujmail.cz", "toilal.dev@gmail.com")
+
FILE_NAME_PATTERN = r'Fichier:</td>\s*<td[^>]*>(?P<N>[^>]*)</td>'
FILE_SIZE_PATTERN = r'Taille:</td>\s*<td[^>]*>(?P<S>[\d.]+[KMG])o'
OFFLINE_PATTERN = r"Erreur 404 - Document non trouv|Fichier inexistant|Le fichier demand&eacute; n'a pas &eacute;t&eacute; trouv&eacute;"
@@ -127,13 +131,13 @@ class DlFreeFr(SimpleHoster):
self.limitDL = 5
self.chunkLimit = 1
+
def init(self):
factory = self.core.requestFactory
self.req = CustomBrowser(factory.bucket, factory.getOptions())
- def process(self, pyfile):
- self.req.setCookieJar(None)
+ def process(self, pyfile):
pyfile.url = replace_patterns(pyfile.url, self.FILE_URL_REPLACEMENTS)
valid_url = pyfile.url
headers = self.load(valid_url, just_header=True)
@@ -157,6 +161,7 @@ class DlFreeFr(SimpleHoster):
else:
self.fail("Invalid return code: " + str(headers.get('code')))
+
def handleFree(self):
action, inputs = self.parseHtmlForm('action="getfile.pl"')
@@ -180,6 +185,7 @@ class DlFreeFr(SimpleHoster):
else:
self.fail("Invalid response")
+
def getLastHeaders(self):
#parse header
header = {"code": self.req.code}
diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py
index 45ab1d4cd..f4d6f5d8d 100644
--- a/module/plugins/hoster/UploadingCom.py
+++ b/module/plugins/hoster/UploadingCom.py
@@ -19,18 +19,18 @@ class UploadingCom(SimpleHoster):
__author_name__ = ("jeix", "mkaay", "zoidberg")
__author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de", "zoidberg@mujmail.cz")
+
FILE_NAME_PATTERN = r'id="file_title">(?P<N>.+)</'
FILE_SIZE_PATTERN = r'size tip_container">(?P<S>[\d.]+) (?P<U>\w+)<'
OFFLINE_PATTERN = r'(Page|file) not found'
+ COOKIES = [(".uploading.com", "lang", "1"),
+ (".uploading.com", "language", "1"),
+ (".uploading.com", "setlang", "en"),
+ (".uploading.com", "_lang", "en")]
- def process(self, pyfile):
- # set lang to english
- self.req.cj.setCookie(".uploading.com", "lang", "1")
- self.req.cj.setCookie(".uploading.com", "language", "1")
- self.req.cj.setCookie(".uploading.com", "setlang", "en")
- self.req.cj.setCookie(".uploading.com", "_lang", "en")
+ def process(self, pyfile):
if not "/get/" in pyfile.url:
pyfile.url = pyfile.url.replace("/files", "/files/get")
@@ -42,6 +42,7 @@ class UploadingCom(SimpleHoster):
else:
self.handleFree()
+
def handlePremium(self):
postData = {'action': 'get_link',
'code': self.file_info['ID'],
@@ -55,6 +56,7 @@ class UploadingCom(SimpleHoster):
raise Exception("Plugin defect.")
+
def handleFree(self):
m = re.search('<h2>((Daily )?Download Limit)</h2>', self.html)
if m: