From 04038a2cf0c4c2d9cc9a0c8e8bf9beb6426afae8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 10 Jul 2014 03:02:26 +0200 Subject: Use parseError instead PluginParseError + unified all download pattern attributes as LINK_PATTERN + removed some old patterns (not used anymore) + other code cosmetics --- module/plugins/hoster/BasePlugin.py | 1 + module/plugins/hoster/BayfilesCom.py | 4 ++-- module/plugins/hoster/BitshareCom.py | 8 ++++---- module/plugins/hoster/CatShareNet.py | 5 ++++- module/plugins/hoster/CramitIn.py | 2 +- module/plugins/hoster/CrockoCom.py | 3 ++- module/plugins/hoster/CzshareCom.py | 10 ++++++---- module/plugins/hoster/DataHu.py | 4 ++-- module/plugins/hoster/DataportCz.py | 10 ++++++---- module/plugins/hoster/DepositfilesCom.py | 4 ++-- module/plugins/hoster/DlFreeFr.py | 6 +++--- module/plugins/hoster/EasybytezCom.py | 5 ++--- module/plugins/hoster/EdiskCz.py | 9 +++++---- module/plugins/hoster/EgoFilesCom.py | 9 +++++---- module/plugins/hoster/EuroshareEu.py | 1 + module/plugins/hoster/ExtabitCom.py | 6 +++--- module/plugins/hoster/FastshareCz.py | 6 ++++-- module/plugins/hoster/File4safeCom.py | 2 +- module/plugins/hoster/FileParadoxIn.py | 2 +- module/plugins/hoster/FilecloudIo.py | 15 ++++++++------- module/plugins/hoster/FilefactoryCom.py | 4 ++-- module/plugins/hoster/FileomCom.py | 2 +- module/plugins/hoster/FilerNet.py | 9 +++++---- module/plugins/hoster/FilerioCom.py | 2 +- module/plugins/hoster/FileserveCom.py | 6 +++--- module/plugins/hoster/FileshareInUa.py | 2 +- module/plugins/hoster/FilezyNet.py | 2 +- module/plugins/hoster/FourSharedCom.py | 10 ++++++---- module/plugins/hoster/FreevideoCz.py | 6 ++++-- module/plugins/hoster/FshareVn.py | 8 +++++--- module/plugins/hoster/GamefrontCom.py | 2 +- module/plugins/hoster/IFileWs.py | 5 ++--- module/plugins/hoster/IfileIt.py | 4 ++-- module/plugins/hoster/IfolderRu.py | 4 ++-- module/plugins/hoster/JumbofilesCom.py | 8 ++++---- module/plugins/hoster/Keep2shareCC.py | 7 ++++--- module/plugins/hoster/LetitbitNet.py | 20 ++++++++++++-------- module/plugins/hoster/LoadTo.py | 10 ++++++---- module/plugins/hoster/LuckyShareNet.py | 5 +++-- module/plugins/hoster/MediafireCom.py | 4 ++-- module/plugins/hoster/MegasharesCom.py | 12 +++++++----- module/plugins/hoster/MovReelCom.py | 5 +---- module/plugins/hoster/NarodRu.py | 4 ++-- module/plugins/hoster/NosuploadCom.py | 4 ++-- module/plugins/hoster/NovafileCom.py | 2 +- module/plugins/hoster/NowDownloadEu.py | 18 ++++++++++-------- module/plugins/hoster/OboomCom.py | 1 + module/plugins/hoster/OneFichierCom.py | 4 ++-- module/plugins/hoster/PandaPlanet.py | 2 +- module/plugins/hoster/PromptfileCom.py | 4 ++-- module/plugins/hoster/RapidgatorNet.py | 6 +++--- module/plugins/hoster/RarefileNet.py | 2 +- module/plugins/hoster/RemixshareCom.py | 26 ++++++++++++++------------ module/plugins/hoster/RgHostNet.py | 4 ++-- module/plugins/hoster/RyushareCom.py | 2 +- module/plugins/hoster/SecureUploadEu.py | 4 ++-- module/plugins/hoster/SendspaceCom.py | 6 ++++-- module/plugins/hoster/Share4webCom.py | 2 +- module/plugins/hoster/ShareRapidCom.py | 7 ++++--- module/plugins/hoster/StreamcloudEu.py | 6 +++--- module/plugins/hoster/TurbobitNet.py | 13 +++++++------ module/plugins/hoster/TwoSharedCom.py | 6 ++++-- module/plugins/hoster/UlozTo.py | 4 +++- module/plugins/hoster/UloziskoSk.py | 18 ++++++++++-------- module/plugins/hoster/UnibytesCom.py | 12 +++++++----- module/plugins/hoster/UploadedTo.py | 2 +- module/plugins/hoster/UploadheroCom.py | 7 ++++--- module/plugins/hoster/UploadingCom.py | 8 ++++---- module/plugins/hoster/UpstoreNet.py | 6 +++--- module/plugins/hoster/UptoboxCom.py | 2 +- module/plugins/hoster/VidPlayNet.py | 2 +- module/plugins/hoster/XFileSharingPro.py | 22 ++++++++++++---------- module/plugins/hoster/YibaishiwuCom.py | 5 +++-- 73 files changed, 254 insertions(+), 206 deletions(-) (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 970ac8081..68b98e0a7 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -18,6 +18,7 @@ class BasePlugin(Hoster): __author_name__ = "RaNaN" __author_mail__ = "RaNaN@pyload.org" + def setup(self): self.chunkLimit = -1 self.resumeDownload = True diff --git a/module/plugins/hoster/BayfilesCom.py b/module/plugins/hoster/BayfilesCom.py index 82dd11446..28f3c2e92 100644 --- a/module/plugins/hoster/BayfilesCom.py +++ b/module/plugins/hoster/BayfilesCom.py @@ -38,7 +38,7 @@ class BayfilesCom(SimpleHoster): WAIT_PATTERN = r'>Your IP [0-9.]* has recently downloaded a file\. Upgrade to premium or wait (\d+) minutes\.<' VARS_PATTERN = r'var vfid = (\d+);\s*var delay = (\d+);' - LINK_PATTERN = r"javascript:window.location.href = '([^']+)';" + FREE_LINK_PATTERN = r"javascript:window.location.href = '([^']+)';" PREMIUM_LINK_PATTERN = r'(?:We are sorry, but the requested file was not found in our database|>Error - File not available<|The file was deleted either by the uploader, inactivity or due to copyright claim)' FILE_INFO_PATTERN = r'Downloading (?P.+) - (?P[\d.]+) (?P\w+)' FILE_AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' - CAPTCHA_KEY_PATTERN = r"http://api\.recaptcha\.net/challenge\?k=(.*?) " - TRAFFIC_USED_UP = r"Your Traffic is used up for today. Upgrade to premium to continue!" + CAPTCHA_KEY_PATTERN = r'http://api\.recaptcha\.net/challenge\?k=(.*?) ' + TRAFFIC_USED_UP = r'Your Traffic is used up for today. Upgrade to premium to continue!' def setup(self): - self.req.cj.setCookie(self.HOSTER_DOMAIN, "language_selection", "EN") + self.req.cj.setCookie(self.HOSTER_NAME, "language_selection", "EN") self.multiDL = self.premium self.chunkLimit = 1 diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index fa84b7732..406b7bcd4 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -16,9 +16,12 @@ class CatShareNet(SimpleHoster): FILE_INFO_PATTERN = r'

]+>(?P.*)

