summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster
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/hoster
parentFix https://github.com/pyload/pyload/issues/1373 (diff)
downloadpyload-1ef93e913238275f7657d496ba3d2e7eeb5a30a2.tar.xz
Use 'import' instead 'from'
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r--module/plugins/hoster/AlldebridCom.py4
-rw-r--r--module/plugins/hoster/BasePlugin.py13
-rw-r--r--module/plugins/hoster/DepositfilesCom.py5
-rw-r--r--module/plugins/hoster/FastixRu.py4
-rw-r--r--module/plugins/hoster/FastshareCz.py7
-rw-r--r--module/plugins/hoster/FileSharkPl.py5
-rw-r--r--module/plugins/hoster/FilefactoryCom.py3
-rw-r--r--module/plugins/hoster/FilerNet.py3
-rw-r--r--module/plugins/hoster/FlyFilesNet.py5
-rw-r--r--module/plugins/hoster/FshareVn.py5
-rw-r--r--module/plugins/hoster/Ftp.py13
-rw-r--r--module/plugins/hoster/GigapetaCom.py11
-rw-r--r--module/plugins/hoster/HellshareCz.py2
-rw-r--r--module/plugins/hoster/Keep2ShareCc.py5
-rw-r--r--module/plugins/hoster/LetitbitNet.py5
-rw-r--r--module/plugins/hoster/LinksnappyCom.py5
-rw-r--r--module/plugins/hoster/MegaCoNz.py16
-rw-r--r--module/plugins/hoster/MegaDebridEu.py3
-rw-r--r--module/plugins/hoster/MegaRapidCz.py5
-rw-r--r--module/plugins/hoster/MegaRapidoNet.py4
-rw-r--r--module/plugins/hoster/MultishareCz.py5
-rw-r--r--module/plugins/hoster/NarodRu.py5
-rw-r--r--module/plugins/hoster/NetloadIn.py5
-rw-r--r--module/plugins/hoster/OverLoadMe.py4
-rw-r--r--module/plugins/hoster/PremiumTo.py4
-rw-r--r--module/plugins/hoster/QuickshareCz.py7
-rw-r--r--module/plugins/hoster/RapidgatorNet.py7
-rw-r--r--module/plugins/hoster/RapiduNet.py5
-rw-r--r--module/plugins/hoster/RealdebridCom.py4
-rw-r--r--module/plugins/hoster/RehostTo.py2
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py7
-rw-r--r--module/plugins/hoster/ShareplaceCom.py5
-rw-r--r--module/plugins/hoster/SpeedyshareCom.py3
-rw-r--r--module/plugins/hoster/TurbobitNet.py16
-rw-r--r--module/plugins/hoster/UnibytesCom.py14
-rw-r--r--module/plugins/hoster/UpleaCom.py5
-rw-r--r--module/plugins/hoster/UploadheroCom.py7
-rw-r--r--module/plugins/hoster/UploadingCom.py5
-rw-r--r--module/plugins/hoster/WrzucTo.py5
-rw-r--r--module/plugins/hoster/XHamsterCom.py5
-rw-r--r--module/plugins/hoster/XVideosCom.py5
-rw-r--r--module/plugins/hoster/Xdcc.py2
-rw-r--r--module/plugins/hoster/YourfilesTo.py6
-rw-r--r--module/plugins/hoster/YoutubeCom.py6
-rw-r--r--module/plugins/hoster/ZeveraCom.py3
45 files changed, 109 insertions, 156 deletions
diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py
index 51fdad757..2ed09f58c 100644
--- a/module/plugins/hoster/AlldebridCom.py
+++ b/module/plugins/hoster/AlldebridCom.py
@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from random import randrange
-from urllib import unquote
+import urllib
from module.common.json_layer import json_loads
from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py
index 962c8887b..2228516aa 100644
--- a/module/plugins/hoster/BasePlugin.py
+++ b/module/plugins/hoster/BasePlugin.py
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
import re
-
-from urllib import unquote
-from urlparse import urljoin, urlparse
+import urllib
+import urlparse
from module.network.HTTPRequest import BadHeader
from module.plugins.internal.SimpleHoster import create_getInfo, getFileURL
@@ -25,8 +24,8 @@ class BasePlugin(Hoster):
@classmethod
def getInfo(cls, url="", html=""): #@TODO: Move to hoster class in 0.4.10
- url = unquote(url)
- url_p = urlparse(url)
+ url = urllib.unquote(url)
+ url_p = urlparse.urlparse(url)
return {'name' : (url_p.path.split('/')[-1]
or url_p.query.split('=', 1)[::-1][0].split('&', 1)[0]
or url_p.netloc.split('.', 1)[0]),
@@ -51,7 +50,7 @@ class BasePlugin(Hoster):
for _i in xrange(5):
try:
- link = getFileURL(self, unquote(pyfile.url))
+ link = getFileURL(self, urllib.unquote(pyfile.url))
if link:
self.download(link, ref=False, disposition=True)
@@ -67,7 +66,7 @@ class BasePlugin(Hoster):
account = self.core.accountManager.getAccountPlugin('Http')
servers = [x['login'] for x in account.getAllAccounts()]
- server = urlparse(pyfile.url).netloc
+ server = urlparse.urlparse(pyfile.url).netloc
if server in servers:
self.logDebug("Logging on to %s" % server)
diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py
index cc24e351e..8559bbc36 100644
--- a/module/plugins/hoster/DepositfilesCom.py
+++ b/module/plugins/hoster/DepositfilesCom.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urllib import unquote
+import urllib
from module.plugins.internal.CaptchaService import ReCaptcha
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -67,7 +66,7 @@ class DepositfilesCom(SimpleHoster):
m = re.search(self.LINK_FREE_PATTERN, self.html)
if m:
- self.link = unquote(m.group(1))
+ self.link = urllib.unquote(m.group(1))
def handlePremium(self, pyfile):
diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py
index 0dc12568d..cc50f4229 100644
--- a/module/plugins/hoster/FastixRu.py
+++ b/module/plugins/hoster/FastixRu.py
@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from random import randrange
-from urllib import unquote
+import urllib
from module.common.json_layer import json_loads
from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py
index cede2e906..330a6e3b9 100644
--- a/module/plugins/hoster/FastshareCz.py
+++ b/module/plugins/hoster/FastshareCz.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urlparse import urljoin
+import urlparse
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -55,8 +54,8 @@ class FastshareCz(SimpleHoster):
self.error(_("FREE_URL_PATTERN not found"))
baseurl = "http://www.fastshare.cz"
- captcha = self.decryptCaptcha(urljoin(baseurl, captcha_src))
- self.download(urljoin(baseurl, action), post={'code': captcha, 'btn.x': 77, 'btn.y': 18})
+ captcha = self.decryptCaptcha(urlparse.urljoin(baseurl, captcha_src))
+ self.download(urlparse.urljoin(baseurl, action), post={'code': captcha, 'btn.x': 77, 'btn.y': 18})
def checkFile(self, rules={}):
diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py
index 9f6070806..de030be9c 100644
--- a/module/plugins/hoster/FileSharkPl.py
+++ b/module/plugins/hoster/FileSharkPl.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urlparse import urljoin
+import urlparse
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -78,7 +77,7 @@ class FileSharkPl(SimpleHoster):
if m is None:
self.error(_("Download url not found"))
- link = urljoin("http://fileshark.pl", m.group(1))
+ link = urlparse.urljoin("http://fileshark.pl", m.group(1))
self.html = self.load(link)
diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py
index 606fb25f0..0a9d5e2cc 100644
--- a/module/plugins/hoster/FilefactoryCom.py
+++ b/module/plugins/hoster/FilefactoryCom.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urlparse import urljoin
+import urlparse
from module.network.RequestFactory import getURL
from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py
index 22ca3725a..156392c79 100644
--- a/module/plugins/hoster/FilerNet.py
+++ b/module/plugins/hoster/FilerNet.py
@@ -6,8 +6,7 @@
import pycurl
import re
-
-from urlparse import urljoin
+import urlparse
from module.plugins.internal.CaptchaService import ReCaptcha
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
diff --git a/module/plugins/hoster/FlyFilesNet.py b/module/plugins/hoster/FlyFilesNet.py
index 4420d5d60..689eb3c66 100644
--- a/module/plugins/hoster/FlyFilesNet.py
+++ b/module/plugins/hoster/FlyFilesNet.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urllib import unquote
+import urllib
from module.network.RequestFactory import getURL
from module.plugins.internal.SimpleHoster import SimpleHoster
@@ -26,7 +25,7 @@ class FlyFilesNet(SimpleHoster):
def process(self, pyfile):
name = re.search(self.NAME_PATTERN, pyfile.url).group(1)
- pyfile.name = unquote_plus(name)
+ pyfile.name = urllib.unquote_plus(name)
session = re.search(self.SESSION_PATTERN, pyfile.url).group(1)
diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py
index 77d122e8e..50128db10 100644
--- a/module/plugins/hoster/FshareVn.py
+++ b/module/plugins/hoster/FshareVn.py
@@ -2,8 +2,7 @@
import re
import time
-
-from urlparse import urljoin
+import urlparse
from module.network.RequestFactory import getURL
from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
@@ -59,7 +58,7 @@ class FshareVn(SimpleHoster):
self.checkErrors()
action, inputs = self.parseHtmlForm('frm_download')
- url = urljoin(pyfile.url, action)
+ url = urlparse.urljoin(pyfile.url, action)
if not inputs:
self.error(_("No FORM"))
diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py
index 5be380078..5258a1c27 100644
--- a/module/plugins/hoster/Ftp.py
+++ b/module/plugins/hoster/Ftp.py
@@ -2,9 +2,8 @@
import pycurl
import re
-
-from urllib import quote, unquote
-from urlparse import urlparse
+import urllib
+import urlparse
from module.plugins.Hoster import Hoster
@@ -29,12 +28,12 @@ class Ftp(Hoster):
def process(self, pyfile):
- parsed_url = urlparse(pyfile.url)
+ parsed_url = urlparse.urlparse(pyfile.url)
netloc = parsed_url.netloc
pyfile.name = parsed_url.path.rpartition('/')[2]
try:
- pyfile.name = unquote(str(pyfile.name)).decode('utf8')
+ pyfile.name = urllib.unquote(str(pyfile.name)).decode('utf8')
except Exception:
pass
@@ -67,11 +66,11 @@ class Ftp(Hoster):
#Naive ftp directory listing
if re.search(r'^25\d.*?"', self.req.http.header, re.M):
pyfile.url = pyfile.url.rstrip('/')
- pkgname = "/".join(pyfile.package().name, urlparse(pyfile.url).path.rpartition('/')[2])
+ pkgname = "/".join(pyfile.package().name, urlparse.urlparse(pyfile.url).path.rpartition('/')[2])
pyfile.url += '/'
self.req.http.c.setopt(48, 1) # CURLOPT_DIRLISTONLY
res = self.load(pyfile.url, decode=False)
- links = [pyfile.url + quote(x) for x in res.splitlines()]
+ links = [pyfile.url + urllib.quote(x) for x in res.splitlines()]
self.logDebug("LINKS", links)
self.core.api.addPackage(pkgname, links)
else:
diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py
index 2fe44ca85..e4d0601fc 100644
--- a/module/plugins/hoster/GigapetaCom.py
+++ b/module/plugins/hoster/GigapetaCom.py
@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
+import pycurl
+import random
import re
-from pycurl import FOLLOWLOCATION
-from random import randint
-
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -29,10 +28,10 @@ class GigapetaCom(SimpleHoster):
def handleFree(self, pyfile):
- captcha_key = str(randint(1, 100000000))
+ captcha_key = str(random.randint(1, 100000000))
captcha_url = "http://gigapeta.com/img/captcha.gif?x=%s" % captcha_key
- self.req.http.c.setopt(FOLLOWLOCATION, 0)
+ self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0)
for _i in xrange(5):
self.checkErrors()
@@ -52,7 +51,7 @@ class GigapetaCom(SimpleHoster):
else:
self.fail(_("No valid captcha code entered"))
- self.req.http.c.setopt(FOLLOWLOCATION, 1)
+ self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1)
def checkErrors(self):
diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py
index 2e156c464..ac0043b37 100644
--- a/module/plugins/hoster/HellshareCz.py
+++ b/module/plugins/hoster/HellshareCz.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-from urlparse import urljoin
+import urlparse
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py
index 65e9ddc2d..fdae65096 100644
--- a/module/plugins/hoster/Keep2ShareCc.py
+++ b/module/plugins/hoster/Keep2ShareCc.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urlparse import urljoin
+import urlparse
from module.plugins.internal.CaptchaService import ReCaptcha
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -100,7 +99,7 @@ class Keep2ShareCc(SimpleHoster):
m = re.search(self.CAPTCHA_PATTERN, self.html)
self.logDebug("CAPTCHA_PATTERN found %s" % m)
if m:
- captcha_url = urljoin("http://keep2s.cc/", m.group(1))
+ captcha_url = urlparse.urljoin("http://keep2s.cc/", m.group(1))
post_data['CaptchaForm[code]'] = self.decryptCaptcha(captcha_url)
else:
recaptcha = ReCaptcha(self)
diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py
index 79dbd8133..40d792e11 100644
--- a/module/plugins/hoster/LetitbitNet.py
+++ b/module/plugins/hoster/LetitbitNet.py
@@ -7,8 +7,7 @@
# http://letitbit.net/download/07874.0b5709a7d3beee2408bb1f2eefce/random.bin.html
import re
-
-from urlparse import urljoin
+import urlparse
from module.common.json_layer import json_loads, json_dumps
from module.network.RequestFactory import getURL
@@ -66,7 +65,7 @@ class LetitbitNet(SimpleHoster):
self.logDebug(action, inputs)
inputs['desc'] = ""
- self.html = self.load(urljoin("http://letitbit.net/", action), post=inputs)
+ self.html = self.load(urlparse.urljoin("http://letitbit.net/", action), post=inputs)
m = re.search(self.SECONDS_PATTERN, self.html)
seconds = int(m.group(1)) if m else 60
diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py
index 87207ab40..9c3af4ae3 100644
--- a/module/plugins/hoster/LinksnappyCom.py
+++ b/module/plugins/hoster/LinksnappyCom.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urlparse import urlsplit
+import urlparse
from module.common.json_layer import json_loads, json_dumps
from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
@@ -52,7 +51,7 @@ class LinksnappyCom(MultiHoster):
@staticmethod
def _get_host(url):
- host = urlsplit(url).netloc
+ host = urlparse.urlsplit(url).netloc
return re.search(r'[\w-]+\.\w+$', host).group(0)
diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py
index 37ac12b44..aa7755af4 100644
--- a/module/plugins/hoster/MegaCoNz.py
+++ b/module/plugins/hoster/MegaCoNz.py
@@ -1,15 +1,15 @@
# -*- coding: utf-8 -*-
+import array
import os
+# import pycurl
import random
import re
-from array import array
from base64 import standard_b64decode
from Crypto.Cipher import AES
from Crypto.Util import Counter
-# from pycurl import SSL_CIPHER_LIST
from module.common.json_layer import json_loads, json_dumps
from module.plugins.Hoster import Hoster
@@ -69,10 +69,10 @@ class MegaCoNz(Hoster):
def getCipherKey(self, key):
""" Construct the cipher key from the given data """
- a = array("I", self.b64_decode(key))
+ a = array.array("I", self.b64_decode(key))
- k = array("I", (a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7]))
- iv = a[4:6] + array("I", (0, 0))
+ k = array.array("I", (a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7]))
+ iv = a[4:6] + array.array("I", (0, 0))
meta_mac = a[6:8]
return k, iv, meta_mac
@@ -82,7 +82,7 @@ class MegaCoNz(Hoster):
""" Dispatch a call to the api, see https://mega.co.nz/#developers """
# generate a session id, no idea where to obtain elsewhere
- uid = random.randint(10 << 9, 10 ** 10)
+ uid = random.random.randint(10 << 9, 10 ** 10)
res = self.load(self.API_URL, get={'id': uid}, post=json_dumps([kwargs]))
self.logDebug("Api Response: " + res)
@@ -145,7 +145,7 @@ class MegaCoNz(Hoster):
# block = chunk[i:i+16]
# if len(block) % 16:
# block += '=' * (16 - (len(block) % 16))
- # block = array("I", block)
+ # block = array.array("I", block)
# chunk_mac = [chunk_mac[0] ^ a_[0], chunk_mac[1] ^ block[1], chunk_mac[2] ^ block[2], chunk_mac[3] ^ block[3]]
# chunk_mac = aes_cbc_encrypt_a32(chunk_mac, k)
@@ -207,7 +207,7 @@ class MegaCoNz(Hoster):
pyfile.name = attr['n'] + self.FILE_SUFFIX
pyfile.size = mega['s']
- # self.req.http.c.setopt(SSL_CIPHER_LIST, "RC4-MD5:DEFAULT")
+ # self.req.http.c.setopt(pycurl.SSL_CIPHER_LIST, "RC4-MD5:DEFAULT")
self.download(mega['g'])
diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py
index 3a8d8b080..9c8cc2a90 100644
--- a/module/plugins/hoster/MegaDebridEu.py
+++ b/module/plugins/hoster/MegaDebridEu.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urllib import unquote_plus
+import urllib
from module.common.json_layer import json_loads
from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py
index 577a3d511..59fb8251e 100644
--- a/module/plugins/hoster/MegaRapidCz.py
+++ b/module/plugins/hoster/MegaRapidCz.py
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
+import pycurl
import re
-from pycurl import HTTPHEADER
-
from module.network.HTTPRequest import BadHeader
from module.network.RequestFactory import getRequest
from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
@@ -11,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo
def getInfo(urls):
h = getRequest()
- h.c.setopt(HTTPHEADER,
+ h.c.setopt(pycurl.HTTPHEADER,
["Accept: text/html",
"User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0"])
diff --git a/module/plugins/hoster/MegaRapidoNet.py b/module/plugins/hoster/MegaRapidoNet.py
index b5bd7f3f2..a3b4c72ba 100644
--- a/module/plugins/hoster/MegaRapidoNet.py
+++ b/module/plugins/hoster/MegaRapidoNet.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-from random import randint
+import random
from module.plugins.internal.MultiHoster import MultiHoster
@@ -9,7 +9,7 @@ def random_with_N_digits(n):
rand = "0."
not_zero = 0
for i in range(1, n + 1):
- r = randint(0, 9)
+ r = random.randint(0, 9)
if(r > 0):
not_zero += 1
rand += str(r)
diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py
index 5dc53ecbc..bbb77f525 100644
--- a/module/plugins/hoster/MultishareCz.py
+++ b/module/plugins/hoster/MultishareCz.py
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
+import random
import re
-from random import random
-
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -45,7 +44,7 @@ class MultishareCz(SimpleHoster):
if not self.checkTrafficLeft():
self.fail(_("Not enough credit left to download file"))
- self.download("http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random()),
+ self.download("http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random.random() * 10000 * random.random()),
get={'u_ID' : self.acc_info['u_ID'],
'u_hash': self.acc_info['u_hash'],
'link' : pyfile.url},
diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py
index 65ad90d17..b7380add0 100644
--- a/module/plugins/hoster/NarodRu.py
+++ b/module/plugins/hoster/NarodRu.py
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
+import random
import re
-from random import random
-
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -34,7 +33,7 @@ class NarodRu(SimpleHoster):
def handleFree(self, pyfile):
for _i in xrange(5):
- self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random() * 777))
+ self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random.random() * 777))
m = re.search(self.CAPTCHA_PATTERN, self.html)
if m is None:
diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py
index 57af3f18e..cab7bd88f 100644
--- a/module/plugins/hoster/NetloadIn.py
+++ b/module/plugins/hoster/NetloadIn.py
@@ -2,8 +2,7 @@
import re
import time
-
-from urlparse import urljoin
+import urlparse
from module.network.RequestFactory import getURL
from module.plugins.Hoster import Hoster
@@ -230,7 +229,7 @@ class NetloadIn(Hoster):
page = None
else:
- url_captcha_html = urljoin("http://netload.in/", url_captcha_html)
+ url_captcha_html = urlparse.urljoin("http://netload.in/", url_captcha_html)
break
self.html = self.load(url_captcha_html)
diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py
index 934de5746..d06baa0f5 100644
--- a/module/plugins/hoster/OverLoadMe.py
+++ b/module/plugins/hoster/OverLoadMe.py
@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from random import randrange
-from urllib import unquote
+import urllib
from module.common.json_layer import json_loads
from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py
index f48f68e1b..ab5016673 100644
--- a/module/plugins/hoster/PremiumTo.py
+++ b/module/plugins/hoster/PremiumTo.py
@@ -2,7 +2,7 @@
from __future__ import with_statement
-from os import remove
+import os
from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
from module.utils import fs_encode
@@ -45,7 +45,7 @@ class PremiumTo(MultiHoster):
file = fs_encode(self.lastDownload)
with open(file, "rb") as f:
err = f.read(256).strip()
- remove(file)
+ os.remove(file)
if err:
self.fail(err)
diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py
index 893c3b6c7..1e0750b88 100644
--- a/module/plugins/hoster/QuickshareCz.py
+++ b/module/plugins/hoster/QuickshareCz.py
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
+import pycurl
import re
-from pycurl import FOLLOWLOCATION
-
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -60,10 +59,10 @@ class QuickshareCz(SimpleHoster):
data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID3", "ID4"))
self.logDebug("FREE URL1:" + download_url, data)
- self.req.http.c.setopt(FOLLOWLOCATION, 0)
+ self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0)
self.load(download_url, post=data)
self.header = self.req.http.header
- self.req.http.c.setopt(FOLLOWLOCATION, 1)
+ self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1)
m = re.search(r'Location\s*:\s*(.+)', self.header, re.I)
if m is None:
diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py
index 2626ec925..ae74e8a63 100644
--- a/module/plugins/hoster/RapidgatorNet.py
+++ b/module/plugins/hoster/RapidgatorNet.py
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
+import pycurl
import re
-from pycurl import HTTPHEADER
-
from module.common.json_layer import json_loads
from module.network.HTTPRequest import BadHeader
from module.plugins.internal.CaptchaService import AdsCaptcha, ReCaptcha, SolveMedia
@@ -102,7 +101,7 @@ class RapidgatorNet(SimpleHoster):
self.logDebug(jsvars)
self.req.http.lastURL = pyfile.url
- self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
+ self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
url = "http://rapidgator.net%s?fid=%s" % (
jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars['fid'])
@@ -115,7 +114,7 @@ class RapidgatorNet(SimpleHoster):
jsvars.update(self.getJsonResponse(url))
self.req.http.lastURL = pyfile.url
- self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"])
+ self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With:"])
url = "http://rapidgator.net%s" % jsvars.get('captchaUrl', '/download/captcha')
self.html = self.load(url)
diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py
index 8a85bc844..fcccbbebc 100644
--- a/module/plugins/hoster/RapiduNet.py
+++ b/module/plugins/hoster/RapiduNet.py
@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
+import pycurl
import re
import time
-from pycurl import HTTPHEADER
-
from module.common.json_layer import json_loads
from module.plugins.internal.CaptchaService import ReCaptcha
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -40,7 +39,7 @@ class RapiduNet(SimpleHoster):
def handleFree(self, pyfile):
self.req.http.lastURL = pyfile.url
- self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
+ self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
jsvars = self.getJsonResponse("https://rapidu.net/ajax.php",
get={'a': "getLoadTimeToDownload"},
diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py
index f35eb5e03..4500fcefc 100644
--- a/module/plugins/hoster/RealdebridCom.py
+++ b/module/plugins/hoster/RealdebridCom.py
@@ -2,9 +2,7 @@
import re
import time
-
-from random import randrange
-from urllib import unquote
+import urllib
from module.common.json_layer import json_loads
from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py
index 1c53fbc92..9c07364ec 100644
--- a/module/plugins/hoster/RehostTo.py
+++ b/module/plugins/hoster/RehostTo.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-from urllib import unquote
+import urllib
from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index fea5781fe..505222fce 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -2,9 +2,8 @@
import re
import time
-
-from urllib import unquote
-from urlparse import urlparse
+import urllib
+import urlparse
from module.network.RequestFactory import getURL
from module.plugins.internal.CaptchaService import ReCaptcha
@@ -38,7 +37,7 @@ class ShareonlineBiz(SimpleHoster):
@classmethod
def getInfo(cls, url="", html=""):
- info = {'name': urlparse(unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3 if url else 1, 'url': url}
+ info = {'name': urlparse.urlparse(urllib.unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3 if url else 1, 'url': url}
if url:
info['pattern'] = re.match(cls.__pattern__, url).groupdict()
diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py
index c540dd2df..babd0d1d4 100644
--- a/module/plugins/hoster/ShareplaceCom.py
+++ b/module/plugins/hoster/ShareplaceCom.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urllib import unquote
+import urllib
from module.plugins.Hoster import Hoster
@@ -61,7 +60,7 @@ class ShareplaceCom(Hoster):
url = re.search(r"var beer = '(.*?)';", self.html)
if url:
url = url.group(1)
- url = unquote(
+ url = urllib.unquote(
url.replace("http://http:/", "").replace("vvvvvvvvv", "").replace("lllllllll", "").replace(
"teletubbies", ""))
self.logDebug("URL: %s" % url)
diff --git a/module/plugins/hoster/SpeedyshareCom.py b/module/plugins/hoster/SpeedyshareCom.py
index 1649abbe6..91788b2c8 100644
--- a/module/plugins/hoster/SpeedyshareCom.py
+++ b/module/plugins/hoster/SpeedyshareCom.py
@@ -4,8 +4,7 @@
# http://speedy.sh/ep2qY/Zapp-Brannigan.jpg
import re
-
-from urlparse import urljoin
+import urlparse
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py
index f4eaa90cc..7995bd0c0 100644
--- a/module/plugins/hoster/TurbobitNet.py
+++ b/module/plugins/hoster/TurbobitNet.py
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
+import binascii
+import pycurl
import random
import re
import time
+import urllib
from Crypto.Cipher import ARC4
-from binascii import hexlify, unhexlify
-from pycurl import HTTPHEADER
-from urllib import quote
from module.network.RequestFactory import getURL
from module.plugins.internal.CaptchaService import ReCaptcha
@@ -50,11 +50,11 @@ class TurbobitNet(SimpleHoster):
self.solveCaptcha()
- self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
+ self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
self.html = self.load(self.getDownloadUrl(rtUpdate))
- self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"])
+ self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With:"])
m = re.search(self.LINK_FREE_PATTERN, self.html)
if m:
@@ -134,7 +134,7 @@ class TurbobitNet(SimpleHoster):
for b in [1, 3]:
self.jscode = "var id = \'%s\';var b = %d;var inn = \'%s\';%sout" % (
- self.info['pattern']['ID'], b, quote(fun), rtUpdate)
+ self.info['pattern']['ID'], b, urllib.quote(fun), rtUpdate)
try:
out = self.js.eval(self.jscode)
@@ -155,8 +155,8 @@ class TurbobitNet(SimpleHoster):
def decrypt(self, data):
- cipher = ARC4.new(hexlify('E\x15\xa1\x9e\xa3M\xa0\xc6\xa0\x84\xb6H\x83\xa8o\xa0'))
- return unhexlify(cipher.encrypt(unhexlify(data)))
+ cipher = ARC4.new(binascii.hexlify('E\x15\xa1\x9e\xa3M\xa0\xc6\xa0\x84\xb6H\x83\xa8o\xa0'))
+ return binascii.unhexlify(cipher.encrypt(binascii.unhexlify(data)))
def getLocalTimeString(self):
diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py
index 14447b0b0..d090c8e7d 100644
--- a/module/plugins/hoster/UnibytesCom.py
+++ b/module/plugins/hoster/UnibytesCom.py
@@ -1,10 +1,8 @@
# -*- coding: utf-8 -*-
+import pycurl
import re
-
-from urlparse import urljoin
-
-from pycurl import FOLLOWLOCATION
+import urlparse
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -34,11 +32,11 @@ class UnibytesCom(SimpleHoster):
domain = "http://www.%s/" % self.HOSTER_DOMAIN
action, post_data = self.parseHtmlForm('id="startForm"')
- self.req.http.c.setopt(FOLLOWLOCATION, 0)
+ self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0)
for _i in xrange(8):
self.logDebug(action, post_data)
- self.html = self.load(urljoin(domain, action), post=post_data)
+ self.html = self.load(urlparse.urljoin(domain, action), post=post_data)
m = re.search(r'location:\s*(\S+)', self.req.http.header, re.I)
if m:
@@ -66,12 +64,12 @@ class UnibytesCom(SimpleHoster):
self.wait(m.group(1) if m else 60, False)
elif last_step in ("captcha", "last"):
- post_data['captcha'] = self.decryptCaptcha(urljoin(domain, "/captcha.jpg"))
+ post_data['captcha'] = self.decryptCaptcha(urlparse.urljoin(domain, "/captcha.jpg"))
else:
self.fail(_("No valid captcha code entered"))
- self.req.http.c.setopt(FOLLOWLOCATION, 1)
+ self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1)
getInfo = create_getInfo(UnibytesCom)
diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py
index 4538b1c16..9d460ef98 100644
--- a/module/plugins/hoster/UpleaCom.py
+++ b/module/plugins/hoster/UpleaCom.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urlparse import urljoin
+import urlparse
from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo
@@ -48,7 +47,7 @@ class UpleaCom(XFSHoster):
if m is None:
self.error(_("STEP_PATTERN not found"))
- self.html = self.load(urljoin("http://uplea.com/", m.group(1)))
+ self.html = self.load(urlparse.urljoin("http://uplea.com/", m.group(1)))
m = re.search(self.WAIT_PATTERN, self.html)
if m:
diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py
index 6c8747b58..5c74f10eb 100644
--- a/module/plugins/hoster/UploadheroCom.py
+++ b/module/plugins/hoster/UploadheroCom.py
@@ -4,8 +4,7 @@
# http://uploadhero.co/dl/wQBRAVSM
import re
-
-from urlparse import urljoin
+import urlparse
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -44,7 +43,7 @@ class UploadheroCom(SimpleHoster):
if m is None:
self.error(_("Captcha not found"))
- captcha = self.decryptCaptcha(urljoin("http://uploadhero.co", m.group(1)))
+ captcha = self.decryptCaptcha(urlparse.urljoin("http://uploadhero.co", m.group(1)))
self.html = self.load(pyfile.url,
get={"code": captcha})
@@ -58,7 +57,7 @@ class UploadheroCom(SimpleHoster):
def checkErrors(self):
m = re.search(self.IP_BLOCKED_PATTERN, self.html)
if m:
- self.html = self.load(urljoin("http://uploadhero.co", m.group(1)))
+ self.html = self.load(urlparse.urljoin("http://uploadhero.co", m.group(1)))
m = re.search(self.IP_WAIT_PATTERN, self.html)
wait_time = (int(m.group(1)) * 60 + int(m.group(2))) if m else 5 * 60
diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py
index d0e0b1fd7..c2e0d2873 100644
--- a/module/plugins/hoster/UploadingCom.py
+++ b/module/plugins/hoster/UploadingCom.py
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
+import pycurl
import re
-from pycurl import HTTPHEADER
-
from module.common.json_layer import json_loads
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp
@@ -66,7 +65,7 @@ class UploadingCom(SimpleHoster):
self.retry(6, (6 * 60 if m.group(2) else 15) * 60, pyfile.error)
ajax_url = "http://uploading.com/files/get/?ajax"
- self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
+ self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
self.req.http.lastURL = pyfile.url
res = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.info['pattern']['ID']}))
diff --git a/module/plugins/hoster/WrzucTo.py b/module/plugins/hoster/WrzucTo.py
index 50a45babe..f11d03ea8 100644
--- a/module/plugins/hoster/WrzucTo.py
+++ b/module/plugins/hoster/WrzucTo.py
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
+import pycurl
import re
-from pycurl import HTTPHEADER
-
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
@@ -35,7 +34,7 @@ class WrzucTo(SimpleHoster):
if len(data) != 2:
self.error(_("No file ID"))
- self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
+ self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"])
self.req.http.lastURL = pyfile.url
self.load("http://www.wrzuc.to/ajax/server/prepair", post={"md5": data['md5']})
diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py
index 9004dbac0..a1711cb0e 100644
--- a/module/plugins/hoster/XHamsterCom.py
+++ b/module/plugins/hoster/XHamsterCom.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urllib import unquote
+import urllib
from module.common.json_layer import json_loads
from module.plugins.Hoster import Hoster
@@ -83,7 +82,7 @@ class XHamsterCom(Hoster):
self.logDebug("long_url = " + long_url)
else:
if flashvars['file']:
- file_url = unquote(flashvars['file'])
+ file_url = urllib.unquote(flashvars['file'])
else:
self.error(_("file_url not found"))
diff --git a/module/plugins/hoster/XVideosCom.py b/module/plugins/hoster/XVideosCom.py
index 9bb2da424..a8f291824 100644
--- a/module/plugins/hoster/XVideosCom.py
+++ b/module/plugins/hoster/XVideosCom.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urllib import unquote
+import urllib
from module.plugins.Hoster import Hoster
@@ -25,4 +24,4 @@ class XVideosCom(Hoster):
re.search(r"<h2>([^<]+)<span", site).group(1),
re.match(self.__pattern__, pyfile.url).group(1),
)
- self.download(unquote(re.search(r"flv_url=([^&]+)&", site).group(1)))
+ self.download(urllib.unquote(re.search(r"flv_url=([^&]+)&", site).group(1)))
diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py
index b77e7c1da..d167e4cab 100644
--- a/module/plugins/hoster/Xdcc.py
+++ b/module/plugins/hoster/Xdcc.py
@@ -6,8 +6,6 @@ import struct
import sys
import time
-from os import makedirs
-from os.path import exists, join
from select import select
from module.plugins.Hoster import Hoster
diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py
index fd65a6a41..d0316d3ac 100644
--- a/module/plugins/hoster/YourfilesTo.py
+++ b/module/plugins/hoster/YourfilesTo.py
@@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
-import re
-
-from urllib import unquote
+import reimport urllib
from module.plugins.Hoster import Hoster
@@ -62,7 +60,7 @@ class YourfilesTo(Hoster):
url = re.search(r"var bla = '(.*?)';", self.html)
if url:
url = url.group(1)
- url = unquote(url.replace("http://http:/http://", "http://").replace("dumdidum", ""))
+ url = urllib.unquote(url.replace("http://http:/http://", "http://").replace("dumdidum", ""))
return url
else:
self.error(_("Absolute filepath not found"))
diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py
index 06f135c60..e2ab146a9 100644
--- a/module/plugins/hoster/YoutubeCom.py
+++ b/module/plugins/hoster/YoutubeCom.py
@@ -2,9 +2,7 @@
import os
import re
-import subprocess
-
-from urllib import unquote
+import subprocessimport urllib
from module.plugins.Hoster import Hoster
from module.plugins.internal.SimpleHoster import replace_patterns
@@ -117,7 +115,7 @@ class YoutubeCom(Hoster):
streams = re.search(r'"url_encoded_fmt_stream_map":"(.+?)",', html).group(1)
streams = [x.split('\u0026') for x in streams.split(',')]
streams = [dict((y.split('=', 1)) for y in x) for x in streams]
- streams = [(int(x['itag']), unquote(x['url'])) for x in streams]
+ streams = [(int(x['itag']), urllib.unquote(x['url'])) for x in streams]
# self.logDebug("Found links: %s" % streams)
diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py
index e0362ce36..617e00e58 100644
--- a/module/plugins/hoster/ZeveraCom.py
+++ b/module/plugins/hoster/ZeveraCom.py
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import re
-
-from urlparse import urljoin
+import urlparse
from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo