diff options
Diffstat (limited to 'pyload/plugin/hoster')
41 files changed, 94 insertions, 137 deletions
diff --git a/pyload/plugin/hoster/AlldebridCom.py b/pyload/plugin/hoster/AlldebridCom.py index 9e1e3bc05..7474e62e8 100644 --- a/pyload/plugin/hoster/AlldebridCom.py +++ b/pyload/plugin/hoster/AlldebridCom.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- import re - -from random import randrange -from urllib import unquote +import urllib from pyload.utils import json_loads from pyload.plugin.internal.MultiHoster import MultiHoster diff --git a/pyload/plugin/hoster/DepositfilesCom.py b/pyload/plugin/hoster/DepositfilesCom.py index 1616577cd..e16222856 100644 --- a/pyload/plugin/hoster/DepositfilesCom.py +++ b/pyload/plugin/hoster/DepositfilesCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote +import urllib from pyload.plugin.captcha.ReCaptcha import ReCaptcha from pyload.plugin.internal.SimpleHoster import SimpleHoster @@ -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/pyload/plugin/hoster/FastixRu.py b/pyload/plugin/hoster/FastixRu.py index 12d0c51bb..dc3b7d6ea 100644 --- a/pyload/plugin/hoster/FastixRu.py +++ b/pyload/plugin/hoster/FastixRu.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- import re - -from random import randrange -from urllib import unquote +import urllib from pyload.utils import json_loads from pyload.plugin.internal.MultiHoster import MultiHoster diff --git a/pyload/plugin/hoster/FastshareCz.py b/pyload/plugin/hoster/FastshareCz.py index a98a7de31..7e688a941 100644 --- a/pyload/plugin/hoster/FastshareCz.py +++ b/pyload/plugin/hoster/FastshareCz.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from pyload.plugin.internal.SimpleHoster import SimpleHoster @@ -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/pyload/plugin/hoster/FileSharkPl.py b/pyload/plugin/hoster/FileSharkPl.py index 2a06fe6a4..5d37a55c6 100644 --- a/pyload/plugin/hoster/FileSharkPl.py +++ b/pyload/plugin/hoster/FileSharkPl.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from pyload.plugin.internal.SimpleHoster import SimpleHoster @@ -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/pyload/plugin/hoster/FilefactoryCom.py b/pyload/plugin/hoster/FilefactoryCom.py index 85d014e1e..782b6ba48 100644 --- a/pyload/plugin/hoster/FilefactoryCom.py +++ b/pyload/plugin/hoster/FilefactoryCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from pyload.network.RequestFactory import getURL from pyload.plugin.internal.SimpleHoster import SimpleHoster, parseFileInfo diff --git a/pyload/plugin/hoster/FilerNet.py b/pyload/plugin/hoster/FilerNet.py index fbefba8db..be8445fad 100644 --- a/pyload/plugin/hoster/FilerNet.py +++ b/pyload/plugin/hoster/FilerNet.py @@ -6,8 +6,7 @@ import pycurl import re - -from urlparse import urljoin +import urlparse from pyload.plugin.captcha.ReCaptcha import ReCaptcha from pyload.plugin.internal.SimpleHoster import SimpleHoster diff --git a/pyload/plugin/hoster/FlyFilesNet.py b/pyload/plugin/hoster/FlyFilesNet.py index 77c7ed82b..4f1d71d21 100644 --- a/pyload/plugin/hoster/FlyFilesNet.py +++ b/pyload/plugin/hoster/FlyFilesNet.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote +import urllib from pyload.network.RequestFactory import getURL from pyload.plugin.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/pyload/plugin/hoster/FshareVn.py b/pyload/plugin/hoster/FshareVn.py index 47348f753..05f213680 100644 --- a/pyload/plugin/hoster/FshareVn.py +++ b/pyload/plugin/hoster/FshareVn.py @@ -2,8 +2,7 @@ import re import time - -from urlparse import urljoin +import urlparse from pyload.network.RequestFactory import getURL from pyload.plugin.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/pyload/plugin/hoster/Ftp.py b/pyload/plugin/hoster/Ftp.py index 1ebfdebd0..d26e3ad0b 100644 --- a/pyload/plugin/hoster/Ftp.py +++ b/pyload/plugin/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 pyload.plugin.Hoster import Hoster @@ -12,7 +11,7 @@ from pyload.plugin.Hoster import Hoster class Ftp(Hoster): __name = "Ftp" __type = "hoster" - __version = "0.50" + __version = "0.51" __pattern = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+' @@ -26,15 +25,13 @@ class Ftp(Hoster): def setup(self): self.chunkLimit = -1 self.resumeDownload = True - - 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 +64,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/pyload/plugin/hoster/GigapetaCom.py b/pyload/plugin/hoster/GigapetaCom.py index c524a0a7c..a85074e79 100644 --- a/pyload/plugin/hoster/GigapetaCom.py +++ b/pyload/plugin/hoster/GigapetaCom.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- +import pycurl +import random import re -from random import randint - from pyload.plugin.internal.SimpleHoster import SimpleHoster @@ -28,7 +28,7 @@ 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 for _i in xrange(5): diff --git a/pyload/plugin/hoster/HellshareCz.py b/pyload/plugin/hoster/HellshareCz.py index f7e95d273..735ed1f19 100644 --- a/pyload/plugin/hoster/HellshareCz.py +++ b/pyload/plugin/hoster/HellshareCz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from urlparse import urljoin +import urlparse from pyload.plugin.internal.SimpleHoster import SimpleHoster diff --git a/pyload/plugin/hoster/Keep2ShareCc.py b/pyload/plugin/hoster/Keep2ShareCc.py index 59e5f5c79..05dafffa8 100644 --- a/pyload/plugin/hoster/Keep2ShareCc.py +++ b/pyload/plugin/hoster/Keep2ShareCc.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from pyload.plugin.captcha.ReCaptcha import ReCaptcha from pyload.plugin.internal.SimpleHoster import SimpleHoster @@ -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/pyload/plugin/hoster/LetitbitNet.py b/pyload/plugin/hoster/LetitbitNet.py index 35f5f9cf4..85fd55b89 100644 --- a/pyload/plugin/hoster/LetitbitNet.py +++ b/pyload/plugin/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 pyload.utils import json_loads, json_dumps from pyload.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/pyload/plugin/hoster/LinksnappyCom.py b/pyload/plugin/hoster/LinksnappyCom.py index 2cb14dd51..186639a81 100644 --- a/pyload/plugin/hoster/LinksnappyCom.py +++ b/pyload/plugin/hoster/LinksnappyCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urlsplit +import urlparse from pyload.utils import json_loads, json_dumps from pyload.plugin.internal.MultiHoster import MultiHoster @@ -52,5 +51,5 @@ 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/pyload/plugin/hoster/MegaCoNz.py b/pyload/plugin/hoster/MegaCoNz.py index 9dea99b23..2d7b40d98 100644 --- a/pyload/plugin/hoster/MegaCoNz.py +++ b/pyload/plugin/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 pyload.utils import json_loads, json_dumps from pyload.plugin.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/pyload/plugin/hoster/MegaDebridEu.py b/pyload/plugin/hoster/MegaDebridEu.py index 1c84223b8..4b2604046 100644 --- a/pyload/plugin/hoster/MegaDebridEu.py +++ b/pyload/plugin/hoster/MegaDebridEu.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote_plus +import urllib from pyload.utils import json_loads from pyload.plugin.internal.MultiHoster import MultiHoster diff --git a/pyload/plugin/hoster/MegaRapidCz.py b/pyload/plugin/hoster/MegaRapidCz.py index e8aa1106f..d7ed78202 100644 --- a/pyload/plugin/hoster/MegaRapidCz.py +++ b/pyload/plugin/hoster/MegaRapidCz.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re -from pycurl import HTTPHEADER - from pyload.network.HTTPRequest import BadHeader from pyload.network.RequestFactory import getRequest from pyload.plugin.internal.SimpleHoster import SimpleHoster, parseFileInfo @@ -11,7 +10,7 @@ from pyload.plugin.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/pyload/plugin/hoster/MegaRapidoNet.py b/pyload/plugin/hoster/MegaRapidoNet.py index 54a167b65..1be61f235 100644 --- a/pyload/plugin/hoster/MegaRapidoNet.py +++ b/pyload/plugin/hoster/MegaRapidoNet.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from random import randint +import random from pyload.plugin.internal.MultiHoster import MultiHoster @@ -9,7 +9,7 @@ def random_with_N_digits(n): rand = "0." not_zero = 0 for _i in xrange(1, n + 1): - r = randint(0, 9) + r = random.randint(0, 9) if(r > 0): not_zero += 1 rand += str(r) diff --git a/pyload/plugin/hoster/MultishareCz.py b/pyload/plugin/hoster/MultishareCz.py index 4ee747043..d4546e5f9 100644 --- a/pyload/plugin/hoster/MultishareCz.py +++ b/pyload/plugin/hoster/MultishareCz.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import random import re -from random import random - from pyload.plugin.internal.SimpleHoster import SimpleHoster @@ -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/pyload/plugin/hoster/NarodRu.py b/pyload/plugin/hoster/NarodRu.py index f3ff38379..456baefec 100644 --- a/pyload/plugin/hoster/NarodRu.py +++ b/pyload/plugin/hoster/NarodRu.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import random import re -from random import random - from pyload.plugin.internal.SimpleHoster import SimpleHoster @@ -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/pyload/plugin/hoster/NetloadIn.py b/pyload/plugin/hoster/NetloadIn.py index f4421615f..9e05b02c5 100644 --- a/pyload/plugin/hoster/NetloadIn.py +++ b/pyload/plugin/hoster/NetloadIn.py @@ -2,8 +2,7 @@ import re import time - -from urlparse import urljoin +import urlparse from pyload.network.RequestFactory import getURL from pyload.plugin.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/pyload/plugin/hoster/OverLoadMe.py b/pyload/plugin/hoster/OverLoadMe.py index d4636f0f1..85a0f0a1f 100644 --- a/pyload/plugin/hoster/OverLoadMe.py +++ b/pyload/plugin/hoster/OverLoadMe.py @@ -1,9 +1,7 @@ # -*- coding: utf-8 -*- import re - -from random import randrange -from urllib import unquote +import urllib from pyload.utils import json_loads from pyload.plugin.internal.MultiHoster import MultiHoster diff --git a/pyload/plugin/hoster/PremiumTo.py b/pyload/plugin/hoster/PremiumTo.py index 750e965d2..59fd37459 100644 --- a/pyload/plugin/hoster/PremiumTo.py +++ b/pyload/plugin/hoster/PremiumTo.py @@ -2,7 +2,7 @@ from __future__ import with_statement -from os import remove +import os from pyload.plugin.internal.MultiHoster import MultiHoster from pyload.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/pyload/plugin/hoster/QuickshareCz.py b/pyload/plugin/hoster/QuickshareCz.py index 3dd11f04a..57b419688 100644 --- a/pyload/plugin/hoster/QuickshareCz.py +++ b/pyload/plugin/hoster/QuickshareCz.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- +import pycurl import re - from pyload.plugin.internal.SimpleHoster import SimpleHoster diff --git a/pyload/plugin/hoster/RapidgatorNet.py b/pyload/plugin/hoster/RapidgatorNet.py index 10b6403a1..b05b0d5d0 100644 --- a/pyload/plugin/hoster/RapidgatorNet.py +++ b/pyload/plugin/hoster/RapidgatorNet.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re -from pycurl import HTTPHEADER - from pyload.utils import json_loads from pyload.network.HTTPRequest import BadHeader from pyload.plugin.captcha.AdsCaptcha import AdsCaptcha @@ -104,7 +103,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']) @@ -117,7 +116,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/pyload/plugin/hoster/RapiduNet.py b/pyload/plugin/hoster/RapiduNet.py index 7efa606fd..6bbfc171a 100644 --- a/pyload/plugin/hoster/RapiduNet.py +++ b/pyload/plugin/hoster/RapiduNet.py @@ -1,10 +1,9 @@ # -*- coding: utf-8 -*- +import pycurl import re import time -from pycurl import HTTPHEADER - from pyload.utils import json_loads from pyload.plugin.captcha.ReCaptcha import ReCaptcha from pyload.plugin.internal.SimpleHoster import SimpleHoster @@ -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/pyload/plugin/hoster/RealdebridCom.py b/pyload/plugin/hoster/RealdebridCom.py index 5e2286974..e9c55fae3 100644 --- a/pyload/plugin/hoster/RealdebridCom.py +++ b/pyload/plugin/hoster/RealdebridCom.py @@ -2,9 +2,7 @@ import re import time - -from random import randrange -from urllib import unquote +import urllib from pyload.utils import json_loads from pyload.plugin.internal.MultiHoster import MultiHoster diff --git a/pyload/plugin/hoster/ShareonlineBiz.py b/pyload/plugin/hoster/ShareonlineBiz.py index dcdeca168..0f5a8692a 100644 --- a/pyload/plugin/hoster/ShareonlineBiz.py +++ b/pyload/plugin/hoster/ShareonlineBiz.py @@ -2,9 +2,8 @@ import re import time - -from urllib import unquote -from urlparse import urlparse +import urllib +import urlparse from pyload.network.RequestFactory import getURL from pyload.plugin.captcha.ReCaptcha 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/pyload/plugin/hoster/ShareplaceCom.py b/pyload/plugin/hoster/ShareplaceCom.py index 08fb966b8..b1361e859 100644 --- a/pyload/plugin/hoster/ShareplaceCom.py +++ b/pyload/plugin/hoster/ShareplaceCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote +import urllib from pyload.plugin.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/pyload/plugin/hoster/SpeedyshareCom.py b/pyload/plugin/hoster/SpeedyshareCom.py index b6d0a5898..5133725fd 100644 --- a/pyload/plugin/hoster/SpeedyshareCom.py +++ b/pyload/plugin/hoster/SpeedyshareCom.py @@ -4,8 +4,7 @@ # http://speedy.sh/ep2qY/Zapp-Brannigan.jpg import re - -from urlparse import urljoin +import urlparse from pyload.plugin.internal.SimpleHoster import SimpleHoster diff --git a/pyload/plugin/hoster/TurbobitNet.py b/pyload/plugin/hoster/TurbobitNet.py index 4c07cb84f..a55d824a3 100644 --- a/pyload/plugin/hoster/TurbobitNet.py +++ b/pyload/plugin/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 pyload.network.RequestFactory import getURL from pyload.plugin.captcha.ReCaptcha 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/pyload/plugin/hoster/UnibytesCom.py b/pyload/plugin/hoster/UnibytesCom.py index 2c383e383..d8092ae08 100644 --- a/pyload/plugin/hoster/UnibytesCom.py +++ b/pyload/plugin/hoster/UnibytesCom.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re - -from urlparse import urljoin - +import urlparse from pyload.plugin.internal.SimpleHoster import SimpleHoster @@ -35,7 +34,7 @@ class UnibytesCom(SimpleHoster): for _i in xrange(8): self.logDebug(action, post_data) - self.html = self.load(urljoin(domain, action), post=post_data, follow_location=False) + self.html = self.load(urlparse.urljoin(domain, action), post=post_data, follow_location=False) m = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) if m: @@ -63,7 +62,7 @@ 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")) diff --git a/pyload/plugin/hoster/UpleaCom.py b/pyload/plugin/hoster/UpleaCom.py index fe2aa036e..0459a82ea 100644 --- a/pyload/plugin/hoster/UpleaCom.py +++ b/pyload/plugin/hoster/UpleaCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urlparse import urljoin +import urlparse from pyload.plugin.internal.XFSHoster import XFSHoster @@ -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/pyload/plugin/hoster/UploadheroCom.py b/pyload/plugin/hoster/UploadheroCom.py index d1c9fd2c7..4a01d5db0 100644 --- a/pyload/plugin/hoster/UploadheroCom.py +++ b/pyload/plugin/hoster/UploadheroCom.py @@ -4,8 +4,7 @@ # http://uploadhero.co/dl/wQBRAVSM import re - -from urlparse import urljoin +import urlparse from pyload.plugin.internal.SimpleHoster import SimpleHoster @@ -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/pyload/plugin/hoster/UploadingCom.py b/pyload/plugin/hoster/UploadingCom.py index 1143a7d99..e6c4cb7de 100644 --- a/pyload/plugin/hoster/UploadingCom.py +++ b/pyload/plugin/hoster/UploadingCom.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re -from pycurl import HTTPHEADER - from pyload.utils import json_loads from pyload.plugin.internal.SimpleHoster import SimpleHoster, 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/pyload/plugin/hoster/WrzucTo.py b/pyload/plugin/hoster/WrzucTo.py index 5d17e3d4b..34306b75f 100644 --- a/pyload/plugin/hoster/WrzucTo.py +++ b/pyload/plugin/hoster/WrzucTo.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- +import pycurl import re -from pycurl import HTTPHEADER - from pyload.plugin.internal.SimpleHoster import SimpleHoster @@ -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/pyload/plugin/hoster/XHamsterCom.py b/pyload/plugin/hoster/XHamsterCom.py index 57e2a898c..4be06833b 100644 --- a/pyload/plugin/hoster/XHamsterCom.py +++ b/pyload/plugin/hoster/XHamsterCom.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from urllib import unquote +import urllib from pyload.utils import json_loads from pyload.plugin.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/pyload/plugin/hoster/Xdcc.py b/pyload/plugin/hoster/Xdcc.py index 6943f495e..d7593a936 100644 --- a/pyload/plugin/hoster/Xdcc.py +++ b/pyload/plugin/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 pyload.plugin.Hoster import Hoster diff --git a/pyload/plugin/hoster/YourfilesTo.py b/pyload/plugin/hoster/YourfilesTo.py index f5e778741..4ac49d357 100644 --- a/pyload/plugin/hoster/YourfilesTo.py +++ b/pyload/plugin/hoster/YourfilesTo.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- -import re - -from urllib import unquote +import reimport urllib from pyload.plugin.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/pyload/plugin/hoster/YoutubeCom.py b/pyload/plugin/hoster/YoutubeCom.py index 5db9957f8..b6f91fdb0 100644 --- a/pyload/plugin/hoster/YoutubeCom.py +++ b/pyload/plugin/hoster/YoutubeCom.py @@ -2,9 +2,7 @@ import os import re -import subprocess - -from urllib import unquote +import subprocessimport urllib from pyload.plugin.Hoster import Hoster from pyload.plugin.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) |