summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-05-01 01:06:01 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-05-01 01:06:01 +0200
commit1ef93e913238275f7657d496ba3d2e7eeb5a30a2 (patch)
treec52a2ab51763fce4a9b47d3c62388a27ebdeeda8 /module/plugins/internal
parentFix https://github.com/pyload/pyload/issues/1373 (diff)
downloadpyload-1ef93e913238275f7657d496ba3d2e7eeb5a30a2.tar.xz
Use 'import' instead 'from'
Diffstat (limited to 'module/plugins/internal')
-rw-r--r--module/plugins/internal/CaptchaService.py12
-rw-r--r--module/plugins/internal/SimpleCrypter.py7
-rw-r--r--module/plugins/internal/SimpleDereferer.py5
-rw-r--r--module/plugins/internal/XFSAccount.py5
-rw-r--r--module/plugins/internal/XFSHoster.py15
5 files changed, 19 insertions, 25 deletions
diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py
index ec938079a..b6afad22a 100644
--- a/module/plugins/internal/CaptchaService.py
+++ b/module/plugins/internal/CaptchaService.py
@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*-
+import random
import re
import time
+import urlparse
from base64 import b64encode
-from random import random, randint
-from urlparse import urljoin, urlparse
from module.common.json_layer import json_loads
from module.plugins.Plugin import Base
@@ -155,7 +155,7 @@ class ReCaptcha(CaptchaService):
self.logDebug("Time: %s" % millis)
- rand = randint(1, 99999999)
+ rand = random.randint(1, 99999999)
a = "0.%s" % str(rand * 2147483647)
rpc = int(100000000 * float(a))
@@ -167,7 +167,7 @@ class ReCaptcha(CaptchaService):
def _challenge_v2(self, key, parent=None):
if parent is None:
try:
- parent = urljoin("http://", urlparse(self.plugin.pyfile.url).netloc)
+ parent = urlparse.urljoin("http://", urlparse.urlparse(self.plugin.pyfile.url).netloc)
except Exception:
parent = ""
@@ -214,7 +214,7 @@ class ReCaptcha(CaptchaService):
self.logDebug("Result: %s" % response)
timeToSolve = int(round(time.time() * 1000)) - millis_captcha_loading
- timeToSolveMore = timeToSolve + int(float("0." + str(randint(1, 99999999))) * 500)
+ timeToSolveMore = timeToSolve + int(float("0." + str(random.randint(1, 99999999))) * 500)
html = self.plugin.req.load("https://www.google.com/recaptcha/api2/userverify",
post={'k' : key,
@@ -296,7 +296,7 @@ class AdsCaptcha(CaptchaService):
def result(self, server, challenge):
result = self.plugin.decryptCaptcha("%sChallenge.aspx" % server,
- get={'cid': challenge, 'dummy': random()},
+ get={'cid': challenge, 'dummy': random.random()},
cookies=True,
imgtype="jpg")
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index 892144ef4..09805cf1a 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urlparse import urljoin, urlparse
+import urlparse
from module.plugins.Crypter import Crypter
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookies
@@ -150,10 +149,10 @@ class SimpleCrypter(Crypter, SimpleHoster):
Returns the links extracted from self.html
You should override this only if it's impossible to extract links using only the LINK_PATTERN.
"""
- url_p = urlparse(self.pyfile.url)
+ url_p = urlparse.urlparse(self.pyfile.url)
baseurl = "%s://%s" % (url_p.scheme, url_p.netloc)
- return [urljoin(baseurl, link) if not urlparse(link).scheme else link \
+ return [urlparse.urljoin(baseurl, link) if not urlparse.urlparse(link).scheme else link \
for link in re.findall(self.LINK_PATTERN, self.html)]
diff --git a/module/plugins/internal/SimpleDereferer.py b/module/plugins/internal/SimpleDereferer.py
index 743a98721..fad1559c7 100644
--- a/module/plugins/internal/SimpleDereferer.py
+++ b/module/plugins/internal/SimpleDereferer.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urllib import unquote
+import urllib
from module.plugins.Crypter import Crypter
from module.plugins.internal.SimpleHoster import getFileURL, set_cookies
@@ -49,7 +48,7 @@ class SimpleDereferer(Crypter):
if not link:
try:
- link = unquote(re.match(self.__pattern__, pyfile.url).group('LINK'))
+ link = urllib.unquote(re.match(self.__pattern__, pyfile.url).group('LINK'))
except Exception:
self.prepare()
diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py
index 31d1b7e2f..41e1bde4d 100644
--- a/module/plugins/internal/XFSAccount.py
+++ b/module/plugins/internal/XFSAccount.py
@@ -2,8 +2,7 @@
import re
import time
-
-from urlparse import urljoin
+import urlparse
from module.plugins.Account import Account
from module.plugins.internal.SimpleHoster import parseHtmlForm, set_cookies
@@ -160,7 +159,7 @@ class XFSAccount(Account):
raise Exception(_("Missing HOSTER_DOMAIN"))
if not self.LOGIN_URL:
- self.LOGIN_URL = urljoin(self.HOSTER_URL, "login.html")
+ self.LOGIN_URL = urlparse.urljoin(self.HOSTER_URL, "login.html")
html = req.load(self.LOGIN_URL, decode=True)
action, inputs = parseHtmlForm('name="FL"', html)
diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py
index 027e68236..33dc6d16b 100644
--- a/module/plugins/internal/XFSHoster.py
+++ b/module/plugins/internal/XFSHoster.py
@@ -1,12 +1,9 @@
# -*- coding: utf-8 -*-
+import pycurl
+import random
import re
-import time
-
-from random import random
-from urlparse import urljoin, urlparse
-
-from pycurl import FOLLOWLOCATION, LOW_SPEED_TIME
+import urlparse
from module.plugins.internal.CaptchaService import ReCaptcha, SolveMedia
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, secondsToMidnight
@@ -101,11 +98,11 @@ class XFSHoster(SimpleHoster):
data = self.getPostParameters()
- self.req.http.c.setopt(FOLLOWLOCATION, 0)
+ self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0)
self.html = self.load(pyfile.url, post=data, decode=True)
- self.req.http.c.setopt(FOLLOWLOCATION, 1)
+ self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1)
m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I)
if m and not "op=" in m.group(1):
@@ -134,7 +131,7 @@ class XFSHoster(SimpleHoster):
action, inputs = self.parseHtmlForm()
- upload_id = "%012d" % int(random() * 10 ** 12)
+ upload_id = "%012d" % int(random.random() * 10 ** 12)
action += upload_id + "&js_on=1&utype=prem&upload_type=url"
inputs['tos'] = '1'