\s+

]+>(?P.*)

' OFFLINE_PATTERN = r'Podany plik zosta' - SECONDS_PATTERN = 'var\s+count\s+=\s+(\d+);' + + SECONDS_PATTERN = r'var\s+count\s+=\s+(\d+);' + RECAPTCHA_KEY = "6Lfln9kSAAAAANZ9JtHSOgxUPB9qfDFeLUI_QMEy" + def handleFree(self): found = re.search(self.SECONDS_PATTERN, self.html) seconds = int(found.group(1)) diff --git a/module/plugins/hoster/CramitIn.py b/module/plugins/hoster/CramitIn.py index e882f5cea..79ed07e73 100644 --- a/module/plugins/hoster/CramitIn.py +++ b/module/plugins/hoster/CramitIn.py @@ -15,7 +15,7 @@ class CramitIn(XFileSharingPro): HOSTER_NAME = "cramit.in" FILE_INFO_PATTERN = r'\s*(?P.*?).*?\s*\((?P.*?)\)' - DIRECT_LINK_PATTERN = r'href="(http://cramit.in/file_download/.*?)"' + LINK_PATTERN = r'href="(http://cramit.in/file_download/.*?)"' def setup(self): self.resumeDownload = self.multiDL = self.premium diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index 3d7360769..286d5ca2f 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -18,7 +18,7 @@ class CrockoCom(SimpleHoster): FILE_NAME_PATTERN = r'Download:\s*(?P.*)' FILE_SIZE_PATTERN = r'(?P[^<]+)' OFFLINE_PATTERN = r"

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

|File not found" - DOWNLOAD_URL_PATTERN = r"window.location ='([^']+)';" + CAPTCHA_URL_PATTERN = re.compile(r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';") CAPTCHA_KEY_PATTERN = re.compile(r'Recaptcha.create\("([^"]+)"') @@ -27,6 +27,7 @@ class CrockoCom(SimpleHoster): FILE_NAME_REPLACEMENTS = [(r'<[^>]*>', '')] + def handleFree(self): if "You need Premium membership to download this file." in self.html: self.fail("You need Premium membership to download this file.") diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 5fab87157..ba43d8054 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -21,7 +21,7 @@ # http://czshare.com/5278880/random.bin import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo from module.utils import parseFileSize @@ -40,6 +40,7 @@ class CzshareCom(SimpleHoster): FILE_SIZE_REPLACEMENTS = [(' ', '')] FILE_URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://sdilej.cz/\1/x/')] + SH_CHECK_TRAFFIC = True FREE_URL_PATTERN = r'
[^>]*alt="([^"]+)" />' @@ -49,6 +50,7 @@ class CzshareCom(SimpleHoster): MULTIDL_PATTERN = r"

Z[^<]*PROFI.

" USER_CREDIT_PATTERN = r'
\s*kredit: ([0-9., ]+)([kKMG]i?B)\s*
' + def checkTrafficLeft(self): # check if user logged in found = re.search(self.USER_CREDIT_PATTERN, self.html) @@ -90,7 +92,7 @@ class CzshareCom(SimpleHoster): # get free url found = re.search(self.FREE_URL_PATTERN, self.html) if found is None: - raise PluginParseError('Free URL') + self.parseError('Free URL') parsed_url = "http://sdilej.cz" + found.group(1) self.logDebug("PARSED_URL:" + parsed_url) @@ -105,7 +107,7 @@ class CzshareCom(SimpleHoster): self.pyfile.size = int(inputs['size']) except Exception, e: self.logError(e) - raise PluginParseError('Form') + self.parseError('Form') # get and decrypt captcha captcha_url = 'http://sdilej.cz/captcha.php' @@ -129,7 +131,7 @@ class CzshareCom(SimpleHoster): self.logDebug("WAIT URL", self.req.lastEffectiveURL) found = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) if not found: - raise PluginParseError('Download URL') + self.parseError('Download URL') url = "http://%s/download.php?%s" % (found.group(1), found.group(2)) diff --git a/module/plugins/hoster/DataHu.py b/module/plugins/hoster/DataHu.py index 74333d743..9a7af288b 100644 --- a/module/plugins/hoster/DataHu.py +++ b/module/plugins/hoster/DataHu.py @@ -33,13 +33,13 @@ class DataHu(SimpleHoster): FILE_INFO_PATTERN = ur'(?P<N>.*) \((?P<S>[^)]+)\) let\xf6lt\xe9se' OFFLINE_PATTERN = ur'Az adott f\xe1jl nem l\xe9tezik' - DIRECT_LINK_PATTERN = r'
' + LINK_PATTERN = r'
' def handleFree(self): self.resumeDownload = True self.html = self.load(self.pyfile.url, decode=True) - m = re.search(self.DIRECT_LINK_PATTERN, self.html) + m = re.search(self.LINK_PATTERN, self.html) if m: url = m.group(1) self.logDebug('Direct link: ' + url) diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index a5ff05f39..582312b29 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -17,7 +17,7 @@ @author: zoidberg """ -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DataportCz(SimpleHoster): @@ -32,11 +32,13 @@ class DataportCz(SimpleHoster): FILE_NAME_PATTERN = r'(?P[^<]+)' FILE_SIZE_PATTERN = r'Velikost\s*(?P[^<]+)' OFFLINE_PATTERN = r'

Soubor nebyl nalezen

