diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-07-15 16:25:41 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-07-15 16:25:41 +0200 |
commit | 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 (patch) | |
tree | b3f80dbd9e759747f9c2acb60f614c5daa7af69e /module/plugins/hoster | |
parent | Fix class definition (diff) | |
download | pyload-5060e4c6374a5116d0d8b02528f910f8c5f8bcf9.tar.xz |
Fix code indentation, some bad whitespaces and missing authors + use 'not' instead 'is None' + replace __pattern__'s r" with r' + other minor cosmetics
Diffstat (limited to 'module/plugins/hoster')
40 files changed, 105 insertions, 90 deletions
diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index b4a1d77cc..7866a771e 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -89,7 +89,7 @@ class CzshareCom(SimpleHoster): def handleFree(self): # get free url found = re.search(self.FREE_URL_PATTERN, self.html) - if found is None: + if not found: self.parseError('Free URL') parsed_url = "http://sdilej.cz" + found.group(1) self.logDebug("PARSED_URL:" + parsed_url) diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index 68ffd7619..03c8f10cd 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -10,12 +10,13 @@ from module.network.CookieJar import CookieJar class CustomBrowser(Browser): + def __init__(self, bucket=None, options={}): Browser.__init__(self, bucket, options) def load(self, *args, **kwargs): post = kwargs.get("post") - if post is None: + if not post: if len(args) > 2: post = args[2] if post: diff --git a/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py index c753e64a1..fae85d2b6 100644 --- a/module/plugins/hoster/EdiskCz.py +++ b/module/plugins/hoster/EdiskCz.py @@ -44,7 +44,7 @@ class EdiskCz(SimpleHoster): self.logDebug('URL:' + url) found = re.search(self.ACTION_PATTERN, url) - if found is None: + if not found: self.parseError("ACTION") action = found.group(1) diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 3ec319129..a2a13ebf7 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -62,7 +62,7 @@ class EuroshareEu(SimpleHoster): self.longWait(5 * 60, 12) found = re.search(self.FREE_URL_PATTERN, self.html) - if found is None: + if not found: self.parseError("Parse error (URL)") parsed_url = "http://euroshare.eu%s" % found.group(1) self.logDebug("URL", parsed_url) diff --git a/module/plugins/hoster/FileshareInUa.py b/module/plugins/hoster/FileshareInUa.py index 4ec33485e..52e084b9c 100644 --- a/module/plugins/hoster/FileshareInUa.py +++ b/module/plugins/hoster/FileshareInUa.py @@ -46,7 +46,7 @@ class FileshareInUa(Hoster): def _getName(self): name = re.search(self.PATTERN_FILENAME, self.html) - if name is None: + if not name: self.fail("%s: Plugin broken." % self.__name__) return name.group(1) @@ -66,7 +66,7 @@ def getInfo(urls): else: name = re.search(FileshareInUa.PATTERN_FILENAME, html) - if name is None: + if not name: result.append((url, 0, 1, url)) continue diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index 5b043d53d..ddb5a9ec0 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -82,7 +82,7 @@ class FreakshareCom(Hoster): def get_file_url(self): """ returns the absolute downloadable filepath """ - if self.html is None: + if not self.html: self.download_html() if not self.wantReconnect: self.req_opts = self.get_download_options() # get the Post options for the Request @@ -92,7 +92,7 @@ class FreakshareCom(Hoster): self.offline() def get_file_name(self): - if self.html is None: + if not self.html: self.download_html() if not self.wantReconnect: file_name = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">([^ ]+)", self.html) @@ -106,7 +106,7 @@ class FreakshareCom(Hoster): def get_file_size(self): size = 0 - if self.html is None: + if not self.html: self.download_html() if not self.wantReconnect: file_size_check = re.search( @@ -119,7 +119,7 @@ class FreakshareCom(Hoster): return size def get_waiting_time(self): - if self.html is None: + if not self.html: self.download_html() if "Your Traffic is used up for today" in self.html: @@ -135,7 +135,7 @@ class FreakshareCom(Hoster): def file_exists(self): """ returns True or False """ - if self.html is None: + if not self.html: self.download_html() if re.search(r"This file does not exist!", self.html) is not None: return False diff --git a/module/plugins/hoster/FreevideoCz.py b/module/plugins/hoster/FreevideoCz.py index ffad94418..94c17760b 100644 --- a/module/plugins/hoster/FreevideoCz.py +++ b/module/plugins/hoster/FreevideoCz.py @@ -59,7 +59,7 @@ class FreevideoCz(Hoster): self.offline() found = re.search(self.LINK_PATTERN, self.html) - if found is None: + if not found: self.fail("Parse error (URL)") download_url = found.group(1) diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index 941aa2d50..112451636 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -47,7 +47,7 @@ class GamefrontCom(Hoster): def _getName(self): name = re.search(self.PATTERN_FILENAME, self.html) - if name is None: + if not name: self.fail("%s: Plugin broken." % self.__name__) return name.group(1) @@ -71,7 +71,7 @@ def getInfo(urls): else: name = re.search(GamefrontCom.PATTERN_FILENAME, html) - if name is None: + if not name: result.append((url, 0, 1, url)) continue diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 3814cfd9b..3df1e8330 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -92,8 +92,9 @@ class LetitbitNet(SimpleHoster): self.html = self.load(domain + action, post=inputs, cookies=True) # action, inputs = self.parseHtmlForm('id="d3_form"') - # if not action: self.parseError("page 2 / d3_form") - # #self.logDebug(action, inputs) + # if not action: + # self.parseError("page 2 / d3_form") + # self.logDebug(action, inputs) # # self.html = self.load(action, post = inputs, cookies = True) # diff --git a/module/plugins/hoster/MegaNz.py b/module/plugins/hoster/MegaNz.py index a55220bc2..a396204ab 100644 --- a/module/plugins/hoster/MegaNz.py +++ b/module/plugins/hoster/MegaNz.py @@ -22,8 +22,8 @@ class MegaNz(Hoster): __pattern__ = r'https?://([a-z0-9]+\.)?mega\.co\.nz/#!([a-zA-Z0-9!_\-]+)' __version__ = "0.14" __description__ = """Mega.co.nz hoster plugin""" - __author_name__ = ("RaNaN", ) - __author_mail__ = ("ranan@pyload.org", ) + __author_name__ = "RaNaN" + __author_mail__ = "ranan@pyload.org" API_URL = "https://g.api.mega.co.nz/cs?id=%d" FILE_SUFFIX = ".crypted" diff --git a/module/plugins/hoster/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py index 9fcf40214..378acd856 100644 --- a/module/plugins/hoster/MegacrypterCom.py +++ b/module/plugins/hoster/MegacrypterCom.py @@ -12,8 +12,8 @@ class MegacrypterCom(MegaNz): __pattern__ = r'(https?://[a-z0-9]{0,10}\.?megacrypter\.com/[a-zA-Z0-9!_\-]+)' __version__ = "0.2" __description__ = """Megacrypter.com decrypter plugin""" - __author_name__ = ("GonzaloSR", ) - __author_mail__ = ("gonzalo@gonzalosr.com", ) + __author_name__ = "GonzaloSR" + __author_mail__ = "gonzalo@gonzalosr.com" API_URL = "http://megacrypter.com/api" FILE_SUFFIX = ".crypted" diff --git a/module/plugins/hoster/MegareleaseOrg.py b/module/plugins/hoster/MegareleaseOrg.py index cb8c7aa01..eea265323 100644 --- a/module/plugins/hoster/MegareleaseOrg.py +++ b/module/plugins/hoster/MegareleaseOrg.py @@ -30,4 +30,5 @@ class MegareleaseOrg(XFileSharingPro): FILE_INFO_PATTERN = r'<font color="red">%s/(?P<N>.+)</font> \((?P<S>[^)]+)\)</font>' % __pattern__ + getInfo = create_getInfo(MegareleaseOrg) diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 3284865ce..2fde7c0d3 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -56,7 +56,8 @@ class MegasharesCom(SimpleHoster): self.retry(wait_time=5 * 60) self.getFileInfo() - #if self.pyfile.size > 576716800: self.fail("This file is too large for free download") + # if self.pyfile.size > 576716800: + # self.fail("This file is too large for free download") # Reactivate passport if needed found = re.search(self.REACTIVATE_PASSPORT_PATTERN, self.html) diff --git a/module/plugins/hoster/MovReelCom.py b/module/plugins/hoster/MovReelCom.py index f719982cb..266e9dc55 100644 --- a/module/plugins/hoster/MovReelCom.py +++ b/module/plugins/hoster/MovReelCom.py @@ -5,6 +5,7 @@ from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInf #from pycurl import FOLLOWLOCATION, LOW_SPEED_TIME + class MovReelCom(XFileSharingPro): __name__ = "MovReelCom" __type__ = "hoster" diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index a011d87b4..043de5463 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -24,7 +24,7 @@ def getInfo(urls): api = getURL(apiurl + ids, decode=True) - if api is None or len(api) < 10: + if not api or len(api) < 10: print "Netload prefetch: failed " return if api.find("unknown_auth") >= 0: diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index 2d539f851..e43f807a2 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -83,4 +83,5 @@ class OneFichierCom(SimpleHoster): self.retry() + getInfo = create_getInfo(OneFichierCom) diff --git a/module/plugins/hoster/PornhostCom.py b/module/plugins/hoster/PornhostCom.py index 61b382c81..18032519c 100644 --- a/module/plugins/hoster/PornhostCom.py +++ b/module/plugins/hoster/PornhostCom.py @@ -21,7 +21,7 @@ class PornhostCom(Hoster): pyfile.name = self.get_file_name() self.download(self.get_file_url()) - ### old interface + # Old interface def download_html(self): url = self.pyfile.url self.html = self.load(url) @@ -29,7 +29,7 @@ class PornhostCom(Hoster): def get_file_url(self): """ returns the absolute downloadable filepath """ - if self.html is None: + if not self.html: self.download_html() file_url = re.search(r'download this file</label>.*?<a href="(.*?)"', self.html) @@ -46,7 +46,7 @@ class PornhostCom(Hoster): return file_url def get_file_name(self): - if self.html is None: + if not self.html: self.download_html() name = re.search(r'<title>pornhost\.com - free file hosting with a twist - gallery(.*?)</title>', self.html) @@ -64,7 +64,7 @@ class PornhostCom(Hoster): def file_exists(self): """ returns True or False """ - if self.html is None: + if not self.html: self.download_html() if (re.search(r'gallery not found', self.html) is not None or diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py index 29205b381..2fc08cfd3 100644 --- a/module/plugins/hoster/PornhubCom.py +++ b/module/plugins/hoster/PornhubCom.py @@ -28,7 +28,7 @@ class PornhubCom(Hoster): def get_file_url(self): """ returns the absolute downloadable filepath """ - if self.html is None: + if not self.html: self.download_html() url = "http://www.pornhub.com//gateway.php" @@ -56,7 +56,7 @@ class PornhubCom(Hoster): return file_url def get_file_name(self): - if self.html is None: + if not self.html: self.download_html() match = re.search(r'<title[^>]+>([^<]+) - ', self.html) @@ -74,7 +74,7 @@ class PornhubCom(Hoster): def file_exists(self): """ returns True or False """ - if self.html is None: + if not self.html: self.download_html() if re.search(r'This video is no longer in our database or is in conversion', self.html) is not None: diff --git a/module/plugins/hoster/PotloadCom.py b/module/plugins/hoster/PotloadCom.py index ffcfad1a5..7b3b25c34 100644 --- a/module/plugins/hoster/PotloadCom.py +++ b/module/plugins/hoster/PotloadCom.py @@ -1,18 +1,20 @@ # -*- coding: utf-8 -*- + from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo class PotloadCom(XFileSharingPro): __name__ = "PotloadCom" __type__ = "hoster" - __pattern__ = r"http://(?:www\.)?potload\.com/\w{12}" + __pattern__ = r'http://(?:www\.)?potload\.com/\w{12}' __version__ = "0.01" - __description__ = """billionuploads.com hoster plugin""" - __author_name__ = ("stickell") - __author_mail__ = ("l.stickell@yahoo.it") + __description__ = """Potload.com hoster plugin""" + __author_name__ = "stickell" + __author_mail__ = "l.stickell@yahoo.it" - FILE_INFO_PATTERN = r'<h[1-6]>(?P<N>.+) \((?P<S>\d+) (?P<U>\w+)\)</h' HOSTER_NAME = "potload.com" + FILE_INFO_PATTERN = r'<h[1-6]>(?P<N>.+) \((?P<S>\d+) (?P<U>\w+)\)</h' + getInfo = create_getInfo(PotloadCom) diff --git a/module/plugins/hoster/PromptfileCom.py b/module/plugins/hoster/PromptfileCom.py index 0b20094aa..ac3af3753 100644 --- a/module/plugins/hoster/PromptfileCom.py +++ b/module/plugins/hoster/PromptfileCom.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - ############################################################################ # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU Affero General Public License as # @@ -23,10 +22,11 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class PromptfileCom(SimpleHoster): __name__ = "PromptfileCom" __type__ = "hoster" - __pattern__ = r"https?://(?:www\.)?promptfile\.com/" + __pattern__ = r'https?://(?:www\.)?promptfile\.com/' __version__ = "0.1" - __description__ = """Promptfile.Com File Download Hoster""" - __author_name__ = ("igel") + __description__ = """Promptfile.com hoster plugin""" + __author_name__ = "igel" + __author_mail__ = "igelkun@myopera.com" FILE_INFO_PATTERN = r'<span style="[^"]*" title="[^"]*">(?P<N>.*?) \((?P<S>[\d.]+) (?P<U>\w+)\)</span>' OFFLINE_PATTERN = r'<span style="[^"]*" title="File Not Found">File Not Found</span>' @@ -49,7 +49,7 @@ class PromptfileCom(SimpleHoster): if not m: self.parseError("Unable to detect direct link") direct = m.group(1) - self.logDebug('found direct link: ' + direct) + self.logDebug("found direct link: " + direct) self.download(direct, disposition=True) diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index b4693f7ba..35506c5da 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -66,7 +66,7 @@ class QuickshareCz(SimpleHoster): def handleFree(self): # get download url download_url = '%s/download.php' % self.jsvars['server'] - data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ('ID1', 'ID2', 'ID3', 'ID4')) + 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) @@ -95,7 +95,7 @@ class QuickshareCz(SimpleHoster): def handlePremium(self): download_url = '%s/download_premium.php' % self.jsvars['server'] - data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ('ID1', 'ID2', 'ID4', 'ID5')) + data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID4", "ID5")) self.logDebug("PREMIUM URL:" + download_url, data) self.download(download_url, get=data) diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py index 57c22698d..7c6892d8d 100644 --- a/module/plugins/hoster/RPNetBiz.py +++ b/module/plugins/hoster/RPNetBiz.py @@ -20,7 +20,6 @@ class RPNetBiz(Hoster): self.resumeDownload = True def process(self, pyfile): - if re.match(self.__pattern__, pyfile.url): link_status = {'generated': pyfile.url} elif not self.account: diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index e5ab6b445..4ecd3c841 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -109,7 +109,6 @@ class RapidshareCom(Hoster): self.fail("Unknown response code.") def handleFree(self): - while self.no_download: self.dl_dict = self.freeWait() diff --git a/module/plugins/hoster/RedtubeCom.py b/module/plugins/hoster/RedtubeCom.py index a2bbf3883..465803a1c 100644 --- a/module/plugins/hoster/RedtubeCom.py +++ b/module/plugins/hoster/RedtubeCom.py @@ -29,7 +29,7 @@ class RedtubeCom(Hoster): def get_file_url(self): """ returns the absolute downloadable filepath """ - if self.html is None: + if not self.html: self.download_html() file_url = unescape(re.search(r'hashlink=(http.*?)"', self.html).group(1)) @@ -37,7 +37,7 @@ class RedtubeCom(Hoster): return file_url def get_file_name(self): - if self.html is None: + if not self.html: self.download_html() name = re.search('<title>(.*?)- RedTube - Free Porn Videos</title>', self.html).group(1).strip() + ".flv" @@ -46,7 +46,7 @@ class RedtubeCom(Hoster): def file_exists(self): """ returns True or False """ - if self.html is None: + if not self.html: self.download_html() if re.search(r'This video has been removed.', self.html) is not None: diff --git a/module/plugins/hoster/RgHostNet.py b/module/plugins/hoster/RgHostNet.py index b6d34e4fc..fafa6f2f8 100644 --- a/module/plugins/hoster/RgHostNet.py +++ b/module/plugins/hoster/RgHostNet.py @@ -24,4 +24,5 @@ class RgHostNet(SimpleHoster): download_link = found.group(1) self.download(download_link, disposition=True) + getInfo = create_getInfo(RgHostNet) diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index a5bd9c250..78cc29fdb 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -144,7 +144,7 @@ class ShareonlineBiz(Hoster): else: self.correctCaptcha() - def handlePremium(self): # should be working better loading (account) api internally + def handlePremium(self): #: should be working better loading (account) api internally self.account.getAccountInfo(self.user, True) src = self.load("http://api.share-online.biz/account.php", {"username": self.user, "password": self.account.accounts[self.user]["password"], @@ -179,9 +179,9 @@ class ShareonlineBiz(Hoster): msg = found.group(1) if found else "" self.logError(err, msg or "Unknown error occurred") - if err in ('invalid'): + if err == "invalid": self.fail(msg or "File not available") - elif err in ('freelimit', 'size', 'proxy'): + elif err in ("freelimit", "size", "proxy"): self.fail(msg or "Premium account needed") else: if err in 'server': diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py index 4c81cf149..cfc2807f9 100644 --- a/module/plugins/hoster/ShareplaceCom.py +++ b/module/plugins/hoster/ShareplaceCom.py @@ -31,7 +31,7 @@ class ShareplaceCom(Hoster): self.wait() def get_waiting_time(self): - if self.html is None: + if not self.html: self.download_html() #var zzipitime = 15; @@ -62,7 +62,7 @@ class ShareplaceCom(Hoster): self.fail("absolute filepath could not be found. offline? ") def get_file_name(self): - if self.html is None: + if not self.html: self.download_html() return re.search("<title>\s*(.*?)\s*</title>", self.html).group(1) @@ -70,7 +70,7 @@ class ShareplaceCom(Hoster): def file_exists(self): """ returns True or False """ - if self.html is None: + if not self.html: self.download_html() if re.search(r"HTTP Status 404", self.html) is not None: diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index dcd97d1e3..c0be4b145 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - ############################################################################ # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU Affero General Public License as # @@ -26,8 +25,8 @@ class SimplyPremiumCom(Hoster): __name__ = "SimplyPremiumCom" __version__ = "0.03" __type__ = "hoster" - __pattern__ = r"https?://.*(simply-premium)\.com" - __description__ = """Simply-Premium.Com hoster plugin""" + __pattern__ = r'https?://.*(simply-premium)\.com' + __description__ = """Simply-Premium.com hoster plugin""" __author_name__ = "EvolutionClip" __author_mail__ = "evolutionclip@live.de" diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index 9e5b6233f..1b2439d98 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -59,7 +59,7 @@ class StreamCz(Hoster): self.offline() found = re.search(self.CDN_PATTERN, self.html) - if found is None: + if not found: self.fail("Parse error (CDN)") cdn = found.groupdict() self.logDebug(cdn) @@ -71,7 +71,7 @@ class StreamCz(Hoster): self.fail("Stream URL not found") found = re.search(self.FILE_NAME_PATTERN, self.html) - if found is None: + if not found: self.fail("Parse error (NAME)") pyfile.name = "%s-%s.%s.mp4" % (found.group(2), found.group(1), cdnkey[-2:]) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index 1299287c4..a111240ca 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -98,7 +98,7 @@ class UlozTo(SimpleHoster): self.logDebug('inputs.keys() = ' + str(inputs.keys())) # get and decrypt captcha - if all(key in inputs for key in ('captcha_value', 'captcha_id', 'captcha_key')): + if all(key in inputs for key in ("captcha_value", "captcha_id", "captcha_key")): # Old version - last seen 9.12.2013 self.logDebug('Using "old" version') @@ -107,7 +107,7 @@ class UlozTo(SimpleHoster): inputs.update({'captcha_id': inputs['captcha_id'], 'captcha_key': inputs['captcha_key'], 'captcha_value': captcha_value}) - elif all(key in inputs for key in ('captcha_value', 'timestamp', 'salt', 'hash')): + elif all(key in inputs for key in ("captcha_value", "timestamp", "salt", "hash")): # New version - better to get new parameters (like captcha reload) because of image url - since 6.12.2013 self.logDebug('Using "new" version') diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index f2d5ce227..055083af2 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -51,19 +51,19 @@ class UloziskoSk(SimpleHoster): def handleFree(self): found = re.search(self.LINK_PATTERN, self.html) - if found is None: + if not found: self.parseError('URL') parsed_url = 'http://www.ulozisko.sk' + found.group(1) found = re.search(self.ID_PATTERN, self.html) - if found is None: + if not found: self.parseError('ID') id = found.group(1) self.logDebug('URL:' + parsed_url + ' ID:' + id) found = re.search(self.CAPTCHA_PATTERN, self.html) - if found is None: + if not found: self.parseError('CAPTCHA') captcha_url = 'http://www.ulozisko.sk' + found.group(1) diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 6f0fe36b8..61f254476 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -69,7 +69,7 @@ class UnibytesCom(SimpleHoster): if last_step == 'timer': found = re.search(self.WAIT_PATTERN, self.html) self.wait(int(found.group(1)) if found else 60, False) - elif last_step in ('captcha', 'last'): + elif last_step in ("captcha", "last"): post_data['captcha'] = self.decryptCaptcha(domain + '/captcha.jpg') else: self.fail("No valid captcha code entered") diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py index 50dc431a9..adda573bc 100644 --- a/module/plugins/hoster/UpstoreNet.py +++ b/module/plugins/hoster/UpstoreNet.py @@ -8,10 +8,11 @@ from module.plugins.internal.CaptchaService import ReCaptcha class UpstoreNet(SimpleHoster): __name__ = "UpstoreNet" __type__ = "hoster" - __pattern__ = r"https?://(?:www\.)?upstore\.net/" + __pattern__ = r'https?://(?:www\.)?upstore\.net/' __version__ = "0.02" __description__ = """Upstore.Net File Download Hoster""" - __author_name__ = ("igel") + __author_name__ = "igel" + __author_mail__ = "igelkun@myopera.com" FILE_INFO_PATTERN = r'<div class="comment">.*?</div>\s*\n<h2 style="margin:0">(?P<N>.*?)</h2>\s*\n<div class="comment">\s*\n\s*(?P<S>[\d.]+) (?P<U>\w+)' OFFLINE_PATTERN = r'<span class="error">File not found</span>' @@ -20,6 +21,7 @@ class UpstoreNet(SimpleHoster): CHASH_PATTERN = r'<input type="hidden" name="hash" value="([^"]*)">' LINK_PATTERN = r'<a href="(https?://.*?)" target="_blank"><b>' + def handleFree(self): # STAGE 1: get link to continue m = re.search(self.CHASH_PATTERN, self.html) diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index 22fc4b207..fd804d3f9 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -5,12 +5,12 @@ from module.plugins.Hoster import Hoster class VeehdCom(Hoster): - __name__ = 'VeehdCom' - __type__ = 'hoster' + __name__ = "VeehdCom" + __type__ = "hoster" __pattern__ = r'http://veehd\.com/video/\d+_\S+' __config__ = [("filename_spaces", "bool", "Allow spaces in filename", False), ("replacement_char", "str", "Filename replacement character", "_")] - __version__ = '0.23' + __version__ = "0.23" __description__ = """Veehd.com hoster plugin""" __author_name__ = "cat" __author_mail__ = "cat@pyload" @@ -36,7 +36,7 @@ class VeehdCom(Hoster): self.html = self.load(url) def file_exists(self): - if self.html is None: + if not self.html: self.download_html() if '<title>Veehd</title>' in self.html: @@ -44,7 +44,7 @@ class VeehdCom(Hoster): return True def get_file_name(self): - if self.html is None: + if not self.html: self.download_html() match = re.search(r'<title[^>]*>([^<]+) on Veehd</title>', self.html) @@ -65,7 +65,7 @@ class VeehdCom(Hoster): def get_file_url(self): """ returns the absolute downloadable filepath """ - if self.html is None: + if not self.html: self.download_html() match = re.search(r'<embed type="video/divx" src="(http://([^/]*\.)?veehd\.com/dl/[^"]+)"', diff --git a/module/plugins/hoster/Vipleech4uCom.py b/module/plugins/hoster/Vipleech4uCom.py index 5e0613be1..d4ccf997a 100644 --- a/module/plugins/hoster/Vipleech4uCom.py +++ b/module/plugins/hoster/Vipleech4uCom.py @@ -7,7 +7,7 @@ class Vipleech4uCom(DeadHoster): __name__ = "Vipleech4uCom" __version__ = "0.2" __type__ = "hoster" - __pattern__ = r"http://(?:www\.)?vipleech4u\.com/manager\.php" + __pattern__ = r'http://(?:www\.)?vipleech4u\.com/manager\.php' __description__ = """Vipleech4u.com hoster plugin""" __author_name__ = "Kagenoshin" __author_mail__ = "kagenoshin@gmx.ch" diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py index 0f0371f21..b5b548620 100644 --- a/module/plugins/hoster/XHamsterCom.py +++ b/module/plugins/hoster/XHamsterCom.py @@ -42,13 +42,13 @@ class XHamsterCom(Hoster): def get_file_url(self): """ returns the absolute downloadable filepath """ - if self.html is None: + if not self.html: self.download_html() flashvar_pattern = re.compile('flashvars = ({.*?});', re.DOTALL) json_flashvar = flashvar_pattern.search(self.html) - if json_flashvar is None: + if not json_flashvar: self.fail("Parse error (flashvars)") j = clean_json(json_flashvar.group(1)) @@ -66,7 +66,7 @@ class XHamsterCom(Hoster): if self.desired_fmt == ".mp4": file_url = re.search(r"<a href=\"" + srv_url + "(.+?)\"", self.html) - if file_url is None: + if not file_url: self.fail("Parse error (file_url)") file_url = file_url.group(1) long_url = srv_url + file_url @@ -87,21 +87,21 @@ class XHamsterCom(Hoster): return long_url def get_file_name(self): - if self.html is None: + if not self.html: self.download_html() file_name_pattern = r"<title>(.*?) - xHamster\.com</title>" file_name = re.search(file_name_pattern, self.html) - if file_name is None: + if not file_name: file_name_pattern = r"<h1 >(.*)</h1>" file_name = re.search(file_name_pattern, self.html) - if file_name is None: + if not file_name: file_name_pattern = r"http://[www.]+xhamster\.com/movies/.*/(.*?)\.html?" file_name = re.match(file_name_pattern, self.pyfile.url) - if file_name is None: + if not file_name: file_name_pattern = r"<div id=\"element_str_id\" style=\"display:none;\">(.*)</div>" file_name = re.search(file_name_pattern, self.html) - if file_name is None: + if not file_name: return "Unknown" return file_name.group(1) @@ -109,7 +109,7 @@ class XHamsterCom(Hoster): def file_exists(self): """ returns True or False """ - if self.html is None: + if not self.html: self.download_html() if re.search(r"(.*Video not found.*)", self.html) is not None: return False diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index cc9f4719c..d6083e4f7 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -62,7 +62,7 @@ class Xdcc(Hoster): else: errno = e.args[0] - if errno in (10054,): + if errno == 10054: self.logDebug("XDCC: Server blocked our ip, retry in 5 min") self.setWait(300) self.wait() diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index fc30c2f4b..0aca311ce 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -44,9 +44,16 @@ class YibaishiwuCom(SimpleHoster): self.logDebug(('FREEUSER' if found.group(2) == 'download' else 'GUEST') + ' URL', url) response = json_loads(self.load("http://115.com" + url, decode=False)) - for mirror in (response['urls'] if 'urls' in response else response['data'] if 'data' in response else []): + if "urls" in response: + mirrors = response['urls'] + elif "data" in response: + mirrors = response['data'] + else: + mirrors = None + + for m in mirrors: try: - url = mirror['url'].replace('\\', '') + url = m['url'].replace('\\', '') self.logDebug("Trying URL: " + url) self.download(url) break diff --git a/module/plugins/hoster/YoupornCom.py b/module/plugins/hoster/YoupornCom.py index 9dc1dc6e9..d5ba1f5d0 100644 --- a/module/plugins/hoster/YoupornCom.py +++ b/module/plugins/hoster/YoupornCom.py @@ -29,14 +29,14 @@ class YoupornCom(Hoster): def get_file_url(self): """ returns the absolute downloadable filepath """ - if self.html is None: + if not self.html: self.download_html() file_url = re.search(r'(http://download\.youporn\.com/download/\d+\?save=1)">', self.html).group(1) return file_url def get_file_name(self): - if self.html is None: + if not self.html: self.download_html() file_name_pattern = r"<title>(.*) - Free Porn Videos - YouPorn</title>" @@ -45,7 +45,7 @@ class YoupornCom(Hoster): def file_exists(self): """ returns True or False """ - if self.html is None: + if not self.html: self.download_html() if re.search(r"(.*invalid video_id.*)", self.html) is not None: return False diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py index c8c5c523c..3fb517eef 100644 --- a/module/plugins/hoster/YourfilesTo.py +++ b/module/plugins/hoster/YourfilesTo.py @@ -31,7 +31,7 @@ class YourfilesTo(Hoster): self.wait() def get_waiting_time(self): - if self.html is None: + if not self.html: self.download_html() #var zzipitime = 15; @@ -59,7 +59,7 @@ class YourfilesTo(Hoster): self.fail("absolute filepath could not be found. offline? ") def get_file_name(self): - if self.html is None: + if not self.html: self.download_html() return re.search("<title>(.*)</title>", self.html).group(1) @@ -67,7 +67,7 @@ class YourfilesTo(Hoster): def file_exists(self): """ returns True or False """ - if self.html is None: + if not self.html: self.download_html() if re.search(r"HTTP Status 404", self.html) is not None: |