From 6c75c0363f496df86e9c744a9a946f86f82715fa Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 2 Jan 2016 16:01:56 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/BezvadataCz.py | 4 ++-- module/plugins/hoster/CrockoCom.py | 2 +- module/plugins/hoster/CzshareCom.py | 8 ++++---- module/plugins/hoster/DailymotionCom.py | 2 +- module/plugins/hoster/DataportCz.py | 2 +- module/plugins/hoster/EuroshareEu.py | 2 +- module/plugins/hoster/ExtabitCom.py | 6 +++--- module/plugins/hoster/FilepostCom.py | 2 +- module/plugins/hoster/FilesMailRu.py | 23 ----------------------- module/plugins/hoster/FileserveCom.py | 23 ----------------------- module/plugins/hoster/FourSharedCom.py | 2 +- module/plugins/hoster/FreakshareCom.py | 14 +++++++------- module/plugins/hoster/FshareVn.py | 10 +--------- module/plugins/hoster/Ftp.py | 3 +-- module/plugins/hoster/HighWayMe.py | 4 ++-- module/plugins/hoster/Http.py | 2 +- module/plugins/hoster/HugefilesNet.py | 2 +- module/plugins/hoster/IfolderRu.py | 4 ++-- module/plugins/hoster/JumbofilesCom.py | 2 +- module/plugins/hoster/Keep2ShareCc.py | 2 +- module/plugins/hoster/LetitbitNet.py | 19 +------------------ module/plugins/hoster/LuckyShareNet.py | 6 +++--- module/plugins/hoster/MegaRapidCz.py | 17 +++-------------- module/plugins/hoster/MultishareCz.py | 2 +- module/plugins/hoster/NarodRu.py | 6 +++--- module/plugins/hoster/NoPremiumPl.py | 4 ++-- module/plugins/hoster/OneFichierCom.py | 2 +- module/plugins/hoster/OpenloadIo.py | 4 ++-- module/plugins/hoster/PornhubCom.py | 2 +- module/plugins/hoster/QuickshareCz.py | 4 ++-- module/plugins/hoster/RapideoPl.py | 4 ++-- module/plugins/hoster/SecureUploadEu.py | 2 +- module/plugins/hoster/SendspaceCom.py | 2 +- module/plugins/hoster/ShareonlineBiz.py | 6 +++--- module/plugins/hoster/ShareplaceCom.py | 2 +- module/plugins/hoster/SimplyPremiumCom.py | 4 ++-- module/plugins/hoster/SmoozedCom.py | 2 +- module/plugins/hoster/StreamCz.py | 1 - module/plugins/hoster/UloziskoSk.py | 2 +- module/plugins/hoster/UnibytesCom.py | 10 +++++----- module/plugins/hoster/UploadableCh.py | 2 +- module/plugins/hoster/VeehdCom.py | 2 +- module/plugins/hoster/VidPlayNet.py | 2 +- module/plugins/hoster/XDCC.py | 2 +- module/plugins/hoster/XHamsterCom.py | 4 ++-- module/plugins/hoster/XVideosCom.py | 4 ++-- module/plugins/hoster/YoupornCom.py | 2 +- module/plugins/hoster/YourfilesTo.py | 2 +- module/plugins/hoster/YoutubeCom.py | 2 +- module/plugins/hoster/ZDF.py | 2 +- 50 files changed, 80 insertions(+), 164 deletions(-) (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index 51082a8a1..626673b44 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -23,8 +23,8 @@ class BezvadataCz(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'

Soubor: (?P[^<]+)

' - SIZE_PATTERN = r'
  • Velikost: (?P[^<]+)
  • ' + NAME_PATTERN = r'

    Soubor: (?P.+?)

    ' + SIZE_PATTERN = r'
  • Velikost: (?P.+?)
  • ' OFFLINE_PATTERN = r'BezvaData \| Soubor nenalezen' diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index 2205759e8..eb8da1f9f 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -26,7 +26,7 @@ class CrockoCom(SimpleHoster): NAME_PATTERN = r'Download:\s*(?P.*)' - SIZE_PATTERN = r'(?P[^<]+)' + SIZE_PATTERN = r'(?P.+?)' OFFLINE_PATTERN = r'

    Sorry,
    the page you\'re looking for
    isn\'t here.

    |File not found' CAPTCHA_PATTERN = r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';" diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index c2a7d3409..42a2ec02b 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -27,7 +27,7 @@ class CzshareCom(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'
    \s*

    \s*Cel. n.zev: (?P[^<]+)' + NAME_PATTERN = r'

    \s*

    \s*Cel. n.zev: (?P.+?)' SIZE_PATTERN = r'

    (?:\s*

    [^\n]*

    )*\s*Velikost:\s*(?P[\d .,]+)(?P[\w^_]+)\s*
    ' OFFLINE_PATTERN = r'
    \s*

    ' @@ -40,7 +40,7 @@ class CzshareCom(SimpleHoster): FREE_FORM_PATTERN = r'
    \s*(.*?)
    ' PREMIUM_FORM_PATTERN = r'
    (.*?)
    ' FORM_INPUT_PATTERN = r']* name="(.+?)" value="(.+?)"[^>]*/>' - MULTIDL_PATTERN = r'

    Z[^<]*PROFI.

    ' + MULTIDL_PATTERN = r'

    Z.*?PROFI.

    ' USER_CREDIT_PATTERN = r'
    \s*kredit: ([\d .,]+)(\w+)\s*
    ' @@ -139,8 +139,8 @@ class CzshareCom(SimpleHoster): def check_download(self): #: Check download check = self.scan_download({ - "temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), - 'credit' : re.compile(r"^Nem.*te dostate.*n.* kredit.$"), + "temp offline" : re.compile(r'^Soubor je do.*asn.* nedostupn.*$'), + 'credit' : re.compile(r'^Nem.*te dostate.*n.* kredit.$'), "multi-dl" : re.compile(self.MULTIDL_PATTERN), 'captcha' : "
  • Zadaný ověřovací kód nesouhlasí!
  • " }) diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py index 119373b08..bef146d84 100644 --- a/module/plugins/hoster/DailymotionCom.py +++ b/module/plugins/hoster/DailymotionCom.py @@ -64,7 +64,7 @@ class DailymotionCom(Hoster): def get_streams(self): streams = [] - for result in re.finditer(r"\"(?Phttp:\\/\\/www.dailymotion.com\\/cdn\\/H264-(?P.*?)\\.*?)\"", + for result in re.finditer(r'\"(?Phttp:\\/\\/www.dailymotion.com\\/cdn\\/H264-(?P.*?)\\.*?)\"', self.data): url = result.group('URL') qf = result.group('QF') diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index 5c9756b51..2ec4eb6b1 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -21,7 +21,7 @@ class DataportCz(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'(?P[^<]+)' + NAME_PATTERN = r'(?P.+?)' SIZE_PATTERN = r'Velikost\s*(?P[^<]+)' OFFLINE_PATTERN = r'

    Soubor nebyl nalezen

    ' diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 2df748cd2..3ef8f89bd 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -33,7 +33,7 @@ class EuroshareEu(SimpleHoster): DL_LIMIT_PATTERN = r'

    Prebieha s.ahovanie

    |

    Naraz je z jednej IP adresy mo.n. s.ahova. iba jeden s.bor' ERROR_PATTERN = r'href="/customer-zone/login/"' - URL_REPLACEMENTS = [(r"(http://[^/]*\.)(sk|cz|hu|pl)/", r"\1eu/")] + URL_REPLACEMENTS = [(r'(http://[^/]*\.)(sk|cz|hu|pl)/', r'\1eu/')] def handle_premium(self, pyfile): diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index f854c0e38..e71fb41c1 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -28,7 +28,7 @@ class ExtabitCom(SimpleHoster): NAME_PATTERN = r'File:\s*\s*

    ' - SIZE_PATTERN = r'Size:\s*(?P[^<]+)' + SIZE_PATTERN = r'Size:\s*(?P.+?)' OFFLINE_PATTERN = r'>File not found<' TEMP_OFFLINE_PATTERN = r'>(File is temporary unavailable|No download mirror)<' @@ -36,10 +36,10 @@ class ExtabitCom(SimpleHoster): def handle_free(self, pyfile): - if r">Only premium users can download this file" in self.data: + if r'>Only premium users can download this file" in self.data: self.fail(_("Only premium users can download this file")) - m = re.search(r"Next free download from your ip will be available in (\d+)\s*minutes", self.data) + m = re.search(r"Next free download from your ip will be available in (\d+)\s*minutes', self.data) if m is not None: self.wait(int(m.group(1)) * 60, True) elif "The daily downloads limit from your IP is exceeded" in self.data: diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index c47684522..0d2e3d81f 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -26,7 +26,7 @@ class FilepostCom(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - INFO_PATTERN = r'(?P[^>]+?) - (?P[\d.,]+) (?P[\w^_]+)\' class="inp_text"/>' + INFO_PATTERN = r'(?P.+?) - (?P[\d.,]+) (?P[\w^_]+)\' class="inp_text"/>' OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File.
    |
    ' PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file' diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index 04a91fe94..cab8dc68a 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -7,29 +7,6 @@ from module.plugins.internal.Hoster import Hoster from module.plugins.internal.misc import chunks -def get_info(urls): - result = [] - for chunk in chunks(urls, 10): - for url in chunk: - html = get_url(url) - if r'
    ' in html: - result.append((url, 0, 1, url)) - elif r'Page cannot be displayed' in html: - result.append((url, 0, 1, url)) - else: - try: - url_pattern = '(.+?)' - file_name = re.search(url_pattern, html).group(0).split(', event)">')[1].split('')[0] - result.append((file_name, 0, 2, url)) - - except Exception: - pass - - #: status 1=OFFLINE, 2=OK, 3=UNKNOWN - #: result.append((#name,#size,#status,#url)) - yield result - - class FilesMailRu(Hoster): __name__ = "FilesMailRu" __type__ = "hoster" diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index cb39311bc..933911f4f 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -8,26 +8,6 @@ from module.plugins.internal.Hoster import Hoster from module.plugins.internal.misc import json, parse_size, seconds_to_midnight -def get_info(plugin, urls): - html = get_url(plugin.URLS[1], post={'urls': "\n".join(urls)}) - - file_info = [] - for li in re.finditer(plugin.LINKCHECK_TR, html, re.S): - try: - cols = re.findall(plugin.LINKCHECK_TD, li.group(1)) - if cols: - file_info.append(( - cols[1] if cols[1] != '--' else cols[0], - parse_size(cols[2]) if cols[2] != '--' else 0, - 2 if cols[3].startswith('Available') else 1, - cols[0])) - - except Exception, e: - continue - - return file_info - - class FileserveCom(Hoster): __name__ = "FileserveCom" __type__ = "hoster" @@ -49,9 +29,6 @@ class FileserveCom(Hoster): "http://www.fileserve.com/link-checker.php", "http://www.fileserve.com/checkReCaptcha.php"] - LINKCHECK_TR = r'\s*(http://www\.fileserve\.com/file/.*?)' - LINKCHECK_TD = r'(?:<.*?>| )*([^<]*)' - CAPTCHA_KEY_PATTERN = r'var reCAPTCHA_publickey=\'(.+?)\'' LONG_WAIT_PATTERN = r'
  • You need to wait (\d+) (\w+) to start another download\.
  • ' LINK_EXPIRED_PATTERN = r'Your download link has expired' diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py index ccfd30f4a..ab8d6ab48 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -28,7 +28,7 @@ class FourSharedCom(SimpleHoster): SIZE_PATTERN = r'' OFFLINE_PATTERN = r'The file link that you requested is not valid\.|This file was deleted.' - NAME_REPLACEMENTS = [(r"&#(\d+).", lambda m: unichr(int(m.group(1))))] + NAME_REPLACEMENTS = [(r'&#(\d+).', lambda m: unichr(int(m.group(1))))] SIZE_REPLACEMENTS = [(",", "")] DIRECT_LINK = False diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index b24dabd28..ddad47699 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -112,7 +112,7 @@ class FreakshareCom(Hoster): self.download_html() if not self.wantReconnect: - m = re.search(r"([^ ]+)", self.data) + m = re.search(r'([^ ]+)', self.data) if m is not None: file_name = m.group(1) else: @@ -129,7 +129,7 @@ class FreakshareCom(Hoster): self.download_html() if not self.wantReconnect: - m = re.search(r"[^ ]+ - ([^ ]+) (\w\w)yte", self.data) + m = re.search(r'[^ ]+ - ([^ ]+) (\w\w)yte', self.data) if m is not None: units = float(m.group(1).replace(",", "")) pow = {'KB': 1, 'MB': 2, 'GB': 3}[m.group(2)] @@ -159,24 +159,24 @@ class FreakshareCom(Hoster): """ if not self.data: self.download_html() - if re.search(r"This file does not exist!", self.data): + if re.search(r'This file does not exist!', self.data): return False else: return True def get_download_options(self): - re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?", + re_envelope = re.search(r'.*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?', self.data).group(0) #: Get the whole request - to_sort = re.findall(r"", re_envelope) + to_sort = re.findall(r'', re_envelope) request_options = dict((n, v) for (v, n) in to_sort) herewego = self.load(self.pyfile.url, None, request_options) #: The actual download-Page - to_sort = re.findall(r"", herewego) + to_sort = re.findall(r'', herewego) request_options = dict((n, v) for (v, n) in to_sort) - challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=(\w+)", herewego) + challenge = re.search(r'http://api\.recaptcha\.net/challenge\?k=(\w+)', herewego) if challenge: re_captcha = ReCaptcha(self.pyfile) diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 8fa920e07..5a6710470 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -9,14 +9,6 @@ from module.plugins.internal.Base import parse_fileInfo from module.plugins.internal.SimpleHoster import SimpleHoster -def get_info(urls): - for url in urls: - html = get_url("http://www.fshare.vn/check_link.php", - post={'action': "check_link", 'arrlinks': url}) - - yield parse_fileInfo(FshareVn, url, html) - - def double_decode(m): return m.group(1).decode('raw_unicode_escape') @@ -39,7 +31,7 @@ class FshareVn(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - INFO_PATTERN = r'

    (?P[^<]+)<\\/p>[\\trn\s]*

    (?P[\d.,]+)\s*(?P[\w^_]+)<\\/p>' + INFO_PATTERN = r'

    (?P.+?)<\\/p>[\\trn\s]*

    (?P[\d.,]+)\s*(?P[\w^_]+)<\\/p>' OFFLINE_PATTERN = r'

    \\t\\t\\t\\t\\r\\n\\t\\t

    <\\/p>\\t\\t\\r\\n\\t\\t

    0 KB<\\/p>' NAME_REPLACEMENTS = [("(.*)", double_decode)] diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 623879dd8..babf6c2c5 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -67,10 +67,9 @@ class Ftp(Hoster): self.req.http.c.setopt(pycurl.NOBODY, 0) self.log_debug(self.req.http.header) - m = re.search(r"Content-Length:\s*(\d+)", res) + m = re.search(r'Content-Length:\s*(\d+)', res) if m is not None: pyfile.size = int(m.group(1)) - self.download(pyfile.url) else: diff --git a/module/plugins/hoster/HighWayMe.py b/module/plugins/hoster/HighWayMe.py index 029cb7fdc..cf50d2808 100644 --- a/module/plugins/hoster/HighWayMe.py +++ b/module/plugins/hoster/HighWayMe.py @@ -65,7 +65,7 @@ class HighWayMe(MultiHoster): self.check_errors() try: - self.pyfile.name = re.search(r'([^<]+)', self.data).group(1) + self.pyfile.name = re.search(r'(.+?)', self.data).group(1) except AttributeError: self.pyfile.name = "" @@ -76,4 +76,4 @@ class HighWayMe(MultiHoster): except AttributeError: self.pyfile.size = 0 - self.link = re.search(r'([^<]+)', self.data).group(1) + self.link = re.search(r'(.+?)', self.data).group(1) diff --git a/module/plugins/hoster/Http.py b/module/plugins/hoster/Http.py index 9d03b189b..01748c697 100644 --- a/module/plugins/hoster/Http.py +++ b/module/plugins/hoster/Http.py @@ -15,7 +15,7 @@ class Http(Hoster): __pattern__ = r'(?:jd|pys?)://.+' __config__ = [("activated", "bool", "Activated", True)] - __description__ = """Download from http link""" + __description__ = """Download simple http link""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/hoster/HugefilesNet.py b/module/plugins/hoster/HugefilesNet.py index 0c8f1ecc4..85f8b45f2 100644 --- a/module/plugins/hoster/HugefilesNet.py +++ b/module/plugins/hoster/HugefilesNet.py @@ -25,6 +25,6 @@ class HugefilesNet(XFSHoster): PLUGIN_DOMAIN = "hugefiles.net" - SIZE_PATTERN = r'File Size:\s*(?P[^<]+)

    ' + SIZE_PATTERN = r'File Size:
    \s*(?P.+?)
    ' FORM_INPUTS_MAP = {'ctype': re.compile(r'\d+')} diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index 919d37b75..8e47c01ed 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -25,8 +25,8 @@ class IfolderRu(SimpleHoster): SIZE_REPLACEMENTS = [(u'Кб', 'KB'), (u'Мб', 'MB'), (u'Гб', 'GB')] - NAME_PATTERN = ur'(?:
    )?Название:(?:)? (?P[^<]+)<(?:/div|br)>' - SIZE_PATTERN = ur'(?:
    )?Размер:(?:)? (?P[^<]+)<(?:/div|br)>' + NAME_PATTERN = ur'(?:
    )?Название:(?:)? (?P.+?)<(?:/div|br)>' + SIZE_PATTERN = ur'(?:
    )?Размер:(?:)? (?P.+?)<(?:/div|br)>' OFFLINE_PATTERN = ur'

    Файл номер .*? (не найден|удален) !!!

    ' SESSION_ID_PATTERN = r'(?P[^<]+?)\s*\((?P[\d.,]+)\s*(?P[\w^_]+)' + INFO_PATTERN = r'(?P.+?)\s*\((?P[\d.,]+)\s*(?P[\w^_]+)' OFFLINE_PATTERN = r'Not Found or Deleted / Disabled due to inactivity or DMCA' LINK_FREE_PATTERN = r'' diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index 43c89176b..a66033590 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -29,7 +29,7 @@ class Keep2ShareCc(SimpleHoster): URL_REPLACEMENTS = [(__pattern__ + ".*", "http://keep2s.cc/file/\g")] NAME_PATTERN = r'File: (?P.+?)' - SIZE_PATTERN = r'Size: (?P[^<]+)
    ' + SIZE_PATTERN = r'Size: (?P.+?)
    ' OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' TEMP_OFFLINE_PATTERN = r'Downloading blocked due to' diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 2d3b9da9c..321ced131 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -16,23 +16,6 @@ from module.plugins.internal.SimpleHoster import SimpleHoster from module.plugins.internal.misc import seconds_to_midnight -def api_response(url): - json_data = ["yw7XQy2v9", ["download/info", {'link': url}]] - api_rep = get_url("http://api.letitbit.net/json", - post={'r': json.dumps(json_data)}) - return json.loads(api_rep) - - -def get_info(urls): - for url in urls: - api_rep = api_response(url) - if api_rep['status'] == "OK": - info = api_rep['data'][0] - yield (info['name'], info['size'], 2, url) - else: - yield (url, 0, 1, url) - - class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" @@ -52,7 +35,7 @@ class LetitbitNet(SimpleHoster): ("z00nx", "z00nx0@gmail.com")] - URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "letitbit.net")] + URL_REPLACEMENTS = [(r'(?<=http://)([^/]+)', "letitbit.net")] SECONDS_PATTERN = r'seconds\s*=\s*(\d+);' CAPTCHA_CONTROL_FIELD = r'recaptcha_control_field\s=\s\'(.+?)\'' diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index 1aa5501d5..ad6d0be85 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -32,7 +32,7 @@ class LuckyShareNet(SimpleHoster): def parse_json(self, rep): if 'AJAX Error' in rep: html = self.load(self.pyfile.url) - m = re.search(r"waitingtime = (\d+);", html) + m = re.search(r'waitingtime = (\d+);', html) if m is not None: seconds = int(m.group(1)) self.log_debug("You have to wait %d seconds between free downloads" % seconds) @@ -47,7 +47,7 @@ class LuckyShareNet(SimpleHoster): #@TODO: There should be a filesize limit for free downloads #: Some files could not be downloaded in free mode def handle_free(self, pyfile): - rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + self.info['pattern']['ID']) + rep = self.load(r'http://luckyshare.net/download/request/type/time/file/' + self.info['pattern']['ID']) self.log_debug("JSON: " + rep) @@ -57,7 +57,7 @@ class LuckyShareNet(SimpleHoster): self.captcha = ReCaptcha(pyfile) response, challenge = self.captcha.challenge() - rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" % + rep = self.load(r'http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s' % (challenge, response, json_data['hash'])) self.log_debug("JSON: " + rep) diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py index 3d1b288d6..4ba13c57f 100644 --- a/module/plugins/hoster/MegaRapidCz.py +++ b/module/plugins/hoster/MegaRapidCz.py @@ -10,17 +10,6 @@ from module.plugins.internal.Base import parse_fileInfo from module.plugins.internal.SimpleHoster import SimpleHoster -def get_info(urls): - h = get_request() - 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"]) - - for url in urls: - html = h.load(url) - yield parse_fileInfo(MegaRapidCz, url, html) - - class MegaRapidCz(SimpleHoster): __name__ = "MegaRapidCz" __type__ = "hoster" @@ -42,13 +31,13 @@ class MegaRapidCz(SimpleHoster): ("Walter Purcaro", "vuolter@gmail.com")] - NAME_PATTERN = r'(?:)?(?P[^<]+)' - SIZE_PATTERN = r'Velikost:\s*\s*(?P[\d.,]+) (?P[\w^_]+)' + NAME_PATTERN = r'(?:)?(?P.+?)' + SIZE_PATTERN = r'Velikost:\s*\s*(?P[\d.,]+) (?P[\w^_]+)' OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán' CHECK_TRAFFIC = True - LINK_PREMIUM_PATTERN = r'([^<]+)' + LINK_PREMIUM_PATTERN = r'(.+?)' ERR_LOGIN_PATTERN = ur'
    Stahování je přístupné pouze přihlášeným uživatelům' ERR_CREDIT_PATTERN = ur'
    Stahování zdarma je možné jen přes náš' diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index fca6974f9..36ac8e70b 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -29,7 +29,7 @@ class MultishareCz(SimpleHoster): CHECK_TRAFFIC = True LEECH_HOSTER = True - INFO_PATTERN = ur'(?:
  • Název|Soubor): (?P[^<]+)<(?:/li>Velikost: (?P[^<]+)' + INFO_PATTERN = ur'(?:
  • Název|Soubor): (?P.+?)<(?:/li>Velikost: (?P.+?)' OFFLINE_PATTERN = ur'

    Stáhnout soubor

    Požadovaný soubor neexistuje.

    ' diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py index 4f7c7e321..1f2bcf4b0 100644 --- a/module/plugins/hoster/NarodRu.py +++ b/module/plugins/hoster/NarodRu.py @@ -25,13 +25,13 @@ class NarodRu(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'
    (?:<[^<]*>)*(?P[^<]+)
    ' - SIZE_PATTERN = r'
    (?P\d[^<]*)
    ' + NAME_PATTERN = r'
    (?:<.*?>)*(?P.+?)
    ' + SIZE_PATTERN = r'
    (?P\d.*?)
    ' OFFLINE_PATTERN = r'404|Файл удален с сервиса|Закончился срок хранения файла\.' SIZE_REPLACEMENTS = [(u'КБ', 'KB'), (u'МБ', 'MB'), (u'ГБ', 'GB')] URL_REPLACEMENTS = [("narod.yandex.ru/", "narod.ru/"), - (r"/start/\d+\.\w+\-narod\.yandex\.ru/(\d{6,15})/\w+/(\w+)", r"/disk/\1/\2")] + (r'/start/\d+\.\w+\-narod\.yandex\.ru/(\d{6,15})/\w+/(\w+)', r'/disk/\1/\2')] CAPTCHA_PATTERN = r'(\w+)' LINK_FREE_PATTERN = r'' diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 7a244e745..1f18fe994 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -40,8 +40,8 @@ class NoPremiumPl(MultiHoster): 80: "Too many incorrect login attempts, account blocked for 24h"} - def prepare(self): - super(NoPremiumPl, self).prepare() + def _prepare(self): + super(NoPremiumPl, self)._prepare() data = self.account.get_data() diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index ab3ea8708..f26680689 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -54,7 +54,7 @@ class OneFichierCom(SimpleHoster): redirect = url for i in xrange(10): try: - headers = dict((k.lower(), v) for k,v in re.findall(r"(?P.+?): (?P.+?)\r?\n", get_url(redirect, just_header=True))) + headers = dict((k.lower(), v) for k,v in re.findall(r'(?P.+?): (?P.+?)\r?\n', get_url(redirect, just_header=True))) if 'location' in headers and headers['location']: redirect = headers['location'] else: diff --git a/module/plugins/hoster/OpenloadIo.py b/module/plugins/hoster/OpenloadIo.py index 57a7e72b1..5f57cbe8a 100644 --- a/module/plugins/hoster/OpenloadIo.py +++ b/module/plugins/hoster/OpenloadIo.py @@ -2,7 +2,7 @@ import re -from module.network.RequestFactory import getURL +from module.network.RequestFactory import getURL as get_url from module.plugins.internal.SimpleHoster import SimpleHoster from module.plugins.internal.misc import json @@ -37,7 +37,7 @@ class OpenloadIo(SimpleHoster): @classmethod def _load_json(cls, uri): - return json.loads(getURL(cls.API_URL + uri)) + return json.loads(get_url(cls.API_URL + uri)) @classmethod diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py index e93f765ad..2ef2b965b 100644 --- a/module/plugins/hoster/PornhubCom.py +++ b/module/plugins/hoster/PornhubCom.py @@ -67,7 +67,7 @@ class PornhubCom(Hoster): if not self.data: self.download_html() - m = re.search(r'([^<]+) - ', self.data) + m = re.search(r'(.+?) - ', self.data) if m is not None: name = m.group(1) else: diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 49a55c6b1..1041255e6 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -23,7 +23,7 @@ class QuickshareCz(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'Název:\s*(?P[^<]+)' + NAME_PATTERN = r'Název:\s*(?P.+?)' SIZE_PATTERN = r'Velikost:\s*(?P[\d.,]+) (?P[\w^_]+)' OFFLINE_PATTERN = r'' @@ -53,7 +53,7 @@ class QuickshareCz(SimpleHoster): else: self.handle_free(pyfile) - if self.scan_download({'error': re.compile(r"\AChyba!")}, read_size=100): + if self.scan_download({'error': re.compile(r'\AChyba!')}, read_size=100): self.fail(_("File not m or plugin defect")) diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index fc62c4b34..c77e522a8 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -40,8 +40,8 @@ class RapideoPl(MultiHoster): 80: "Too many incorrect login attempts, account blocked for 24h"} - def prepare(self): - super(RapideoPl, self).prepare() + def _prepare(self): + super(RapideoPl, self)._prepare() data = self.account.get_data() diff --git a/module/plugins/hoster/SecureUploadEu.py b/module/plugins/hoster/SecureUploadEu.py index 30b5ac84f..4acce2fcc 100644 --- a/module/plugins/hoster/SecureUploadEu.py +++ b/module/plugins/hoster/SecureUploadEu.py @@ -23,4 +23,4 @@ class SecureUploadEu(XFSHoster): PLUGIN_DOMAIN = "secureupload.eu" - INFO_PATTERN = r'

    Downloading (?P[^<]+) \((?P[^<]+)\)

    ' + INFO_PATTERN = r'

    Downloading (?P.+?) \((?P.+?)\)

    ' diff --git a/module/plugins/hoster/SendspaceCom.py b/module/plugins/hoster/SendspaceCom.py index cff63179e..07553980c 100644 --- a/module/plugins/hoster/SendspaceCom.py +++ b/module/plugins/hoster/SendspaceCom.py @@ -23,7 +23,7 @@ class SendspaceCom(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'

    \s*<(?:b|strong)>(?P[^<]+)\s*<(?:b|strong)>(?P.+?)\s*File Size:\s*(?P[\d.,]+)(?P[\w^_]+)\s*

  • ' OFFLINE_PATTERN = r'
    Sorry, the file you requested is not available.
    ' diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index b579b5e4b..2110ab086 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -104,7 +104,7 @@ class ShareonlineBiz(SimpleHoster): def check_download(self): check = self.scan_download({'cookie': re.compile(r'
    Share-Online")}) + 'fail' : re.compile(r'Share-Online")}) if check == "cookie": self.retry_captcha(5, 60, _("Cookie failure")) @@ -118,7 +118,7 @@ class ShareonlineBiz(SimpleHoster): def handle_premium(self, pyfile): #: Should be working better loading (account) api internally self.api_data = dlinfo = {} - html = self.load("https://api.share-online.biz/account.php", + html = self.load("https://api.share-online.biz/account.php', get={'username': self.account.user, 'password': self.account.get_login('password'), 'act' : "download", @@ -149,7 +149,7 @@ class ShareonlineBiz(SimpleHoster): def check_errors(self): - m = re.search(r"/failure/(.*?)/", self.req.lastEffectiveURL) + m = re.search(r'/failure/(.*?)/', self.req.lastEffectiveURL) if m is None: self.info.pop('error', None) return diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py index 75cd7ecfb..db79dda87 100644 --- a/module/plugins/hoster/ShareplaceCom.py +++ b/module/plugins/hoster/ShareplaceCom.py @@ -84,7 +84,7 @@ class ShareplaceCom(Hoster): if not self.data: self.download_html() - if re.search(r"HTTP Status 404", self.data): + if re.search(r'HTTP Status 404', self.data): return False else: return True diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index 835aa357e..895a88eb5 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -65,7 +65,7 @@ class SimplyPremiumCom(MultiHoster): self.check_errors() try: - self.pyfile.name = re.search(r'<name>([^<]+)</name>', self.data).group(1) + self.pyfile.name = re.search(r'<name>(.+?)</name>', self.data).group(1) except AttributeError: self.pyfile.name = "" @@ -77,7 +77,7 @@ class SimplyPremiumCom(MultiHoster): self.pyfile.size = 0 try: - self.link = re.search(r'<download>([^<]+)</download>', self.data).group(1) + self.link = re.search(r'<download>(.+?)</download>', self.data).group(1) except AttributeError: self.link = 'http://www.simply-premium.com/premium.php?link=' + self.pyfile.url diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py index c2cc1f987..3c5de1b51 100644 --- a/module/plugins/hoster/SmoozedCom.py +++ b/module/plugins/hoster/SmoozedCom.py @@ -49,7 +49,7 @@ class SmoozedCom(MultiHoster): if data['state'] != "ok": self.fail(data['message']) - if data['data'].get("state", "ok") != "ok": + if data['data'].get('state', 'ok') != "ok": if data['data'] == "Offline": self.offline() else: diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index 0921b1878..19a288b22 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -2,7 +2,6 @@ import re -from module.network.RequestFactory import getURL as get_url from module.plugins.internal.Hoster import Hoster diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index d48b73d58..5a71fdba3 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -24,7 +24,7 @@ class UloziskoSk(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<div class="down1">(?P<N>[^<]+)</div>' + NAME_PATTERN = r'<div class="down1">(?P<N>.+?)</div>' SIZE_PATTERN = ur'Veľkosť súboru: <strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong><br />' OFFLINE_PATTERN = ur'<span class = "red">Zadaný súbor neexistuje z jedného z nasledujúcich dôvodov:</span>' diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 63c918da3..c9fe08c1e 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -26,7 +26,7 @@ class UnibytesCom(SimpleHoster): PLUGIN_DOMAIN = "unibytes.com" - INFO_PATTERN = r'<span[^>]*?id="fileName".*?>(?P<N>[^>]+)</span>\s*\((?P<S>\d.*?)\)' + INFO_PATTERN = r'<span[^>]*?id="fileName".*?>(?P<N>.+?)</span>\s*\((?P<S>\d.*?)\)' WAIT_PATTERN = r'Wait for <span id="slowRest">(\d+)</span> sec' LINK_FREE_PATTERN = r'<a href="(.+?)">Download</a>' @@ -42,10 +42,10 @@ class UnibytesCom(SimpleHoster): post=post_data, redirect=False) - m = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) - if m is not None: - self.link = m.group(1) - break + location = self.last_header.get('location') + if location: + self.link = location + return if '>Somebody else is already downloading using your IP-address<' in self.data: self.wait(10 * 60, True) diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index 70ff60eda..ad38af8d9 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -32,7 +32,7 @@ class UploadableCh(SimpleHoster): OFFLINE_PATTERN = r'>(File not available|This file is no longer available)' TEMP_OFFLINE_PATTERN = r'<div class="icon_err">' - WAIT_PATTERN = r'>Please wait.+?<' + WAIT_PATTERN = r'>Please wait[^<]+' RECAPTCHA_KEY = "6LdlJuwSAAAAAPJbPIoUhyqOJd7-yrah5Nhim5S3" diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index 9999b9141..2c81c7eea 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -54,7 +54,7 @@ class VeehdCom(Hoster): if not self.data: self.download_html() - m = re.search(r'<title.*?>([^<]+) on Veehd', self.data) + m = re.search(r'(.+?) on Veehd', self.data) if m is None: self.error(_("Video title not found")) diff --git a/module/plugins/hoster/VidPlayNet.py b/module/plugins/hoster/VidPlayNet.py index df2f1bdab..1af71d634 100644 --- a/module/plugins/hoster/VidPlayNet.py +++ b/module/plugins/hoster/VidPlayNet.py @@ -26,4 +26,4 @@ class VidPlayNet(XFSHoster): PLUGIN_DOMAIN = "vidplay.net" - NAME_PATTERN = r'Password:
    \s*(?P[^<]+)' + NAME_PATTERN = r'Password:
    \s*(?P.+?)' diff --git a/module/plugins/hoster/XDCC.py b/module/plugins/hoster/XDCC.py index 8fdb704d9..405673fa4 100644 --- a/module/plugins/hoster/XDCC.py +++ b/module/plugins/hoster/XDCC.py @@ -187,7 +187,7 @@ class XDCC(Hoster): self.pyfile.name = packname - dl_folder = self.pyload.config.get("general", "download_folder") + dl_folder = self.pyload.config.get('general', 'download_folder') filename = fsjoin(dl_folder, packname) self.log_info(_("Downloading %s from %s:%d") % (packname, ip, port)) diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py index d4b0c343e..a804ad2c6 100644 --- a/module/plugins/hoster/XHamsterCom.py +++ b/module/plugins/hoster/XHamsterCom.py @@ -77,7 +77,7 @@ class XHamsterCom(Hoster): self.error(_("url_mode not found")) if self.desired_fmt == ".mp4": - file_url = re.search(r"([^<]+)(.+?)