' + FILE_URL_REPLACEMENTS = [(__pattern__, r'http://www.dataport.cz/file/\1')] CAPTCHA_URL_PATTERN = r'
\s*(\d+)
' + def handleFree(self): captchas = {"1": "jkeG", "2": "hMJQ", "3": "vmEK", "4": "ePQM", "5": "blBd"} @@ -44,19 +46,19 @@ class DataportCz(SimpleHoster): action, inputs = self.parseHtmlForm('free_download_form') self.logDebug(action, inputs) if not action or not inputs: - raise PluginParseError('free_download_form') + self.parseError('free_download_form') if "captchaId" in inputs and inputs["captchaId"] in captchas: inputs['captchaCode'] = captchas[inputs["captchaId"]] else: - raise PluginParseError('captcha') + self.parseError('captcha') self.html = self.download("http://www.dataport.cz%s" % action, post=inputs) check = self.checkDownload({"captcha": 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', "slot": 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) if check == "captcha": - raise PluginParseError('invalid captcha') + self.parseError('invalid captcha') elif check == "slot": self.logDebug("No free slots - wait 60s and retry") self.wait(60, False) diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 7b9713861..9089aecff 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -23,7 +23,7 @@ class DepositfilesCom(SimpleHoster): (r'.*")] RECAPTCHA_PATTERN = r"Recaptcha.create\('([^']+)'" - DOWNLOAD_LINK_PATTERN = r'
\s*]*>(?P[^>]*)" - FILE_SIZE_PATTERN = r"Taille:\s*]*>(?P[\d.]+[KMG])o" + FILE_NAME_PATTERN = r'Fichier:\s*]*>(?P[^>]*)' + FILE_SIZE_PATTERN = r'Taille:\s*]*>(?P[\d.]+[KMG])o' OFFLINE_PATTERN = r"Erreur 404 - Document non trouv|Fichier inexistant|Le fichier demandé n'a pas été trouvé" - #FILE_URL_PATTERN = r'href="(?Phttp://.*?)">Télécharger ce fichier' + def setup(self): self.multiDL = self.resumeDownload = True diff --git a/module/plugins/hoster/EasybytezCom.py b/module/plugins/hoster/EasybytezCom.py index 43f823404..9926c80f0 100644 --- a/module/plugins/hoster/EasybytezCom.py +++ b/module/plugins/hoster/EasybytezCom.py @@ -34,9 +34,8 @@ class EasybytezCom(XFileSharingPro): FILE_INFO_PATTERN = r'(?P.+)
\s*(?P[^<]+)' OFFLINE_PATTERN = r'

File not available

' - DIRECT_LINK_PATTERN = r'(http://(\w+\.(easyload|easybytez|zingload)\.(com|to)|\d+\.\d+\.\d+\.\d+)/files/\d+/\w+/[^"<]+)' - OVR_DOWNLOAD_LINK_PATTERN = r'

Download Link

\s*]*>([^<]+)' - OVR_KILL_LINK_PATTERN = r'

Delete Link

\s*]*>([^<]+)' + LINK_PATTERN = r'(http://(\w+\.(easyload|easybytez|zingload)\.(com|to)|\d+\.\d+\.\d+\.\d+)/files/\d+/\w+/[^"<]+)' + OVR_LINK_PATTERN = r'

Download Link

\s*]*>([^<]+)' ERROR_PATTERN = r'(?:class=["\']err["\'][^>]*>|
)(.*?)' FILE_INFO_PATTERN = r'\s*.*?\((?P[0-9.]*) (?P[kKMG])i?B\)' - ACTION_PATTERN = r'/en/download/(\d+/.*\.html)' - DLLINK_PATTERN = r'http://.*edisk.cz.*\.html' OFFLINE_PATTERN = r'

This file does not exist due to one of the following:

  • ' + ACTION_PATTERN = r'/en/download/(\d+/.*\.html)' + LINK_PATTERN = r'http://.*edisk.cz.*\.html' + + def setup(self): self.multiDL = False @@ -58,7 +59,7 @@ class EdiskCz(SimpleHoster): "action": action }) - if not re.match(self.DLLINK_PATTERN, url): + if not re.match(self.LINK_PATTERN, url): self.fail("Unexpected server response") self.download(url) diff --git a/module/plugins/hoster/EgoFilesCom.py b/module/plugins/hoster/EgoFilesCom.py index 000a89901..2a7c3c508 100644 --- a/module/plugins/hoster/EgoFilesCom.py +++ b/module/plugins/hoster/EgoFilesCom.py @@ -35,8 +35,9 @@ class EgoFilesCom(SimpleHoster): FILE_INFO_PATTERN = r'
    \s+(?P[^\t]+)\s+
    \s+(File size|Rozmiar): (?P[\w.]+) (?P\w+) \|' OFFLINE_PATTERN = r'(File size|Rozmiar): 0 KB' WAIT_TIME_PATTERN = r'For next free download you have to wait ((?P\d*)m)? ?((?P\d+)s)?' - DIRECT_LINK_PATTERN = r'Download >' - RECAPTCHA_KEY = '6LeXatQSAAAAAHezcjXyWAni-4t302TeYe7_gfvX' + LINK_PATTERN = r'Download >' + RECAPTCHA_KEY = "6LeXatQSAAAAAHezcjXyWAni-4t302TeYe7_gfvX" + def setup(self): # Set English language @@ -58,14 +59,14 @@ class EgoFilesCom(SimpleHoster): waittime = int(m['m']) * 60 + int(m['s']) self.wait(waittime, True) - downloadURL = '' + downloadURL = r'' recaptcha = ReCaptcha(self) for _ in xrange(5): challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) post_data = {'recaptcha_challenge_field': challenge, 'recaptcha_response_field': response} self.html = self.load(self.pyfile.url, post=post_data, decode=True) - m = re.search(self.DIRECT_LINK_PATTERN, self.html) + m = re.search(self.LINK_PATTERN, self.html) if not m: self.logInfo('Wrong captcha') self.invalidCaptcha() diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index dcfddb367..4ecd97533 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -39,6 +39,7 @@ class EuroshareEu(SimpleHoster): FILE_URL_REPLACEMENTS = [(r"(http://[^/]*\.)(sk|cz|hu|pl)/", r"\1eu/")] + def setup(self): self.multiDL = self.resumeDownload = self.premium self.req.setOption("timeout", 120) diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index c2b5098e9..874eeb824 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -36,9 +36,9 @@ class ExtabitCom(SimpleHoster): FILE_NAME_PATTERN = r'File:\s*\s*
    ' FILE_SIZE_PATTERN = r'Size:\s*(?P[^<]+)' OFFLINE_PATTERN = r'>File not found<' - TEMP_OFFLINE_PATTERN = r">(File is temporary unavailable|No download mirror)<" + TEMP_OFFLINE_PATTERN = r'>(File is temporary unavailable|No download mirror)<' - DOWNLOAD_LINK_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/[a-z0-9]+/.*?)[\'"]' + LINK_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/[a-z0-9]+/.*?)[\'"]' def handleFree(self): if r">Only premium users can download this file" in self.html: @@ -78,7 +78,7 @@ class ExtabitCom(SimpleHoster): self.parseError('JSON') self.html = self.load("http://extabit.com/file/%s%s" % (fileID, response['href'])) - m = re.search(self.DOWNLOAD_LINK_PATTERN, self.html) + m = re.search(self.LINK_PATTERN, self.html) if not m: self.parseError('Download URL') url = m.group(1) diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 996dea2f5..c7008ccd0 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -35,14 +35,16 @@ class FastshareCz(SimpleHoster): __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it", "vuolter@gmail.com") FILE_INFO_PATTERN = r'

    (?P[^<]+)

    \s*
    \s*Size\s*: (?P\d+) (?P\w+),' - OFFLINE_PATTERN = '>(The file has been deleted|Requested page not found)' + OFFLINE_PATTERN = r'>(The file has been deleted|Requested page not found)' FILE_URL_REPLACEMENTS = [("#.*", "")] + SH_COOKIES = [(".fastshare.cz", "lang", "en")] FREE_URL_PATTERN = r'action=(/free/.*?)>\s* 100% of FREE slots are full" in self.html: diff --git a/module/plugins/hoster/File4safeCom.py b/module/plugins/hoster/File4safeCom.py index 9e06972e2..da63316ad 100644 --- a/module/plugins/hoster/File4safeCom.py +++ b/module/plugins/hoster/File4safeCom.py @@ -26,7 +26,7 @@ class File4safeCom(XFileSharingPro): self.req.http.c.setopt(FOLLOWLOCATION, 1) found = re.search(r"Location\s*:\s*(.*)", self.header, re.I) - if found and re.match(self.DIRECT_LINK_PATTERN, found.group(1)): + if found and re.match(self.LINK_PATTERN, found.group(1)): location = found.group(1).strip() self.startDownload(location) else: diff --git a/module/plugins/hoster/FileParadoxIn.py b/module/plugins/hoster/FileParadoxIn.py index b3b89575e..6234c36df 100644 --- a/module/plugins/hoster/FileParadoxIn.py +++ b/module/plugins/hoster/FileParadoxIn.py @@ -17,7 +17,7 @@ class FileParadoxIn(XFileSharingPro): HOSTER_NAME = "fileparadox.in" FILE_SIZE_PATTERN = r'\s*\(\s*(?P[^)]+)\s*\)' - DIRECT_LINK_PATTERN = r'(http://([^/]*?fileparadox.in|\d+\.\d+\.\d+\.\d+)(:\d+/d/|/files/\w+/\w+/)[^"\'<]+)' + LINK_PATTERN = r'(http://([^/]*?fileparadox.in|\d+\.\d+\.\d+\.\d+)(:\d+/d/|/files/\w+/\w+/)[^"\'<]+)' getInfo = create_getInfo(FileParadoxIn) diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 4977742af..5b9d86007 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -18,7 +18,7 @@ """ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo from module.common.json_layer import json_loads from module.plugins.internal.CaptchaService import ReCaptcha @@ -39,10 +39,11 @@ class FilecloudIo(SimpleHoster): UKEY_PATTERN = r"'ukey'\s*:'(\w+)'," AB1_PATTERN = r"if\( __ab1 == '(\w+)' \)" - ERROR_MSG_PATTERN = r"var __error_msg\s*=\s*l10n\.(.*?);" - DOWNLOAD_LINK_PATTERN = r'"(http://s\d+.filecloud.io/%s/\d+/.*?)"' + ERROR_MSG_PATTERN = r'var __error_msg\s*=\s*l10n\.(.*?);' + LINK_PATTERN = r'"(http://s\d+.filecloud.io/%s/\d+/.*?)"' RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';" - RECAPTCHA_KEY = '6Lf5OdISAAAAAEZObLcx5Wlv4daMaASRov1ysDB1' + RECAPTCHA_KEY = "6Lf5OdISAAAAAEZObLcx5Wlv4daMaASRov1ysDB1" + def setup(self): self.resumeDownload = self.multiDL = True @@ -53,7 +54,7 @@ class FilecloudIo(SimpleHoster): found = re.search(self.AB1_PATTERN, self.html) if not found: - raise PluginParseError("__AB1") + self.parseError("__AB1") data["__ab1"] = found.group(1) if not self.account: @@ -99,9 +100,9 @@ class FilecloudIo(SimpleHoster): if response["dl"]: self.html = self.load('http://filecloud.io/download.html') - found = re.search(self.DOWNLOAD_LINK_PATTERN % self.file_info['ID'], self.html) + found = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) if not found: - raise PluginParseError("Download URL") + self.parseError("Download URL") download_url = found.group(1) self.logDebug("Download URL: %s" % download_url) diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index d6a15b0ea..bcef5a5db 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -41,7 +41,7 @@ class FilefactoryCom(SimpleHoster): __author_mail__ = "l.stickell@yahoo.it" FILE_INFO_PATTERN = r'
    ]*>\s*

    (?P[^<]+)

    \s*
    \s*(?P[\d.]+) (?P\w+) uploaded' - DIRECT_LINK_PATTERN = r']*>]*> Download with FileFactory Premium' + LINK_PATTERN = r']*>]*> Download with FileFactory Premium' OFFLINE_PATTERN = r'

    File Removed

    |This file is no longer available' PREMIUM_ONLY_PATTERN = r'>Premium Account Required<' SH_COOKIES = [('.filefactory.com', 'locale', 'en_US.utf8')] @@ -106,7 +106,7 @@ class FilefactoryCom(SimpleHoster): else: self.logInfo('You could enable "Direct Downloads" on http://filefactory.com/account/') html = self.load(self.pyfile.url) - found = re.search(self.DIRECT_LINK_PATTERN, html) + found = re.search(self.LINK_PATTERN, html) if found: url = found.group(1) else: diff --git a/module/plugins/hoster/FileomCom.py b/module/plugins/hoster/FileomCom.py index 9fda2353c..70975e6d9 100644 --- a/module/plugins/hoster/FileomCom.py +++ b/module/plugins/hoster/FileomCom.py @@ -41,7 +41,7 @@ class FileomCom(XFileSharingPro): ERROR_PATTERN = r'class=["\']err["\'][^>]*>(.*?)(?:\'|Free Download (?P\S+) (?P[\w.]+) (?P\w+)' OFFLINE_PATTERN = r'Nicht gefunden' - RECAPTCHA_KEY = '6LcFctISAAAAAAgaeHgyqhNecGJJRnxV1m_vAz3V' - DIRECT_LINK_PATTERN = r'href="([^"]+)">Get download' + RECAPTCHA_KEY = "6LcFctISAAAAAAgaeHgyqhNecGJJRnxV1m_vAz3V" + LINK_PATTERN = r'href="([^"]+)">Get download' + def process(self, pyfile): if self.premium and (not self.SH_CHECK_TRAFFIC or self.checkTrafficLeft()): @@ -74,7 +75,7 @@ class FilerNet(SimpleHoster): hash_data = inputs['hash'] self.logDebug('Hash: ' + hash_data) - downloadURL = '' + downloadURL = r'' recaptcha = ReCaptcha(self) for _ in xrange(5): challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) @@ -107,7 +108,7 @@ class FilerNet(SimpleHoster): dl = self.pyfile.url else: # Direct Download OFF html = self.load(self.pyfile.url) - m = re.search(self.DIRECT_LINK_PATTERN, html) + m = re.search(self.LINK_PATTERN, html) if not m: self.parseError("Unable to detect direct link, try to enable 'Direct download' in your user settings") dl = 'http://filer.net' + m.group(1) diff --git a/module/plugins/hoster/FilerioCom.py b/module/plugins/hoster/FilerioCom.py index 1c6c375f6..72c8c6c1c 100644 --- a/module/plugins/hoster/FilerioCom.py +++ b/module/plugins/hoster/FilerioCom.py @@ -14,7 +14,7 @@ class FilerioCom(XFileSharingPro): HOSTER_NAME = "filerio.in" - OFFLINE_PATTERN = '"File Not Found"|File has been removed due to Copyright Claim' + OFFLINE_PATTERN = r'"File Not Found"|File has been removed due to Copyright Claim' FILE_URL_REPLACEMENTS = [(r'http://.*?/', 'http://filerio.in/')] def setup(self): diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index f6e102f08..ebb6204c3 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -62,9 +62,9 @@ class FileserveCom(Hoster): CAPTCHA_KEY_PATTERN = r"var reCAPTCHA_publickey='(?P[^']+)'" LONG_WAIT_PATTERN = r'
  • You need to wait (\d+) (\w+) to start another download\.
  • ' - LINK_EXPIRED_PATTERN = "Your download link has expired" - DAILY_LIMIT_PATTERN = "Your daily download limit has been reached" - NOT_LOGGED_IN_PATTERN = 'Login' + LINK_EXPIRED_PATTERN = r'Your download link has expired' + DAILY_LIMIT_PATTERN = r'Your daily download limit has been reached' + NOT_LOGGED_IN_PATTERN = r'Login' # shares code with FilejungleCom and UploadstationCom diff --git a/module/plugins/hoster/FileshareInUa.py b/module/plugins/hoster/FileshareInUa.py index db2b1a998..4ec33485e 100644 --- a/module/plugins/hoster/FileshareInUa.py +++ b/module/plugins/hoster/FileshareInUa.py @@ -17,7 +17,7 @@ class FileshareInUa(Hoster): PATTERN_FILENAME = r'

    (.*?)

    ' PATTERN_FILESIZE = r'(.*?)' - PATTERN_OFFLINE = "This file doesn't exist, or has been removed." + PATTERN_OFFLINE = r"This file doesn't exist, or has been removed." def setup(self): self.resumeDownload = self.multiDL = True diff --git a/module/plugins/hoster/FilezyNet.py b/module/plugins/hoster/FilezyNet.py index cd0902ab3..c9d603939 100644 --- a/module/plugins/hoster/FilezyNet.py +++ b/module/plugins/hoster/FilezyNet.py @@ -29,7 +29,7 @@ class FilezyNet(XFileSharingPro): obfuscated_js = re.search(self.DOWNLOAD_JS_PATTERN, self.html) dl_file_now = self.js.eval(obfuscated_js.group(1)) - link = re.search(self.DIRECT_LINK_PATTERN, dl_file_now) + link = re.search(self.LINK_PATTERN, dl_file_now) return link.group(1) diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py index 9b8b3b1f0..93d784d63 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -15,14 +15,16 @@ class FourSharedCom(SimpleHoster): __author_mail__ = ("jeix@hasnomail.de", "zoidberg@mujmail.cz") FILE_NAME_PATTERN = r'' + OFFLINE_PATTERN = r'The file link that you requested is not valid\.|This file was deleted.' + FILE_NAME_REPLACEMENTS = [(r"&#(\d+).", lambda m: unichr(int(m.group(1))))] FILE_SIZE_REPLACEMENTS = [(",", "")] - DOWNLOAD_BUTTON_PATTERN = 'id="btnLink" href="(.*?)"' - FID_PATTERN = 'name="d3fid" value="(.*?)"' DOWNLOAD_URL_PATTERN = r'name="d3link" value="(.*?)"' + DOWNLOAD_BUTTON_PATTERN = r'id="btnLink" href="(.*?)"' + FID_PATTERN = r'name="d3fid" value="(.*?)"' + def handleFree(self): if not self.account: diff --git a/module/plugins/hoster/FreevideoCz.py b/module/plugins/hoster/FreevideoCz.py index 21948a83d..175d317be 100644 --- a/module/plugins/hoster/FreevideoCz.py +++ b/module/plugins/hoster/FreevideoCz.py @@ -45,9 +45,11 @@ class FreevideoCz(Hoster): __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" - URL_PATTERN = r'clip: {\s*url: "([^"]+)"' OFFLINE_PATTERN = r'

    Str.nka nebyla nalezena

    ' + LINK_PATTERN = r'clip: {\s*url: "([^"]+)"' + + def setup(self): self.multiDL = self.resumeDownload = True @@ -58,7 +60,7 @@ class FreevideoCz(Hoster): if re.search(self.OFFLINE_PATTERN, self.html): self.offline() - found = re.search(self.URL_PATTERN, self.html) + found = re.search(self.LINK_PATTERN, self.html) if found is None: self.fail("Parse error (URL)") download_url = found.group(1) diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 63cc69161..75b37b4c3 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -34,11 +34,13 @@ class FshareVn(SimpleHoster): FILE_INFO_PATTERN = r'

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

    (?P[0-9,.]+)\s*(?P[kKMG])i?B<\\/p>' OFFLINE_PATTERN = r'

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

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

    0 KB<\\/p>' + FILE_NAME_REPLACEMENTS = [("(.*)", doubleDecode)] - DOWNLOAD_URL_PATTERN = r'action="(http://download.*?)[#"]' - VIP_URL_PATTERN = r'' + + LINK_PATTERN = r'action="(http://download.*?)[#"]' WAIT_PATTERN = ur'Lượt tải xuống kế tiếp là:\s*(.*?)\s*<' + def process(self, pyfile): self.html = self.load('http://www.fshare.vn/check_link.php', post={ "action": "check_link", @@ -79,7 +81,7 @@ class FshareVn(SimpleHoster): found = re.search(r'var count = (\d+)', self.html) self.setWait(int(found.group(1)) if found else 30) - found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) + found = re.search(self.LINK_PATTERN, self.html) if not found: self.parseError('FREE DL URL') self.url = found.group(1) diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index 0cd54d2ea..941aa2d50 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -17,7 +17,7 @@ class GamefrontCom(Hoster): PATTERN_FILENAME = r'(.*?) | Game Front' PATTERN_FILESIZE = r'<dt>File Size:</dt>[\n\s]*<dd>(.*?)</dd>' - PATTERN_OFFLINE = "This file doesn't exist, or has been removed." + PATTERN_OFFLINE = r"This file doesn't exist, or has been removed." def setup(self): self.resumeDownload = self.multiDL = True diff --git a/module/plugins/hoster/IFileWs.py b/module/plugins/hoster/IFileWs.py index 6f7fe8388..35b3544a1 100644 --- a/module/plugins/hoster/IFileWs.py +++ b/module/plugins/hoster/IFileWs.py @@ -14,9 +14,8 @@ class IFileWs(XFileSharingPro): HOSTER_NAME = "ifile.ws" - FILE_INFO_PATTERN = '<h1\s+style="display:inline;">(?P<N>[^<]+)</h1>\s+\[(?P<S>[^]]+)\]' - OFFLINE_PATTERN = 'File Not Found|The file was removed by administrator' - LONG_WAIT_PATTERN = "(?P<M>\d(?=\s+minutes)).*(?P<S>\d+(?=\s+seconds))" + FILE_INFO_PATTERN = r'<h1\s+style="display:inline;">(?P<N>[^<]+)</h1>\s+\[(?P<S>[^]]+)\]' + OFFLINE_PATTERN = r'File Not Found|The file was removed by administrator' getInfo = create_getInfo(IFileWs) diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py index 64dac7d13..41c0cd5cc 100644 --- a/module/plugins/hoster/IfileIt.py +++ b/module/plugins/hoster/IfileIt.py @@ -33,8 +33,8 @@ class IfileIt(SimpleHoster): __author_mail__ = "zoidberg@mujmail.cz" #EVAL_PATTERN = r'(eval\(function\(p,a,c,k,e,d\).*)' - #DEC_PATTERN = r"requestBtn_clickEvent[^}]*url:\s*([^,]+)" - DOWNLOAD_LINK_PATTERN = r'</span> If it doesn\'t, <a target="_blank" href="([^"]+)">' + #DEC_PATTERN = r'requestBtn_clickEvent[^}]*url:\s*([^,]+)' + LINK_PATTERN = r'</span> If it doesn\'t, <a target="_blank" href="([^"]+)">' RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';" FILE_INFO_PATTERN = r'<span style="cursor: default;[^>]*>\s*(?P<N>.*?)\s* \s*<strong>\s*(?P<S>[0-9.]+)\s*(?P<U>[kKMG])i?B\s*</strong>\s*</span>' OFFLINE_PATTERN = r'<span style="cursor: default;[^>]*>\s* \s*<strong>\s*</strong>\s*</span>' diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index ca38ca418..b5c0e7c62 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -38,7 +38,7 @@ class IfolderRu(SimpleHoster): SESSION_ID_PATTERN = r'<a href=(http://ints.(?:rusfolder.com|ifolder.ru)/ints/sponsor/\?bi=\d*&session=([^&]+)&u=[^>]+)>' INTS_SESSION_PATTERN = r'\(\'ints_session\'\);\s*if\(tag\)\{tag.value = "([^"]+)";\}' HIDDEN_INPUT_PATTERN = r"var v = .*?name='([^']+)' value='1'" - DOWNLOAD_LINK_PATTERN = r'<a id="download_file_href" href="([^"]+)"' + LINK_PATTERN = r'<a id="download_file_href" href="([^"]+)"' WRONG_CAPTCHA_PATTERN = ur'<font color=Red>неверный код,<br>введите еще раз</font><br>' def setup(self): @@ -79,7 +79,7 @@ class IfolderRu(SimpleHoster): else: self.fail("Invalid captcha") - download_url = re.search(self.DOWNLOAD_LINK_PATTERN, self.html).group(1) + download_url = re.search(self.LINK_PATTERN, self.html).group(1) self.correctCaptcha() self.logDebug("Download URL: %s" % download_url) self.download(download_url) diff --git a/module/plugins/hoster/JumbofilesCom.py b/module/plugins/hoster/JumbofilesCom.py index 55d179b4e..ad648dacf 100644 --- a/module/plugins/hoster/JumbofilesCom.py +++ b/module/plugins/hoster/JumbofilesCom.py @@ -13,9 +13,9 @@ class JumbofilesCom(SimpleHoster): __author_name__ = "godofdream" __author_mail__ = "soilfiction@gmail.com" - FILE_INFO_PATTERN = '<TR><TD>(?P<N>[^<]+?)\s*<small>\((?P<S>[\d.]+)\s*(?P<U>[KMG][bB])\)</small></TD></TR>' - OFFLINE_PATTERN = 'Not Found or Deleted / Disabled due to inactivity or DMCA' - DIRECT_LINK_PATTERN = '<meta http-equiv="refresh" content="10;url=(.+)">' + FILE_INFO_PATTERN = r'<TR><TD>(?P<N>[^<]+?)\s*<small>\((?P<S>[\d.]+)\s*(?P<U>[KMG][bB])\)</small></TD></TR>' + OFFLINE_PATTERN = r'Not Found or Deleted / Disabled due to inactivity or DMCA' + LINK_PATTERN = r'<meta http-equiv="refresh" content="10;url=(.+)">' def setup(self): self.resumeDownload = self.multiDL = True @@ -24,7 +24,7 @@ class JumbofilesCom(SimpleHoster): ukey = re.match(self.__pattern__, self.pyfile.url).group(1) post_data = {"id": ukey, "op": "download3", "rand": ""} html = self.load(self.pyfile.url, post=post_data, decode=True) - url = re.search(self.DIRECT_LINK_PATTERN, html).group(1) + url = re.search(self.LINK_PATTERN, html).group(1) self.logDebug("Download " + url) self.download(url) diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py index e9f294087..74dc05b89 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -37,11 +37,12 @@ class Keep2shareCC(SimpleHoster): FILE_SIZE_PATTERN = r'Size: (?P<S>[^<]+)</div>' OFFLINE_PATTERN = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404' - DIRECT_LINK_PATTERN = r'To download this file with slow speed, use <a href="([^"]+)">this link</a>' + LINK_PATTERN = r'To download this file with slow speed, use <a href="([^"]+)">this link</a>' WAIT_PATTERN = r'Please wait ([\d:]+) to download this file' ALREADY_DOWNLOADING_PATTERN = r'Free account does not allow to download more than one file at the same time' - RECAPTCHA_KEY = '6LcYcN0SAAAAABtMlxKj7X0hRxOY8_2U86kI1vbb' + RECAPTCHA_KEY = "6LcYcN0SAAAAABtMlxKj7X0hRxOY8_2U86kI1vbb" + def handleFree(self): self.sanitize_url() @@ -76,7 +77,7 @@ class Keep2shareCC(SimpleHoster): self.wait(30 * 60, reconnect=True) self.retry() - m = re.search(self.DIRECT_LINK_PATTERN, self.html) + m = re.search(self.LINK_PATTERN, self.html) if not m: self.parseError("Unable to detect direct link") self.startDownload(m.group(1)) diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 62743d468..3814cfd9b 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -56,14 +56,16 @@ class LetitbitNet(SimpleHoster): __author_name__ = ("zoidberg", "z00nx") __author_mail__ = ("zoidberg@mujmail.cz", "z00nx0@gmail.com") - CHECK_URL_PATTERN = r"ajax_check_url\s*=\s*'((http://[^/]+)[^']+)';" - SECONDS_PATTERN = r"seconds\s*=\s*(\d+);" - CAPTCHA_CONTROL_FIELD = r"recaptcha_control_field\s=\s'(?P<value>[^']+)'" - - DOMAIN = "http://letitbit.net" FILE_URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "letitbit.net")] + + HOSTER_NAME = "letitbit.net" + + #CHECK_URL_PATTERN = r"ajax_check_url\s*=\s*'((http://[^/]+)[^']+)';" + SECONDS_PATTERN = r'seconds\s*=\s*(\d+);' + CAPTCHA_CONTROL_FIELD = r"recaptcha_control_field\s=\s'(?P<value>[^']+)'" RECAPTCHA_KEY = "6Lc9zdMSAAAAAF-7s2wuQ-036pLRbM0p8dDaQdAM" + def setup(self): self.resumeDownload = True #TODO confirm that resume works @@ -81,11 +83,13 @@ class LetitbitNet(SimpleHoster): action, inputs = self.parseHtmlForm('id="ifree_form"') if not action: self.parseError("page 1 / ifree_form") + + domain = "http://www." + self.HOSTER_NAME self.pyfile.size = float(inputs['sssize']) self.logDebug(action, inputs) inputs['desc'] = "" - self.html = self.load(self.DOMAIN + action, post=inputs, cookies=True) + 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") @@ -110,7 +114,7 @@ class LetitbitNet(SimpleHoster): self.logDebug("ReCaptcha control field found", recaptcha_control_field) self.wait(seconds + 1) - response = self.load("%s/ajax/download3.php" % self.DOMAIN, post=" ", cookies=True) + response = self.load("%s/ajax/download3.php" % domain, post=" ", cookies=True) if response != '1': self.parseError('Unknown response - ajax_check_url') self.logDebug(response) @@ -120,7 +124,7 @@ class LetitbitNet(SimpleHoster): post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, "recaptcha_control_field": recaptcha_control_field} self.logDebug("Post data to send", post_data) - response = self.load('%s/ajax/check_recaptcha.php' % self.DOMAIN, post=post_data, cookies=True) + response = self.load('%s/ajax/check_recaptcha.php' % domain, post=post_data, cookies=True) self.logDebug(response) if not response: self.invalidCaptcha() diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py index 5daf1b8e3..b5f0e4109 100644 --- a/module/plugins/hoster/LoadTo.py +++ b/module/plugins/hoster/LoadTo.py @@ -35,11 +35,13 @@ class LoadTo(SimpleHoster): FILE_INFO_PATTERN = r'<head><title>(?P<N>.+) \/\/ Load.to' FILE_SIZE_PATTERN = r']+>(?P.+)\s*Size: (?P.*) (?P[kKmMgG]?i?[bB])' - URL_PATTERN = r'404 Not Found")}) if check == "404": self.logWarning("The captcha you entered was incorrect. Please try again.") diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index b5327d175..9479f583e 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -17,8 +17,9 @@ class LuckyShareNet(SimpleHoster): __author_mail__ = "l.stickell@yahoo.it" FILE_INFO_PATTERN = r"

    (?P\S+)

    \s*Filesize: (?P[\d.]+)(?P\w+)" - OFFLINE_PATTERN = 'There is no such file available' - RECAPTCHA_KEY = '6LdivsgSAAAAANWh-d7rPE1mus4yVWuSQIJKIYNw' + OFFLINE_PATTERN = r'There is no such file available' + RECAPTCHA_KEY = "6LdivsgSAAAAANWh-d7rPE1mus4yVWuSQIJKIYNw" + def parseJson(self, rep): if 'AJAX Error' in rep: diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index 60c7d7bb5..0348b9c6d 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -69,7 +69,7 @@ class MediafireCom(SimpleHoster): __author_name__ = ("zoidberg", "stickell") __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") - DOWNLOAD_LINK_PATTERN = r'
    ' OFFLINE_PATTERN = r'
    Sorry, the file you requested is not available.
    ' + + LINK_PATTERN = r'
    ' USER_CAPTCHA_PATTERN = r'' + def handleFree(self): params = {} for _ in xrange(3): - found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) + found = re.search(self.LINK_PATTERN, self.html) if found: if 'captcha_hash' in params: self.correctCaptcha() diff --git a/module/plugins/hoster/Share4webCom.py b/module/plugins/hoster/Share4webCom.py index e25216cb8..01935ee72 100644 --- a/module/plugins/hoster/Share4webCom.py +++ b/module/plugins/hoster/Share4webCom.py @@ -13,7 +13,7 @@ class Share4webCom(UnibytesCom): __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" - DOMAIN = 'http://www.share4web.com' + HOSTER_NAME = "share4web.com" getInfo = create_getInfo(UnibytesCom) diff --git a/module/plugins/hoster/ShareRapidCom.py b/module/plugins/hoster/ShareRapidCom.py index aca7e995b..dad75ae74 100644 --- a/module/plugins/hoster/ShareRapidCom.py +++ b/module/plugins/hoster/ShareRapidCom.py @@ -32,11 +32,12 @@ class ShareRapidCom(SimpleHoster): FILE_SIZE_PATTERN = r'Velikost:\s*\s*(?P[0-9.]+) (?P[kKMG])i?B' OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán' - DOWNLOAD_URL_PATTERN = r'([^<]+)' + FILE_URL_REPLACEMENTS = [(__pattern__, r'http://share-rapid.com/stahuj/\g')] + + LINK_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áš' - FILE_URL_REPLACEMENTS = [(__pattern__, r'http://share-rapid.com/stahuj/\g')] def setup(self): self.chunkLimit = 1 @@ -54,7 +55,7 @@ class ShareRapidCom(SimpleHoster): self.getFileInfo() - found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) + found = re.search(self.LINK_PATTERN, self.html) if found: link = found.group(1) self.logDebug("Premium link: %s" % link) diff --git a/module/plugins/hoster/StreamcloudEu.py b/module/plugins/hoster/StreamcloudEu.py index 388eb7876..849f3797a 100644 --- a/module/plugins/hoster/StreamcloudEu.py +++ b/module/plugins/hoster/StreamcloudEu.py @@ -18,14 +18,14 @@ class StreamcloudEu(XFileSharingPro): HOSTER_NAME = "streamcloud.eu" - DIRECT_LINK_PATTERN = r'file: "(http://(stor|cdn)\d+\.streamcloud.eu:?\d*/.*/video\.(mp4|flv))",' + LINK_PATTERN = r'file: "(http://(stor|cdn)\d+\.streamcloud.eu:?\d*/.*/video\.(mp4|flv))",' def setup(self): super(StreamcloudEu, self).setup() self.multiDL = True def getDownloadLink(self): - found = re.search(self.DIRECT_LINK_PATTERN, self.html, re.S) + found = re.search(self.LINK_PATTERN, self.html, re.S) if found: return found.group(1) @@ -42,7 +42,7 @@ class StreamcloudEu(XFileSharingPro): if found: break - found = re.search(self.DIRECT_LINK_PATTERN, self.html, re.S) + found = re.search(self.LINK_PATTERN, self.html, re.S) if found: break diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index af9cdc59f..34b449f7c 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -42,19 +42,20 @@ class TurbobitNet(SimpleHoster): __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" - # long filenames are shortened - FILE_INFO_PATTERN = r"\w+).*", "http://turbobit.net/\g.html")] SH_COOKIES = [("turbobit.net", "user_lang", "en")] - CAPTCHA_KEY_PATTERN = r'src="http://api\.recaptcha\.net/challenge\?k=([^"]+)"' - DOWNLOAD_URL_PATTERN = r'(?P/download/redirect/[^"\']+)' + LINK_PATTERN = r'(?P/download/redirect/[^"\']+)' LIMIT_WAIT_PATTERN = r'
    \s*.*?(\d+)' + CAPTCHA_KEY_PATTERN = r'src="http://api\.recaptcha\.net/challenge\?k=([^"]+)"' CAPTCHA_SRC_PATTERN = r'Captcha(?P.*)' FILE_SIZE_PATTERN = r'File size:\s*(?P[0-9,.]+) (?P[kKMG])i?B' OFFLINE_PATTERN = r'The file link that you requested is not valid\.|This file was deleted\.' - DOWNLOAD_URL_PATTERN = r"window.location ='([^']+)';" + + LINK_PATTERN = r"window.location ='([^']+)';" + def setup(self): self.resumeDownload = self.multiDL = True def handleFree(self): - found = re.search(self.DOWNLOAD_URL_PATTERN, self.html) + found = re.search(self.LINK_PATTERN, self.html) if not found: self.parseError('Download link') link = found.group(1) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index d540505f1..0366c6db4 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -36,10 +36,11 @@ class UlozTo(SimpleHoster): __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" + FILE_INFO_PATTERN = r'

    File (?P[^<]+) is password protected

    ' FILE_NAME_PATTERN = r'(?P<N>[^<]+) \| Uloz.to' FILE_SIZE_PATTERN = r'.*?(?P[0-9.]+\s[kMG]?B)' - FILE_INFO_PATTERN = r'

    File (?P[^<]+) is password protected

    ' OFFLINE_PATTERN = r'404 - Page not found|

    File (has been deleted|was banned)

    ' + FILE_SIZE_REPLACEMENTS = [('([0-9.]+)\s([kMG])B', convertDecimalPrefix)] FILE_URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "www.ulozto.net")] @@ -50,6 +51,7 @@ class UlozTo(SimpleHoster): PREMIUM_URL_PATTERN = r'
    ' + def setup(self): self.multiDL = self.premium self.resumeDownload = True diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index 259f415ca..2778efa6b 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -18,7 +18,7 @@ """ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UloziskoSk(SimpleHoster): @@ -30,14 +30,16 @@ class UloziskoSk(SimpleHoster): __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" - URL_PATTERN = r'' - ID_PATTERN = r'' FILE_NAME_PATTERN = r'
    (?P[^<]+)
    ' FILE_SIZE_PATTERN = ur'Veľkosť súboru: (?P[0-9.]+) (?P[kKMG])i?B
    ' - CAPTCHA_PATTERN = r'' OFFLINE_PATTERN = ur'Zadaný súbor neexistuje z jedného z nasledujúcich dôvodov:' + + LINK_PATTERN = r'' + ID_PATTERN = r'' + CAPTCHA_PATTERN = r'' IMG_PATTERN = ur'PRE ZVÄČŠENIE KLIKNITE NA OBRÁZOK
    ' + def process(self, pyfile): self.html = self.load(pyfile.url, decode=True) self.getFileInfo() @@ -50,21 +52,21 @@ class UloziskoSk(SimpleHoster): self.handleFree() def handleFree(self): - found = re.search(self.URL_PATTERN, self.html) + found = re.search(self.LINK_PATTERN, self.html) if found is None: - raise PluginParseError('URL') + self.parseError('URL') parsed_url = 'http://www.ulozisko.sk' + found.group(1) found = re.search(self.ID_PATTERN, self.html) if found is None: - raise PluginParseError('ID') + 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: - raise PluginParseError('CAPTCHA') + self.parseError('CAPTCHA') captcha_url = 'http://www.ulozisko.sk' + found.group(1) captcha = self.decryptCaptcha(captcha_url, cookies=True) diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 1a64146c4..a90b75439 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -32,18 +32,20 @@ class UnibytesCom(SimpleHoster): __author_mail__ = "zoidberg@mujmail.cz" FILE_INFO_PATTERN = r']*?id="fileName"[^>]*>(?P[^>]+)\s*\((?P\d.*?)\)' - DOMAIN = 'http://www.unibytes.com' + HOSTER_NAME = "unibytes.com" WAIT_PATTERN = r'Wait for (\d+) sec' - DOWNLOAD_LINK_PATTERN = r'Download' + LINK_PATTERN = r'Download' + def handleFree(self): + domain = "http://www." + self.HOSTER_NAME action, post_data = self.parseHtmlForm('id="startForm"') self.req.http.c.setopt(FOLLOWLOCATION, 0) for _ in xrange(8): self.logDebug(action, post_data) - self.html = self.load(self.DOMAIN + action, post=post_data) + self.html = self.load(domain + action, post=post_data) found = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) if found: @@ -55,7 +57,7 @@ class UnibytesCom(SimpleHoster): self.retry() if post_data['step'] == 'last': - found = re.search(self.DOWNLOAD_LINK_PATTERN, self.html) + found = re.search(self.LINK_PATTERN, self.html) if found: url = found.group(1) self.correctCaptcha() @@ -70,7 +72,7 @@ class UnibytesCom(SimpleHoster): 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'): - post_data['captcha'] = self.decryptCaptcha(self.DOMAIN + '/captcha.jpg') + post_data['captcha'] = self.decryptCaptcha(domain + '/captcha.jpg') else: self.fail("No valid captcha code entered") diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 109ad0f1c..4cf8b35b5 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -97,7 +97,7 @@ class UploadedTo(Hoster): FILE_INFO_PATTERN = r'(?P[^<]+)  \s*]*>(?P[^<]+)
    ' OFFLINE_PATTERN = r'Error: 404' - DL_LIMIT_PATTERN = "You have reached the max. number of possible free downloads for this hour" + DL_LIMIT_PATTERN = r'You have reached the max. number of possible free downloads for this hour' def setup(self): self.multiDL = self.resumeDownload = self.premium diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py index 11536028a..39797a5f3 100644 --- a/module/plugins/hoster/UploadheroCom.py +++ b/module/plugins/hoster/UploadheroCom.py @@ -33,18 +33,19 @@ class UploadheroCom(SimpleHoster): __author_name__ = ("mcmyst", "zoidberg") __author_mail__ = ("mcmyst@hotmail.fr", "zoidberg@mujmail.cz") - SH_COOKIES = [("http://uploadhero.co", "lang", "en")] FILE_NAME_PATTERN = r'
    (?P.*?)
    ' FILE_SIZE_PATTERN = r'Taille du fichier : (?P.*?)' OFFLINE_PATTERN = r'

    |

    \s*\n

    (?P.*?)

    \s*\n
    \s*(?P[^<]+)' - DIRECT_LINK_PATTERN = r'(http://([^/]*?%s|\d+\.\d+\.\d+\.\d+)(:\d+)?(/d/|(?:/files)?/\d+/\w+/)[^"\'<&]+)' % HOSTER_NAME + LINK_PATTERN = r'(http://([^/]*?%s|\d+\.\d+\.\d+\.\d+)(:\d+)?(/d/|(?:/files)?/\d+/\w+/)[^"\'<&]+)' % HOSTER_NAME getInfo = create_getInfo(VidPlayNet) diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 162d0d8a8..fb6a912fa 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -42,21 +42,23 @@ class XFileSharingPro(SimpleHoster): __author_name__ = ("zoidberg", "stickell") __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it") + FILE_INFO_PATTERN = r'Filename:(?P[^<]+)\s*.*?\((?P[^<]+)\)' FILE_NAME_PATTERN = r'[\d\.\,]+) ?(?P\w+)?\)' - FILE_INFO_PATTERN = r'Filename:(?P[^<]+)\s*.*?\((?P[^<]+)\)' OFFLINE_PATTERN = r'>\w+ (Not Found|file (was|has been) removed)' WAIT_PATTERN = r'.*?>(\d+)' - #LONG_WAIT_PATTERN = r'(?P\d+(?=\s*hour))?.*?(?P\d+(?=\s*minute))?.*?(?P\d+(?=\s*second))?' - OVR_DOWNLOAD_LINK_PATTERN = r'

    Download Link

    \s*]*>([^<]+)' - OVR_KILL_LINK_PATTERN = r'

    Delete Link

    \s*]*>([^<]+)' + + OVR_LINK_PATTERN = r'

    Download Link

    \s*]*>([^<]+)' + CAPTCHA_URL_PATTERN = r'(http://[^"\']+?/captchas?/[^"\']+)' RECAPTCHA_URL_PATTERN = r'http://[^"\']+?recaptcha[^"\']+?\?k=([^"\']+)"' CAPTCHA_DIV_PATTERN = r'>Enter code.*?(.*?)
    ' SOLVEMEDIA_PATTERN = r'http:\/\/api\.solvemedia\.com\/papi\/challenge\.script\?k=(.*?)"' + ERROR_PATTERN = r'class=["\']err["\'][^>]*>(.*?)[^']+)'" OFFLINE_PATTERN = ur'

    哎呀!提取码不存在!不妨搜搜看吧!

    ' - AJAX_URL_PATTERN = r'(/\?ct=(pickcode|download)[^"\']+)' + LINK_PATTERN = r'(/\?ct=(pickcode|download)[^"\']+)' + def handleFree(self): - found = re.search(self.AJAX_URL_PATTERN, self.html) + found = re.search(self.LINK_PATTERN, self.html) if not found: self.parseError("AJAX URL") url = found.group(1) -- cgit v1.2.3