diff options
author | Walter Purcaro <vuolter@gmail.com> | 2015-02-16 18:11:19 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2015-02-16 18:11:19 +0100 |
commit | 00e547899c7fcfd8bcfc61cd1cc5d0a8aec8cee5 (patch) | |
tree | 874064edf3723afbd30c54e14b489085e23f1ad7 /module/plugins/hoster | |
parent | module temp (diff) | |
parent | [ZippyshareCom] Update get_checksum (diff) | |
download | pyload-00e547899c7fcfd8bcfc61cd1cc5d0a8aec8cee5.tar.xz |
Merge branch 'stable' into 0.4.10
Conflicts:
module/plugins/OCR.py
module/plugins/accounts/BayfilesCom.py
module/plugins/accounts/CatShareNet.py
module/plugins/accounts/DebridItaliaCom.py
module/plugins/accounts/FourSharedCom.py
module/plugins/accounts/FshareVn.py
module/plugins/accounts/Keep2ShareCc.py
module/plugins/accounts/LomafileCom.py
module/plugins/accounts/RapiduNet.py
module/plugins/accounts/RyushareCom.py
module/plugins/accounts/ShareonlineBiz.py
module/plugins/addon/Checksum.py
module/plugins/addon/ExternalScripts.py
module/plugins/addon/ExtractArchive.py
module/plugins/addon/MergeFiles.py
module/plugins/addon/RestartSlow.py
module/plugins/addon/SkipRev.py
module/plugins/addon/UnSkipOnFail.py
module/plugins/addon/UpdateManager.py
module/plugins/addon/WindowsPhoneToastNotify.py
module/plugins/container/CCF.py
module/plugins/container/LinkList.py
module/plugins/container/RSDF.py
module/plugins/crypter/BitshareCom.py
module/plugins/crypter/CrockoCom.py
module/plugins/crypter/DataHu.py
module/plugins/crypter/DepositfilesCom.py
module/plugins/crypter/Dereferer.py
module/plugins/crypter/DevhostStFolder.py
module/plugins/crypter/DlProtectCom.py
module/plugins/crypter/DontKnowMe.py
module/plugins/crypter/EasybytezCom.py
module/plugins/crypter/FilecloudIo.py
module/plugins/crypter/FilecryptCc.py
module/plugins/crypter/FilefactoryCom.py
module/plugins/crypter/FilerNet.py
module/plugins/crypter/FilestubeCom.py
module/plugins/crypter/FiletramCom.py
module/plugins/crypter/FreakhareCom.py
module/plugins/crypter/FreetexthostCom.py
module/plugins/crypter/FshareVn.py
module/plugins/crypter/ImgurComAlbum.py
module/plugins/crypter/JunocloudMe.py
module/plugins/crypter/LinkSaveIn.py
module/plugins/crypter/MegaRapidCz.py
module/plugins/crypter/MultiUpOrg.py
module/plugins/crypter/NetfolderIn.py
module/plugins/crypter/NosvideoCom.py
module/plugins/crypter/OneKhDe.py
module/plugins/crypter/PastebinCom.py
module/plugins/crypter/RapidfileshareNet.py
module/plugins/crypter/RelinkUs.py
module/plugins/crypter/TnyCz.py
module/plugins/crypter/TurbobitNet.py
module/plugins/crypter/TusfilesNet.py
module/plugins/crypter/UploadableCh.py
module/plugins/crypter/UploadedTo.py
module/plugins/crypter/XFileSharingPro.py
module/plugins/hooks/AlldebridCom.py
module/plugins/hooks/BypassCaptcha.py
module/plugins/hooks/Captcha9Kw.py
module/plugins/hooks/CaptchaBrotherhood.py
module/plugins/hooks/ClickAndLoad.py
module/plugins/hooks/DeathByCaptcha.py
module/plugins/hooks/DebridItaliaCom.py
module/plugins/hooks/EasybytezCom.py
module/plugins/hooks/ExpertDecoders.py
module/plugins/hooks/FastixRu.py
module/plugins/hooks/FreeWayMe.py
module/plugins/hooks/ImageTyperz.py
module/plugins/hooks/LinkdecrypterCom.py
module/plugins/hooks/LinksnappyCom.py
module/plugins/hooks/MegaDebridEu.py
module/plugins/hooks/MultishareCz.py
module/plugins/hooks/MyfastfileCom.py
module/plugins/hooks/OverLoadMe.py
module/plugins/hooks/PremiumTo.py
module/plugins/hooks/PremiumizeMe.py
module/plugins/hooks/RPNetBiz.py
module/plugins/hooks/RealdebridCom.py
module/plugins/hooks/RehostTo.py
module/plugins/hooks/SimplyPremiumCom.py
module/plugins/hooks/SimplydebridCom.py
module/plugins/hooks/UnrestrictLi.py
module/plugins/hooks/XFileSharingPro.py
module/plugins/hooks/ZeveraCom.py
module/plugins/hoster/AlldebridCom.py
module/plugins/hoster/BayfilesCom.py
module/plugins/hoster/DebridItaliaCom.py
module/plugins/hoster/DepositfilesCom.py
module/plugins/hoster/DodanePl.py
module/plugins/hoster/ExtabitCom.py
module/plugins/hoster/FastixRu.py
module/plugins/hoster/FastshareCz.py
module/plugins/hoster/FileParadoxIn.py
module/plugins/hoster/FileSharkPl.py
module/plugins/hoster/FilerNet.py
module/plugins/hoster/FileserveCom.py
module/plugins/hoster/FreakshareCom.py
module/plugins/hoster/FreeWayMe.py
module/plugins/hoster/GigapetaCom.py
module/plugins/hoster/IfileIt.py
module/plugins/hoster/Keep2ShareCc.py
module/plugins/hoster/LetitbitNet.py
module/plugins/hoster/LinksnappyCom.py
module/plugins/hoster/LomafileCom.py
module/plugins/hoster/MegaCoNz.py
module/plugins/hoster/MegaDebridEu.py
module/plugins/hoster/MegaRapidCz.py
module/plugins/hoster/MyfastfileCom.py
module/plugins/hoster/OverLoadMe.py
module/plugins/hoster/PremiumTo.py
module/plugins/hoster/PremiumizeMe.py
module/plugins/hoster/RPNetBiz.py
module/plugins/hoster/RapidgatorNet.py
module/plugins/hoster/RealdebridCom.py
module/plugins/hoster/RehostTo.py
module/plugins/hoster/RyushareCom.py
module/plugins/hoster/SendmywayCom.py
module/plugins/hoster/ShareonlineBiz.py
module/plugins/hoster/SimplyPremiumCom.py
module/plugins/hoster/SimplydebridCom.py
module/plugins/hoster/TusfilesNet.py
module/plugins/hoster/UnibytesCom.py
module/plugins/hoster/UnrestrictLi.py
module/plugins/hoster/UploadedTo.py
module/plugins/hoster/WebshareCz.py
module/plugins/hoster/XFileSharingPro.py
module/plugins/hoster/YoutubeCom.py
module/plugins/hoster/ZeveraCom.py
module/plugins/hoster/ZippyshareCom.py
module/plugins/internal/AbstractExtractor.py
module/plugins/internal/BasePlugin.py
module/plugins/internal/CaptchaService.py
module/plugins/internal/DeadCrypter.py
module/plugins/internal/DeadHoster.py
module/plugins/internal/MultiHoster.py
module/plugins/internal/SimpleCrypter.py
module/plugins/internal/SimpleHoster.py
module/plugins/internal/UnRar.py
module/plugins/internal/UnZip.py
module/plugins/internal/XFSCrypter.py
module/plugins/internal/XFSHoster.py
Diffstat (limited to 'module/plugins/hoster')
153 files changed, 2522 insertions, 2437 deletions
diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index 533f7beb6..427eb42f0 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -5,19 +5,19 @@ import re from random import randrange from urllib import unquote -from pyload.utils import json_loads -from pyload.plugin.Hoster import Hoster -from pyload.utils import parseFileSize +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo +from module.utils import parseFileSize -class AlldebridCom(Hoster): +class AlldebridCom(MultiHoster): __name__ = "AlldebridCom" __type__ = "hoster" - __version__ = "0.34" + __version__ = "0.44" - __pattern__ = r'https?://(?:[^/]*\.)?alldebrid\..*' + __pattern__ = r'https?://(?:www\.|s\d+\.)?alldebrid\.com/dl/[\w^_]+' - __description__ = """Alldebrid.com hoster plugin""" + __description__ = """Alldebrid.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Andy Voigt", "spamsales@online.de")] @@ -27,61 +27,52 @@ class AlldebridCom(Hoster): name = unquote(url.rsplit("/", 1)[1]) except IndexError: name = "Unknown_Filename..." + if name.endswith("..."): # incomplete filename, append random stuff name += "%s.tmp" % randrange(100, 999) + return name def setup(self): self.chunkLimit = 16 - self.resumeDownload = True - def process(self, pyfile): - if re.match(self.__pattern__, pyfile.url): - new_url = pyfile.url - elif not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "AllDebrid") - self.fail(_("No AllDebrid account provided")) - else: - self.logDebug("Old URL: %s" % pyfile.url) - password = self.getPassword().splitlines()[0] or "" + def handlePremium(self, pyfile): + password = self.getPassword() - data = json_loads(self.load("http://www.alldebrid.com/service.php", - get={'link': pyfile.url, 'json': "true", 'pw': password})) + data = json_loads(self.load("http://www.alldebrid.com/service.php", + get={'link': pyfile.url, 'json': "true", 'pw': password})) - self.logDebug("Json data", data) + self.logDebug("Json data", data) - if data['error']: - if data['error'] == "This link isn't available on the hoster website.": - self.offline() - else: - self.logWarning(data['error']) - self.tempOffline() + if data['error']: + if data['error'] == "This link isn't available on the hoster website.": + self.offline() else: - if pyfile.name and not pyfile.name.endswith('.tmp'): - pyfile.name = data['filename'] - pyfile.size = parseFileSize(data['filesize']) - new_url = data['link'] - - if self.getConfig("https"): - new_url = new_url.replace("http://", "https://") + self.logWarning(data['error']) + self.tempOffline() else: - new_url = new_url.replace("https://", "http://") + if pyfile.name and not pyfile.name.endswith('.tmp'): + pyfile.name = data['filename'] + pyfile.size = parseFileSize(data['filesize']) + self.link = data['link'] - if new_url != pyfile.url: - self.logDebug("New URL: %s" % new_url) + if self.getConfig("ssl"): + self.link = self.link.replace("http://", "https://") + else: + self.link = self.link.replace("https://", "http://") if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"): #only use when name wasnt already set - pyfile.name = self.getFilename(new_url) + pyfile.name = self.getFilename(self.link) - self.download(new_url, disposition=True) - check = self.checkDownload({'error': "<title>An error occured while processing your request</title>", - 'empty': re.compile(r"^$")}) - - if check == "error": + def checkFile(self): + if self.checkDownload({'error': "<title>An error occured while processing your request</title>"}) == "error": self.retry(wait_time=60, reason=_("An error occured while generating link")) - elif check == "empty": - self.retry(wait_time=60, reason=_("Downloaded File was empty")) + + return super(AlldebridCom, self).checkFile() + + +getInfo = create_getInfo(AlldebridCom) diff --git a/module/plugins/hoster/AndroidfilehostCom.py b/module/plugins/hoster/AndroidfilehostCom.py new file mode 100644 index 000000000..b6e43d632 --- /dev/null +++ b/module/plugins/hoster/AndroidfilehostCom.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -* +# +# Test links: +# https://www.androidfilehost.com/?fid=95916177934518197 + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class AndroidfilehostCom(SimpleHoster): + __name__ = "AndroidfilehostCom" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'https?://(?:www\.)?androidfilehost\.com/\?fid=\d+' + + __description__ = """Androidfilehost.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + NAME_PATTERN = r'<br />(?P<N>.*?)</h1>' + SIZE_PATTERN = r'<h4>size</h4>\s*<p>(?P<S>[\d.,]+)(?P<U>[\w^_]+)</p>' + HASHSUM_PATTERN = r'<h4>(?P<T>.*?)</h4>\s*<p><code>(?P<H>.*?)</code></p>' + + OFFLINE_PATTERN = r'404 not found' + + WAIT_PATTERN = r'users must wait <strong>(\d+) secs' + + + def setup(self): + self.multiDL = True + self.resumeDownload = True + self.chunkLimit = 1 + + + def handleFree(self, pyfile): + wait = re.search(self.WAIT_PATTERN, self.html) + self.logDebug("Waiting time: %s seconds" % wait.group(1)) + + fid = re.search(r'id="fid" value="(\d+)" />', self.html).group(1) + self.logDebug("fid: %s" % fid) + + html = self.load("https://www.androidfilehost.com/libs/otf/mirrors.otf.php", + post={'submit': 'submit', + 'action': 'getdownloadmirrors', + 'fid' : fid}, + decode=True) + + self.link = re.findall('"url":"(.*?)"', html)[0].replace("\\", "") + mirror_host = self.link.split("/")[2] + + self.logDebug("Mirror Host: %s" % mirror_host) + + html = self.load("https://www.androidfilehost.com/libs/otf/stats.otf.php", + get={'fid' : fid, + 'w' : 'download', + 'mirror': mirror_host}, + decode=True) + + +getInfo = create_getInfo(AndroidfilehostCom) diff --git a/module/plugins/hoster/BasketbuildCom.py b/module/plugins/hoster/BasketbuildCom.py new file mode 100644 index 000000000..db482c7c5 --- /dev/null +++ b/module/plugins/hoster/BasketbuildCom.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -* +# +# Test links: +# https://s.basketbuild.com/filedl/devs?dev=pacman&dl=pacman/falcon/RC-3/pac_falcon-RC-3-20141103.zip +# https://s.basketbuild.com/filedl/gapps?dl=gapps-gb-20110828-signed.zip + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class BasketbuildCom(SimpleHoster): + __name__ = "BasketbuildCom" + __type__ = "hoster" + __version__ = "0.03" + + __pattern__ = r'https?://(?:www\.)?(?:\w\.)?basketbuild\.com/filedl/.+' + + __description__ = """basketbuild.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + NAME_PATTERN = r'File Name:</strong> (?P<N>.+?)<br/>' + SIZE_PATTERN = r'File Size:</strong> (?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'404 - Page Not Found' + + + def setup(self): + self.multiDL = True + self.resumeDownload = True + self.chunkLimit = 1 + + + def handleFree(self, pyfile): + try: + link1 = re.search(r'href="(.+dlgate/.+)"', self.html).group(1) + self.html = self.load(link1) + + except AttributeError: + self.error(_("Hop #1 not found")) + + else: + self.logDebug("Next hop: %s" % link1) + + try: + wait = re.search(r'var sec = (\d+)', self.html).group(1) + self.logDebug("Wait %s seconds" % wait) + self.wait(wait) + + except AttributeError: + self.logDebug("No wait time found") + + try: + self.link = re.search(r'id="dlLink">\s*<a href="(.+?)"', self.html).group(1) + + except AttributeError: + self.error(_("DL-Link not found")) + + +getInfo = create_getInfo(BasketbuildCom) diff --git a/module/plugins/hoster/BayfilesCom.py b/module/plugins/hoster/BayfilesCom.py index 4f2469759..0929ece01 100644 --- a/module/plugins/hoster/BayfilesCom.py +++ b/module/plugins/hoster/BayfilesCom.py @@ -1,87 +1,18 @@ # -*- coding: utf-8 -*- -import re +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -from time import time -from pyload.utils import json_loads -from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo - - -class BayfilesCom(SimpleHoster): +class BayfilesCom(DeadHoster): __name__ = "BayfilesCom" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __pattern__ = r'https?://(?:www\.)?bayfiles\.(com|net)/file/(?P<ID>\w+/\w+/[^/]+)' __description__ = """Bayfiles.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com")] - - - INFO_PATTERN = r'<p title="(?P<N>[^"]+)">[^<]*<strong>(?P<S>[\d .,]+)(?P<U>[\w^_]+)</strong></p>' - OFFLINE_PATTERN = r'(<p>The requested file could not be found.</p>|<title>404 Not Found</title>)' - - WAIT_PATTERN = r'>Your IP [\d.]* has recently downloaded a file\. Upgrade to premium or wait (\d+) minutes\.<' - VARS_PATTERN = r'var vfid = (\d+);\s*var delay = (\d+);' - FREE_LINK_PATTERN = r'javascript:window\.location\.href = \'(.+?)\';' - PREMIUM_LINK_PATTERN = r'(?:<a class="highlighted-btn" href="|(?=http://s\d+\.baycdn\.com/dl/))(.*?)"' - - - def handleFree(self): - m = re.search(self.WAIT_PATTERN, self.html) - if m: - self.retry(wait_time=int(m.group(1)) * 60) - - # Get download token - m = re.search(self.VARS_PATTERN, self.html) - if m is None: - self.error(_("VARS_PATTERN not found")) - vfid, delay = m.groups() - - res = json_loads(self.load('http://bayfiles.com/ajax_download', - get={"_": time() * 1000, - "action": "startTimer", - "vfid": vfid}, decode=True)) - - if not "token" in res or not res['token']: - self.fail(_("No token")) - - self.wait(int(delay)) - - self.html = self.load('http://bayfiles.com/ajax_download', get={ - "token": res['token'], - "action": "getLink", - "vfid": vfid}) - - # Get final link and download - m = re.search(self.FREE_LINK_PATTERN, self.html) - if m is None: - self.error(_("Free link")) - self.startDownload(m.group(1)) - - - def handlePremium(self): - m = re.search(self.PREMIUM_LINK_PATTERN, self.html) - if m is None: - self.error(_("Premium link")) - self.startDownload(m.group(1)) - - - def startDownload(self, url): - self.logDebug("%s URL: %s" % ("Premium" if self.premium else "Free", url)) - self.download(url) - # check download - check = self.checkDownload({ - "waitforfreeslots": re.compile(r"<title>BayFiles</title>"), - "notfound": re.compile(r"<title>404 Not Found</title>") - }) - if check == "waitforfreeslots": - self.retry(30, 5 * 60, "Wait for free slot") - elif check == "notfound": - self.retry(30, 5 * 60, "404 Not found") + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] getInfo = create_getInfo(BayfilesCom) diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index 0b65c9e8b..86ef46cc3 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -8,9 +8,9 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class BezvadataCz(SimpleHoster): __name__ = "BezvadataCz" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.26" - __pattern__ = r'http://(?:www\.)?bezvadata\.cz/stahnout/.*' + __pattern__ = r'http://(?:www\.)?bezvadata\.cz/stahnout/.+' __description__ = """BezvaData.cz hoster plugin""" __license__ = "GPLv3" @@ -27,7 +27,7 @@ class BezvadataCz(SimpleHoster): self.multiDL = True - def handleFree(self): + def handleFree(self, pyfile): #download button m = re.search(r'<a class="stahnoutSoubor".*?href="(.*?)"', self.html) if m is None: @@ -88,7 +88,7 @@ class BezvadataCz(SimpleHoster): def loadcaptcha(self, data, *args, **kwargs): - return data.decode("base64") + return data.decode('base64') getInfo = create_getInfo(BezvadataCz) diff --git a/module/plugins/hoster/BillionuploadsCom.py b/module/plugins/hoster/BillionuploadsCom.py index 43fc1f4af..fb79fe29a 100644 --- a/module/plugins/hoster/BillionuploadsCom.py +++ b/module/plugins/hoster/BillionuploadsCom.py @@ -15,8 +15,6 @@ class BillionuploadsCom(XFSHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "billionuploads.com" - NAME_PATTERN = r'<td class="dofir" title="(?P<N>.+?)"' SIZE_PATTERN = r'<td class="dofir">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 781f31df1..feb2b682c 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -11,9 +11,9 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class BitshareCom(SimpleHoster): __name__ = "BitshareCom" __type__ = "hoster" - __version__ = "0.51" + __version__ = "0.53" - __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/(?P<id1>\w+)(/(?P<name>.*?)\.html)?|\?f=(?P<id2>\w+))' + __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P<ID>\w+)(?(1)/(?P<NAME>.+?)\.html)' __description__ = """Bitshare.com hoster plugin""" __license__ = "GPLv3" @@ -21,13 +21,13 @@ class BitshareCom(SimpleHoster): ("fragonib", "fragonib[AT]yahoo[DOT]es")] - INFO_PATTERN = r'Downloading (?P<N>.+) - (?P<S>[\d.,]+) (?P<U>[\w^_]+)</h1>' - OFFLINE_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)' - COOKIES = [("bitshare.com", "language_selection", "EN")] - AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' - TRAFFIC_USED_UP = r'Your Traffic is used up for today. Upgrade to premium to continue!' + INFO_PATTERN = r'Downloading (?P<N>.+) - (?P<S>[\d.,]+) (?P<U>[\w^_]+)</h1>' + OFFLINE_PATTERN = r'[Ff]ile (not available|was deleted|was not found)' + + AJAXID_PATTERN = r'var ajaxdl = "(.*?)";' + TRAFFIC_USED_UP = r'Your Traffic is used up for today' def setup(self): @@ -39,11 +39,9 @@ class BitshareCom(SimpleHoster): if self.premium: self.account.relogin(self.user) - self.pyfile = pyfile - # File id m = re.match(self.__pattern__, pyfile.url) - self.file_id = max(m.group('id1'), m.group('id2')) + self.file_id = max(m.group('ID1'), m.group('ID2')) self.logDebug("File id is [%s]" % self.file_id) # Load main page @@ -60,10 +58,12 @@ class BitshareCom(SimpleHoster): self.retry() # File name - m = re.match(self.__pattern__, pyfile.url) - name1 = m.group('name') if m else None - m = re.search(self.INFO_PATTERN, self.html) + m = re.match(self.__pattern__, pyfile.url) + name1 = m.group('NAME') if m else None + + m = re.search(self.INFO_PATTERN, self.html) name2 = m.group('N') if m else None + pyfile.name = max(name1, name2) # Ajax file id @@ -71,13 +71,9 @@ class BitshareCom(SimpleHoster): self.logDebug("File ajax id is [%s]" % self.ajaxid) # This may either download our file or forward us to an error page - url = self.getDownloadUrl() - self.download(url) + self.download(self.getDownloadUrl()) - check = self.checkDownload({"404": ">404 Not Found<", "Error": ">Error occured<"}) - if check == "404": - self.retry(3, 60, 'Error 404') - elif check == "error": + if self.checkDownload({"error": ">Error occured<"}): self.retry(5, 5 * 60, "Bitshare host : Error occured") @@ -92,11 +88,14 @@ class BitshareCom(SimpleHoster): self.logDebug("Getting download info") res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={"request": "generateID", "ajaxid": self.ajaxid}) + self.handleErrors(res, ':') - parts = res.split(":") + + parts = res.split(":") filetype = parts[0] - wait = int(parts[1]) - captcha = int(parts[2]) + wait = int(parts[1]) + captcha = int(parts[2]) + self.logDebug("Download info [type: '%s', waiting: %d, captcha: %d]" % (filetype, wait, captcha)) # Waiting @@ -115,7 +114,7 @@ class BitshareCom(SimpleHoster): # Try up to 3 times for i in xrange(3): - challenge, response = recaptcha.challenge() + response, challenge = recaptcha.challenge() res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={"request" : "validateCaptcha", "ajaxid" : self.ajaxid, @@ -128,7 +127,9 @@ class BitshareCom(SimpleHoster): self.logDebug("Getting download url") res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", post={"request": "getDownloadURL", "ajaxid": self.ajaxid}) + self.handleErrors(res, '#') + url = res.split("#")[-1] return url diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 2a2fb55da..d61856b7c 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -9,7 +9,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.11" __pattern__ = r'http://(?:www\.)?catshare\.net/\w{16}' @@ -26,8 +26,9 @@ class CatShareNet(SimpleHoster): OFFLINE_PATTERN = ur'Podany plik został usunięty\s*</div>' IP_BLOCKED_PATTERN = ur'>Nasz serwis wykrył że Twój adres IP nie pochodzi z Polski.<' - SECONDS_PATTERN = 'var\scount\s=\s(\d+);' - LINK_PATTERN = r'<form action="(.+?)" method="GET">' + WAIT_PATTERN = r'var\scount\s=\s(\d+);' + + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'<form action="(.+?)" method="GET">' def setup(self): @@ -42,26 +43,20 @@ class CatShareNet(SimpleHoster): return super(CatShareNet, self).getFileInfo() - def handleFree(self): - m = re.search(self.SECONDS_PATTERN, self.html) - if m: - wait_time = int(m.group(1)) - self.wait(wait_time, True) - + def handleFree(self, pyfile): recaptcha = ReCaptcha(self) - challenge, response = recaptcha.challenge() - self.html = self.load(self.pyfile.url, + response, challenge = recaptcha.challenge() + self.html = self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.invalidCaptcha() self.retry(reason=_("Wrong captcha entered")) - dl_link = m.group(1) - self.download(dl_link, disposition=True) + self.link = m.group(1) getInfo = create_getInfo(CatShareNet) diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py new file mode 100644 index 000000000..ee966c280 --- /dev/null +++ b/module/plugins/hoster/CloudzillaTo.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class CloudzillaTo(SimpleHoster): + __name__ = "CloudzillaTo" + __type__ = "hoster" + __version__ = "0.06" + + __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/file/(?P<ID>[\w^_]+)' + + __description__ = """Cloudzilla.to hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + INFO_PATTERN = r'title="(?P<N>.+?)">\1</span> <span class="size">\((?P<S>[\d.]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>File not found...<' + + PASSWORD_PATTERN = r'<div id="pwd_protected">' + + + def checkErrors(self): + m = re.search(self.PASSWORD_PATTERN, self.html) + if m: + self.html = self.load(self.pyfile.url, get={'key': self.getPassword()}) + + if re.search(self.PASSWORD_PATTERN, self.html): + self.retry(reason="Wrong password") + + + def handleFree(self, pyfile): + self.html = self.load("http://www.cloudzilla.to/generateticket/", + post={'file_id': self.info['pattern']['ID'], 'key': self.getPassword()}) + + ticket = dict(re.findall(r'<(.+?)>([^<>]+?)</', self.html)) + + self.logDebug(ticket) + + if 'error' in ticket: + if "File is password protected" in ticket['error']: + self.retry(reason="Wrong password") + else: + self.fail(ticket['error']) + + if 'wait' in ticket: + self.wait(ticket['wait'], int(ticket['wait']) > 5) + + self.link = "http://%(server)s/download/%(file_id)s/%(ticket_id)s" % {'server' : ticket['server'], + 'file_id' : self.info['pattern']['ID'], + 'ticket_id': ticket['ticket_id']} + + + def handlePremium(self, pyfile): + return self.handleFree(pyfile) + + +getInfo = create_getInfo(CloudzillaTo) diff --git a/module/plugins/hoster/CramitIn.py b/module/plugins/hoster/CramitIn.py index f39f33a3e..8e239cdc5 100644 --- a/module/plugins/hoster/CramitIn.py +++ b/module/plugins/hoster/CramitIn.py @@ -15,9 +15,8 @@ class CramitIn(XFSHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "cramit.in" - INFO_PATTERN = r'<span class=t2>\s*(?P<N>.*?)</span>.*?<small>\s*\((?P<S>.*?)\)' + LINK_PATTERN = r'href="(http://cramit\.in/file_download/.*?)"' diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index f12b2e969..a2abc2b7b 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -9,7 +9,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class CrockoCom(SimpleHoster): __name__ = "CrockoCom" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.19" __pattern__ = r'http://(?:www\.)?(crocko|easy-share)\.com/\w+' @@ -30,7 +30,7 @@ class CrockoCom(SimpleHoster): NAME_REPLACEMENTS = [(r'<[^>]*>', '')] - def handleFree(self): + def handleFree(self, pyfile): if "You need Premium membership to download this file." in self.html: self.fail(_("You need Premium membership to download this file")) @@ -52,14 +52,10 @@ class CrockoCom(SimpleHoster): recaptcha = ReCaptcha(self) for _i in xrange(5): - inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge() + inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() self.download(action, post=inputs) - check = self.checkDownload({ - "captcha_err": recaptcha.KEY_AJAX_PATTERN - }) - - if check == "captcha_err": + if self.checkDownload({"captcha": recaptcha.KEY_AJAX_PATTERN}): self.invalidCaptcha() else: break diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index ad4e36ce7..419e43a7a 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -12,30 +12,30 @@ from pyload.utils import parseFileSize class CzshareCom(SimpleHoster): __name__ = "CzshareCom" __type__ = "hoster" - __version__ = "0.95" + __version__ = "0.98" - __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).*' + __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).+' __description__ = """CZshare.com hoster plugin, now Sdilej.cz""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<div class="tab" id="parameters">\s*<p>\s*Cel. n.zev: <a href=[^>]*>(?P<N>[^<]+)</a>' - SIZE_PATTERN = r'<div class="tab" id="category">(?:\s*<p>[^\n]*</p>)*\s*Velikost:\s*(?P<S>[\d .,]+)(?P<U>[\w^_]+)\s*</div>' + NAME_PATTERN = r'<div class="tab" id="parameters">\s*<p>\s*Cel. n.zev: <a href=[^>]*>(?P<N>[^<]+)</a>' + SIZE_PATTERN = r'<div class="tab" id="category">(?:\s*<p>[^\n]*</p>)*\s*Velikost:\s*(?P<S>[\d .,]+)(?P<U>[\w^_]+)\s*</div>' OFFLINE_PATTERN = r'<div class="header clearfix">\s*<h2 class="red">' SIZE_REPLACEMENTS = [(' ', '')] - URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://sdilej.cz/\1/x/')] + URL_REPLACEMENTS = [(r'http://[^/]*/download.php\?.*?id=(\w+).*', r'http://sdilej.cz/\1/x/')] - FORCE_CHECK_TRAFFIC = True + CHECK_TRAFFIC = True - FREE_URL_PATTERN = r'<a href="([^"]+)" class="page-download">[^>]*alt="([^"]+)" /></a>' - FREE_FORM_PATTERN = r'<form action="download\.php" method="post">\s*<img src="captcha\.php" id="captcha" />(.*?)</form>' + FREE_URL_PATTERN = r'<a href="([^"]+)" class="page-download">[^>]*alt="([^"]+)" /></a>' + FREE_FORM_PATTERN = r'<form action="download\.php" method="post">\s*<img src="captcha\.php" id="captcha" />(.*?)</form>' PREMIUM_FORM_PATTERN = r'<form action="/profi_down\.php" method="post">(.*?)</form>' - FORM_INPUT_PATTERN = r'<input[^>]* name="([^"]+)" value="([^"]+)"[^>]*/>' - MULTIDL_PATTERN = r'<p><font color=\'red\'>Z[^<]*PROFI.</font></p>' - USER_CREDIT_PATTERN = r'<div class="credit">\s*kredit: <strong>([\d .,]+)(\w+)</strong>\s*</div><!-- .credit -->' + FORM_INPUT_PATTERN = r'<input[^>]* name="([^"]+)" value="([^"]+)"[^>]*/>' + MULTIDL_PATTERN = r'<p><font color=\'red\'>Z[^<]*PROFI.</font></p>' + USER_CREDIT_PATTERN = r'<div class="credit">\s*kredit: <strong>([\d .,]+)(\w+)</strong>\s*</div><!-- .credit -->' def checkTrafficLeft(self): @@ -63,7 +63,7 @@ class CzshareCom(SimpleHoster): return True - def handlePremium(self): + def handlePremium(self, pyfile): # parse download link try: form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1) @@ -74,15 +74,16 @@ class CzshareCom(SimpleHoster): # download the file, destination is determined by pyLoad self.download("http://sdilej.cz/profi_down.php", post=inputs, disposition=True) - self.checkDownloadedFile() - def handleFree(self): + def handleFree(self, pyfile): # get free url m = re.search(self.FREE_URL_PATTERN, self.html) if m is None: self.error(_("FREE_URL_PATTERN not found")) + parsed_url = "http://sdilej.cz" + m.group(1) + self.logDebug("PARSED_URL:" + parsed_url) # get download ticket and parse html @@ -93,7 +94,8 @@ class CzshareCom(SimpleHoster): try: form = re.search(self.FREE_FORM_PATTERN, self.html, re.S).group(1) inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) - self.pyfile.size = int(inputs['size']) + pyfile.size = int(inputs['size']) + except Exception, e: self.logError(e) self.error(_("Form")) @@ -103,10 +105,13 @@ class CzshareCom(SimpleHoster): for _i in xrange(5): inputs['captchastring2'] = self.decryptCaptcha(captcha_url) self.html = self.load(parsed_url, cookies=True, post=inputs, decode=True) + if u"<li>Zadaný ověřovací kód nesouhlasí!</li>" in self.html: self.invalidCaptcha() + elif re.search(self.MULTIDL_PATTERN, self.html): self.longWait(5 * 60, 12) + else: self.correctCaptcha() break @@ -118,35 +123,39 @@ class CzshareCom(SimpleHoster): # download the file, destination is determined by pyLoad self.logDebug("WAIT URL", self.req.lastEffectiveURL) + m = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) if m is None: self.error(_("Download URL not found")) - url = "http://%s/download.php?%s" % (m.group(1), m.group(2)) + self.link = "http://%s/download.php?%s" % (m.group(1), m.group(2)) self.wait() - self.download(url) - self.checkDownloadedFile() - def checkDownloadedFile(self): + def checkFile(self): # check download check = self.checkDownload({ - "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_err": "<li>Zadaný ověřovací kód nesouhlasí!</li>" + "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" : "<li>Zadaný ověřovací kód nesouhlasí!</li>" }) - if check == "temp_offline": + if check == "temp offline": self.fail(_("File not available - try later")) - if check == "credit": + + elif check == "credit": self.resetAccount() - elif check == "multi_dl": + + elif check == "multi-dl": self.longWait(5 * 60, 12) - elif check == "captcha_err": + + elif check == "captcha": self.invalidCaptcha() self.retry() + return super(CzshareCom, self).checkFile() + getInfo = create_getInfo(CzshareCom) diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py index 84d002e9c..c212fa872 100644 --- a/module/plugins/hoster/DailymotionCom.py +++ b/module/plugins/hoster/DailymotionCom.py @@ -15,9 +15,9 @@ def getInfo(urls): request = {"fields": "access_error,status,title"} for url in urls: - id = regex.match(url).group("ID") - page = getURL(apiurl % id, get=request) - info = json_loads(page) + id = regex.match(url).group('ID') + html = getURL(apiurl % id, get=request) + info = json_loads(html) name = info['title'] + ".mp4" if "title" in info else url @@ -60,8 +60,8 @@ class DailymotionCom(Hoster): for result in re.finditer(r"\"(?P<URL>http:\\/\\/www.dailymotion.com\\/cdn\\/H264-(?P<QF>.*?)\\.*?)\"", self.html): - url = result.group("URL") - qf = result.group("QF") + url = result.group('URL') + qf = result.group('QF') link = url.replace("\\", "") quality = tuple(int(x) for x in qf.split("x")) @@ -86,7 +86,7 @@ class DailymotionCom(Hoster): def getLink(self, streams, quality): if quality > 0: - for x, s in reversed([item for item in enumerate(streams)]): + for x, s in [item for item in enumerate(streams)][::-1]: qf = s[0][1] if qf <= quality: idx = x @@ -116,7 +116,7 @@ class DailymotionCom(Hoster): def process(self, pyfile): self.checkInfo(pyfile) - id = re.match(self.__pattern__, pyfile.url).group("ID") + id = re.match(self.__pattern__, pyfile.url).group('ID') self.html = self.load("http://www.dailymotion.com/embed/video/" + id, decode=True) streams = self.getStreams() diff --git a/module/plugins/hoster/DataHu.py b/module/plugins/hoster/DataHu.py index 49e6e1aa2..f24b5cdba 100644 --- a/module/plugins/hoster/DataHu.py +++ b/module/plugins/hoster/DataHu.py @@ -11,7 +11,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class DataHu(SimpleHoster): __name__ = "DataHu" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?data\.hu/get/\w+' @@ -23,7 +23,7 @@ class DataHu(SimpleHoster): INFO_PATTERN = ur'<title>(?P<N>.*) \((?P<S>[^)]+)\) let\xf6lt\xe9se</title>' OFFLINE_PATTERN = ur'Az adott f\xe1jl nem l\xe9tezik' - LINK_PATTERN = r'<div class="download_box_button"><a href="([^"]+)">' + LINK_FREE_PATTERN = r'<div class="download_box_button"><a href="([^"]+)">' def setup(self): @@ -31,12 +31,4 @@ class DataHu(SimpleHoster): self.multiDL = self.premium - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) - if m is None: - self.error(_("LINK_PATTERN not found")) - - self.download(m.group(1), disposition=True) - - getInfo = create_getInfo(DataHu) diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index d06207257..592bece93 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -6,9 +6,9 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class DataportCz(SimpleHoster): __name__ = "DataportCz" __type__ = "hoster" - __version__ = "0.40" + __version__ = "0.41" - __pattern__ = r'http://(?:www\.)?dataport\.cz/file/(.*)' + __pattern__ = r'http://(?:www\.)?dataport\.cz/file/(.+)' __description__ = """Dataport.cz hoster plugin""" __license__ = "GPLv3" @@ -23,7 +23,7 @@ class DataportCz(SimpleHoster): FREE_SLOTS_PATTERN = ur'Počet volných slotů: <span class="darkblue">(\d+)</span><br />' - def handleFree(self): + def handleFree(self, pyfile): captchas = {"1": "jkeG", "2": "hMJQ", "3": "vmEK", "4": "ePQM", "5": "blBd"} for _i in xrange(60): @@ -40,14 +40,16 @@ class DataportCz(SimpleHoster): 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'}) + "slot" : 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) if check == "captcha": self.error(_("invalid captcha")) + elif check == "slot": self.logDebug("No free slots - wait 60s and retry") self.wait(60, False) - self.html = self.load(self.pyfile.url, decode=True) + self.html = self.load(pyfile.url, decode=True) continue + else: break diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index 1d5110784..66102939a 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -9,7 +9,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class DateiTo(SimpleHoster): __name__ = "DateiTo" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.07" __pattern__ = r'http://(?:www\.)?datei\.to/datei/(?P<ID>\w+)\.html' @@ -28,7 +28,7 @@ class DateiTo(SimpleHoster): DATA_PATTERN = r'url: "(.*?)", data: "(.*?)",' - def handleFree(self): + def handleFree(self, pyfile): url = 'http://datei.to/ajax/download.php' data = {'P': 'I', 'ID': self.info['pattern']['ID']} recaptcha = ReCaptcha(self) @@ -52,7 +52,7 @@ class DateiTo(SimpleHoster): data = dict(x.split('=') for x in m.group(2).split('&')) if url.endswith('recaptcha.php'): - data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge() + data['recaptcha_response_field'], data['recaptcha_challenge_field'] = recaptcha.challenge() else: self.fail(_("Too bad...")) diff --git a/module/plugins/hoster/DebridItaliaCom.py b/module/plugins/hoster/DebridItaliaCom.py index c28cdd89a..8cda56c0c 100644 --- a/module/plugins/hoster/DebridItaliaCom.py +++ b/module/plugins/hoster/DebridItaliaCom.py @@ -2,52 +2,42 @@ import re -from pyload.plugin.Hoster import Hoster -from pyload.plugin.internal.SimpleHoster import replace_patterns +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -class DebridItaliaCom(Hoster): +class DebridItaliaCom(MultiHoster): __name__ = "DebridItaliaCom" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.17" - __pattern__ = r'http://s\d+\.debriditalia\.com/dl/\d+' + __pattern__ = r'https?://(?:www\.|s\d+\.)?debriditalia\.com/dl/\d+' - __description__ = """Debriditalia.com hoster plugin""" + __description__ = """Debriditalia.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it"), ("Walter Purcaro", "vuolter@gmail.com")] - URL_REPLACEMENTS = [(r'(/dl/\d+)$', '\1/')] + URL_REPLACEMENTS = [("https://", "http://")] - def setup(self): - self.chunkLimit = -1 - self.resumeDownload = True - - - def process(self, pyfile): - pyfile.url = replace_patterns(pyfile.url, cls.URL_REPLACEMENTS) - - if re.match(self.__pattern__, pyfile.url): - link = pyfile.url - - elif not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "DebridItalia") - self.fail(_("No DebridItalia account provided")) + def handlePremium(self, pyfile): + self.html = self.load("http://www.debriditalia.com/api.php", + get={'generate': "on", 'link': pyfile.url, 'p': self.getPassword()}) + if "ERROR:" not in self.html: + self.link = self.html.strip() else: - html = self.load("http://www.debriditalia.com/api.php", get={'generate': "", 'link': pyfile.url}) - - if "ERROR" in html: - self.fail(re.search(r'ERROR:(.*)', html).strip()) - - link = html.strip() + self.info['error'] = re.search(r'ERROR:(.*)', self.html).group(1).strip() - self.download(link, disposition=True) + self.html = self.load("http://debriditalia.com/linkgen2.php", + post={'xjxfun' : "convertiLink", + 'xjxargs[]': "S<![CDATA[%s]]>" % pyfile.url, + 'xjxargs[]': "S%s" % self.getPassword()}) + try: + self.link = re.search(r'<a href="(.+?)"', self.html).group(1) + except AttributeError: + pass - check = self.checkDownload({'empty': re.compile(r'^$')}) - if check == "empty": - self.retry(5, 2 * 60, "Empty file downloaded") +getInfo = create_getInfo(DebridItaliaCom) diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index a401e4c90..c9e2040f8 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -11,7 +11,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class DepositfilesCom(SimpleHoster): __name__ = "DepositfilesCom" __type__ = "hoster" - __version__ = "0.51" + __version__ = "0.53" __pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P<ID>\w+)' @@ -32,14 +32,12 @@ class DepositfilesCom(SimpleHoster): COOKIES = [("dfiles.eu", "lang_current", "en")] - FREE_LINK_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"' - PREMIUM_LINK_PATTERN = r'class="repeat"><a href="(.+?)"' - PREMIUM_MIRROR_PATTERN = r'class="repeat_mirror"><a href="(.+?)"' + LINK_FREE_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"' + LINK_PREMIUM_PATTERN = r'class="repeat"><a href="(.+?)"' + LINK_MIRROR_PATTERN = r'class="repeat_mirror"><a href="(.+?)"' - def handleFree(self): - self.html = self.load(self.pyfile.url, post={"gateway_result": "1"}, cookies=True) - + def handleFree(self, pyfile): if re.search(r'File is checked, please try again in a minute.', self.html) is not None: self.logInfo(_("The file is being checked. Waiting 1 minute")) self.retry(wait_time=60) @@ -79,29 +77,24 @@ class DepositfilesCom(SimpleHoster): if '<input type=button value="Continue" onclick="check_recaptcha' in self.html: if 'response' in params: self.invalidCaptcha() - params['challenge'], params['response'] = recaptcha.challenge(captcha_key) + params['response'], params['challenge'] = recaptcha.challenge(captcha_key) self.logDebug(params) continue - m = re.search(self.FREE_LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m: if 'response' in params: self.correctCaptcha() - link = unquote(m.group(1)) - self.logDebug("LINK: %s" % link) + + self.link = unquote(m.group(1)) break else: self.error(_("Download link")) else: self.fail(_("No valid captcha response received")) - try: - self.download(link, disposition=True) - except Exception: - self.retry(wait_time=60) - - def handlePremium(self): + def handlePremium(self, pyfile): if '<span class="html_download_api-gold_traffic_limit">' in self.html: self.logWarning(_("Download limit reached")) self.retry(25, 60 * 60, "Download limit reached") @@ -109,15 +102,14 @@ class DepositfilesCom(SimpleHoster): self.account.relogin(self.user) self.retry() else: - link = re.search(self.PREMIUM_LINK_PATTERN, self.html) - mirror = re.search(self.PREMIUM_MIRROR_PATTERN, self.html) + link = re.search(self.LINK_PREMIUM_PATTERN, self.html) + mirror = re.search(self.LINK_MIRROR_PATTERN, self.html) + if link: - dlink = link.group(1) + self.link = link.group(1) + elif mirror: - dlink = mirror.group(1) - else: - self.error(_("No direct download link or mirror found")) - self.download(dlink, disposition=True) + self.link = mirror.group(1) getInfo = create_getInfo(DepositfilesCom) diff --git a/module/plugins/hoster/DevhostSt.py b/module/plugins/hoster/DevhostSt.py index 20d9930e8..2365baa5f 100644 --- a/module/plugins/hoster/DevhostSt.py +++ b/module/plugins/hoster/DevhostSt.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # Test links: -# http://d-h.st/mM8 +# http://d-h.st/mM8 import re @@ -11,7 +11,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class DevhostSt(SimpleHoster): __name__ = "DevhostSt" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.05" __pattern__ = r'http://(?:www\.)?d-h\.st/(?!users/)\w{3}' @@ -20,29 +20,17 @@ class DevhostSt(SimpleHoster): __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - NAME_PATTERN = r'>Filename:</span> <div title="(?P<N>.+?)"' - SIZE_PATTERN = r'>Size:</span> (?P<S>[\d.,]+) (?P<U>[\w^_]+)' + NAME_PATTERN = r'<span title="(?P<N>.*?)"' + SIZE_PATTERN = r'</span> \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)<br' + HASHSUM_PATTERN = r'>(?P<T>.*?) Sum</span>: (?P<H>.*?)<br' - OFFLINE_PATTERN = r'>File Not Found<' - LINK_PATTERN = r'id="downloadfile" href="(.+?)"' + OFFLINE_PATTERN = r'>File Not Found' + LINK_FREE_PATTERN = r'var product_download_url= \'(.+?)\'' def setup(self): - self.multiDL = True + self.multiDL = True self.chunkLimit = 1 - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) - if m is None: - self.error(_("Download link not found")) - - dl_url = m.group(1) - self.download(dl_url, disposition=True) - - check = self.checkDownload({'html': re.compile("html")}) - if check == "html": - self.error(_("Downloaded file is an html page")) - - getInfo = create_getInfo(DevhostSt) diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index 8f55cabea..541989120 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -37,7 +37,7 @@ class CustomBrowser(Browser): class DlFreeFr(SimpleHoster): __name__ = "DlFreeFr" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.28" __pattern__ = r'http://(?:www\.)?dl\.free\.fr/(\w+|getfile\.pl\?file=/\w+)' @@ -79,21 +79,24 @@ class DlFreeFr(SimpleHoster): if content_type and content_type.startswith("text/html"): # Undirect acces to requested file, with a web page providing it (captcha) self.html = self.load(valid_url) - self.handleFree() + self.handleFree(pyfile) else: # Direct access to requested file for users using free.fr as Internet Service Provider. - self.download(valid_url, disposition=True) + self.link = valid_url + elif headers.get('code') == 404: self.offline() + else: self.fail(_("Invalid return code: ") + str(headers.get('code'))) - def handleFree(self): + def handleFree(self, pyfile): action, inputs = self.parseHtmlForm('action="getfile.pl"') adyoulike = AdYouLike(self) - inputs.update(adyoulike.challenge()) + response, challenge = adyoulike.challenge() + inputs.update(response) self.load("http://dl.free.fr/getfile.pl", post=inputs) headers = self.getLastHeaders() @@ -104,9 +107,10 @@ class DlFreeFr(SimpleHoster): cj.setCookie(m.group(4), m.group(1), m.group(2), m.group(3)) else: self.fail(_("Cookie error")) - location = headers.get("location") + + self.link = headers.get("location") + self.req.setCookieJar(cj) - self.download(location, disposition=True) else: self.fail(_("Invalid response")) diff --git a/module/plugins/hoster/DodanePl.py b/module/plugins/hoster/DodanePl.py index 2e58a9dd9..65d8452fa 100644 --- a/module/plugins/hoster/DodanePl.py +++ b/module/plugins/hoster/DodanePl.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo class DodanePl(DeadHoster): diff --git a/module/plugins/hoster/EasybytezCom.py b/module/plugins/hoster/EasybytezCom.py index 0d5905707..6ca45f545 100644 --- a/module/plugins/hoster/EasybytezCom.py +++ b/module/plugins/hoster/EasybytezCom.py @@ -16,8 +16,6 @@ class EasybytezCom(XFSHoster): ("stickell", "l.stickell@yahoo.it")] - HOSTER_DOMAIN = "easybytez.com" - OFFLINE_PATTERN = r'>File not available' LINK_PATTERN = r'(http://(\w+\.(easybytez|easyload|ezbytez|zingload)\.(com|to)|\d+\.\d+\.\d+\.\d+)/files/\d+/\w+/.+?)["\'<]' diff --git a/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py index 18649462a..76e55ae3c 100644 --- a/module/plugins/hoster/EdiskCz.py +++ b/module/plugins/hoster/EdiskCz.py @@ -8,9 +8,9 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class EdiskCz(SimpleHoster): __name__ = "EdiskCz" __type__ = "hoster" - __version__ = "0.22" + __version__ = "0.23" - __pattern__ = r'http://(?:www\.)?edisk\.(cz|sk|eu)/(stahni|sk/stahni|en/download)/.*' + __pattern__ = r'http://(?:www\.)?edisk\.(cz|sk|eu)/(stahni|sk/stahni|en/download)/.+' __description__ = """Edisk.cz hoster plugin""" __license__ = "GPLv3" @@ -21,7 +21,7 @@ class EdiskCz(SimpleHoster): OFFLINE_PATTERN = r'<h3>This file does not exist due to one of the following:</h3><ul><li>' ACTION_PATTERN = r'/en/download/(\d+/.*\.html)' - LINK_PATTERN = r'http://.*edisk\.cz.*\.html' + LINK_FREE_PATTERN = r'http://.*edisk\.cz.*\.html' def setup(self): @@ -47,7 +47,7 @@ class EdiskCz(SimpleHoster): "action": action }) - if not re.match(self.LINK_PATTERN, url): + if not re.match(self.LINK_FREE_PATTERN, url): self.fail(_("Unexpected server response")) self.download(url) diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 73b7f6fcd..41cc37087 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -8,60 +8,60 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class EuroshareEu(SimpleHoster): __name__ = "EuroshareEu" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.27" - __pattern__ = r'http://(?:www\.)?euroshare\.(eu|sk|cz|hu|pl)/file/.*' + __pattern__ = r'http://(?:www\.)?euroshare\.(eu|sk|cz|hu|pl)/file/.+' __description__ = """Euroshare.eu hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - INFO_PATTERN = r'<span style="float: left;"><strong>(?P<N>.+?)</strong> \((?P<S>.+?)\)</span>' + INFO_PATTERN = r'<span style="float: left;"><strong>(?P<N>.+?)</strong> \((?P<S>.+?)\)</span>' OFFLINE_PATTERN = ur'<h2>S.bor sa nena.iel</h2>|Požadovaná stránka neexistuje!' - FREE_URL_PATTERN = r'<a href="(/file/\d+/[^/]*/download/)"><div class="downloadButton"' - ERR_PARDL_PATTERN = r'<h2>Prebieha s.ahovanie</h2>|<p>Naraz je z jednej IP adresy mo.n. s.ahova. iba jeden s.bor' + LINK_FREE_PATTERN = r'<a href="(/file/\d+/[^/]*/download/)"><div class="downloadButton"' + + ERR_PARDL_PATTERN = r'<h2>Prebieha s.ahovanie</h2>|<p>Naraz je z jednej IP adresy mo.n. s.ahova. iba jeden s.bor' ERR_NOT_LOGGED_IN_PATTERN = r'href="/customer-zone/login/"' URL_REPLACEMENTS = [(r"(http://[^/]*\.)(sk|cz|hu|pl)/", r"\1eu/")] - def setup(self): - self.multiDL = self.resumeDownload = self.premium - self.req.setOption("timeout", 120) - - - def handlePremium(self): + def handlePremium(self, pyfile): if self.ERR_NOT_LOGGED_IN_PATTERN in self.html: self.account.relogin(self.user) self.retry(reason=_("User not logged in")) - self.download(self.pyfile.url.rstrip('/') + "/download/") + self.download(pyfile.url.rstrip('/') + "/download/") check = self.checkDownload({"login": re.compile(self.ERR_NOT_LOGGED_IN_PATTERN), - "json": re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) + "json" : re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) + if check == "login" or (check == "json" and self.lastCheck.group(1) == "Access token expired"): self.account.relogin(self.user) self.retry(reason=_("Access token expired")) + elif check == "json": self.fail(self.lastCheck.group(1)) - def handleFree(self): + def handleFree(self, pyfile): if re.search(self.ERR_PARDL_PATTERN, self.html) is not None: self.longWait(5 * 60, 12) - m = re.search(self.FREE_URL_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("FREE_URL_PATTERN not found")) - parsed_url = "http://euroshare.eu%s" % m.group(1) - self.logDebug("URL", parsed_url) - self.download(parsed_url, disposition=True) + self.error(_("LINK_FREE_PATTERN not found")) + + self.link = "http://euroshare.eu%s" % m.group(1) - check = self.checkDownload({"multi_dl": re.compile(self.ERR_PARDL_PATTERN)}) - if check == "multi_dl": + + def checkFile(self): + if self.checkDownload({"multi-dl": re.compile(self.ERR_PARDL_PATTERN)}) self.longWait(5 * 60, 12) + return super(EuroshareEu, self).checkFile() + getInfo = create_getInfo(EuroshareEu) diff --git a/module/plugins/hoster/ExashareCom.py b/module/plugins/hoster/ExashareCom.py new file mode 100644 index 000000000..536c09b6d --- /dev/null +++ b/module/plugins/hoster/ExashareCom.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo + + +class ExashareCom(XFSHoster): + __name__ = "ExashareCom" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'http://(?:www\.)?exashare\.com/\w{12}' + + __description__ = """Exashare.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + INFO_PATTERN = r'>(?P<NAME>.+?)<small>\( (?P<S>[\d.,]+) (?P<U>[\w^_]+)' + LINK_FREE_PATTERN = r'file: "(.+?)"' + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 + self.resumeDownload = self.premium + + + def handleFree(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m is None: + self.error(_("Free download link not found")) + else: + self.link = m.group(1) + + +getInfo = create_getInfo(ExashareCom) diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index a90e8ca86..f9f76b28b 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -4,15 +4,14 @@ import re from pyload.utils import json_loads -from pyload.plugin.hoster.UnrestrictLi import secondsToMidnight -from pyload.plugin.internal.captcha import ReCaptcha -from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, secondsToMidnight class ExtabitCom(SimpleHoster): __name__ = "ExtabitCom" __type__ = "hoster" - __version__ = "0.62" + __version__ = "0.65" __pattern__ = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P<ID>\w+)' @@ -26,10 +25,10 @@ class ExtabitCom(SimpleHoster): OFFLINE_PATTERN = r'>File not found<' TEMP_OFFLINE_PATTERN = r'>(File is temporary unavailable|No download mirror)<' - LINK_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/\w+/.*?)[\'"]' + LINK_FREE_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/\w+/.*?)[\'"]' - def handleFree(self): + def handleFree(self, pyfile): if r">Only premium users can download this file" in self.html: self.fail(_("Only premium users can download this file")) @@ -42,7 +41,7 @@ class ExtabitCom(SimpleHoster): self.logDebug("URL: " + self.req.http.lastEffectiveURL) m = re.match(self.__pattern__, self.req.http.lastEffectiveURL) - fileID = m.group('ID') if m else self.info('ID') + fileID = m.group('ID') if m else self.info['pattern']['ID'] m = re.search(r'recaptcha/api/challenge\?k=(\w+)', self.html) if m: @@ -51,7 +50,7 @@ class ExtabitCom(SimpleHoster): for _i in xrange(5): get_data = {"type": "recaptcha"} - get_data['challenge'], get_data['capture'] = recaptcha.challenge(captcha_key) + get_data['capture'], get_data['challenge'] = recaptcha.challenge(captcha_key) res = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) if "ok" in res: self.correctCaptcha() @@ -68,9 +67,9 @@ class ExtabitCom(SimpleHoster): self.html = self.load("http://extabit.com/file/%s%s" % (fileID, res['href'])) - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) url = m.group(1) self.download(url) diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index d48912a51..8f1b9e694 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -6,17 +6,17 @@ from random import randrange from urllib import unquote from pyload.utils import json_loads -from pyload.plugin.Hoster import Hoster +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -class FastixRu(Hoster): +class FastixRu(MultiHoster): __name__ = "FastixRu" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.09" - __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/(?P<ID>\w{24})' + __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/\w{24}' - __description__ = """Fastix hoster plugin""" + __description__ = """Fastix multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] @@ -33,44 +33,34 @@ class FastixRu(Hoster): def setup(self): self.chunkLimit = 3 - self.resumeDownload = True - def process(self, pyfile): - if re.match(self.__pattern__, pyfile.url): - new_url = pyfile.url - elif not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "Fastix") - self.fail(_("No Fastix account provided")) - else: - self.logDebug("Old URL: %s" % pyfile.url) - api_key = self.account.getAccountData(self.user) - api_key = api_key['api'] + def handlePremium(self, pyfile): + api_key = self.account.getAccountData(self.user) + api_key = api_key['api'] - page = self.load("http://fastix.ru/api_v2/", - get={'apikey': api_key, 'sub': "getdirectlink", 'link': pyfile.url}) - data = json_loads(page) + self.html = self.load("http://fastix.ru/api_v2/", + get={'apikey': api_key, 'sub': "getdirectlink", 'link': pyfile.url}) - self.logDebug("Json data", data) + data = json_loads(self.html) - if "error\":true" in page: - self.offline() - else: - new_url = data['downloadlink'] + self.logDebug("Json data", data) - if new_url != pyfile.url: - self.logDebug("New URL: %s" % new_url) + if "error\":true" in self.html: + self.offline() + else: + self.link = data['downloadlink'] if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"): #only use when name wasnt already set - pyfile.name = self.getFilename(new_url) - - self.download(new_url, disposition=True) + pyfile.name = self.getFilename(self.link) - check = self.checkDownload({"error": "<title>An error occurred while processing your request</title>", - "empty": re.compile(r"^$")}) - if check == "error": + def checkFile(self): + if self.checkDownload({"error": "<title>An error occurred while processing your request</title>"}): self.retry(wait_time=60, reason=_("An error occurred while generating link")) - elif check == "empty": - self.retry(wait_time=60, reason=_("Downloaded File was empty")) + + return super(FastixRu, self).checkFile() + + +getInfo = create_getInfo(FastixRu) diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 7479e6414..6fe871ad4 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -4,13 +4,13 @@ import re from urlparse import urljoin -from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FastshareCz(SimpleHoster): __name__ = "FastshareCz" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.27" __pattern__ = r'http://(?:www\.)?fastshare\.cz/\d+/.+' @@ -45,7 +45,7 @@ class FastshareCz(SimpleHoster): self.info.pop('error', None) - def handleFree(self): + def handleFree(self, pyfile): m = re.search(self.FREE_URL_PATTERN, self.html) if m: action, captcha_src = m.groups() @@ -59,19 +59,21 @@ class FastshareCz(SimpleHoster): def checkFile(self): check = self.checkDownload({ - 'paralell_dl' : re.compile(r"<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)"), - 'wrong_captcha': re.compile(r'Download for FREE'), + 'paralell-dl' : re.compile(r"<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)"), + 'wrong captcha': re.compile(r'Download for FREE'), 'credit' : re.compile(self.CREDIT_ERROR) }) - if check == "paralell_dl": + if check == "paralell-dl": self.retry(6, 10 * 60, _("Paralell download")) - elif check == "wrong_captcha": + elif check == "wrong captcha": self.retry(max_tries=5, reason=_("Wrong captcha")) elif check == "credit": self.resetAccount() + return super(FastshareCz, self).checkFile() + getInfo = create_getInfo(FastshareCz) diff --git a/module/plugins/hoster/FileParadoxIn.py b/module/plugins/hoster/FileParadoxIn.py deleted file mode 100644 index 3020ac73d..000000000 --- a/module/plugins/hoster/FileParadoxIn.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo - - -class FileParadoxIn(XFSHoster): - __name__ = "FileParadoxIn" - __type__ = "hoster" - __version__ = "0.04" - - __pattern__ = r'https?://(?:www\.)?fileparadox\.in/\w{12}' - - __description__ = """FileParadox.in hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("RazorWing", "muppetuk1@hotmail.com")] - - - HOSTER_DOMAIN = "fileparadox.in" - - SIZE_PATTERN = r'</font>\s*\(\s*(?P<S>[^)]+)\s*\)</font>' - - -getInfo = create_getInfo(FileParadoxIn) diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py index 09a65ab2d..29c95ee8f 100644 --- a/module/plugins/hoster/FileSharkPl.py +++ b/module/plugins/hoster/FileSharkPl.py @@ -10,9 +10,9 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class FileSharkPl(SimpleHoster): __name__ = "FileSharkPl" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.07" - __pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d{6}/\w{5}' + __pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d+/\w+' __description__ = """FileShark.pl hoster plugin""" __license__ = "GPLv3" @@ -39,6 +39,7 @@ class FileSharkPl(SimpleHoster): def setup(self): self.resumeDownload = True + if self.premium: self.multiDL = True self.limitDL = 20 @@ -53,7 +54,7 @@ class FileSharkPl(SimpleHoster): errmsg = self.info['error'] = _("Another download already run") self.retry(15, int(m.group(1)), errmsg) - m = re.search(self.ERROR_PATTERN, self.html): + m = re.search(self.ERROR_PATTERN, self.html) if m: alert = m.group(1) @@ -72,14 +73,7 @@ class FileSharkPl(SimpleHoster): self.info.pop('error', None) - #@NOTE: handlePremium method was never been tested - def handlePremium(self): - super(FilerNet, self).handlePremium() - if self.link: - self.link = urljoin("http://fileshark.pl/", self.link) - - - def handleFree(self): + def handleFree(self, pyfile): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("Download url not found")) @@ -119,7 +113,6 @@ class FileSharkPl(SimpleHoster): check = self.checkDownload({'wrong_captcha': re.compile(r'<label for="form_captcha" generated="true" class="error">(.*?)</label>'), 'wait_pattern' : re.compile(self.SECONDS_PATTERN), 'DL-found' : re.compile('<a href="(.*)">')}) - if check == "DL-found": self.correctCaptcha() @@ -130,9 +123,11 @@ class FileSharkPl(SimpleHoster): elif check == "wait_pattern": self.retry() + return super(FileSharkPl, self).checkFile() + def _decode64(self, data, *args, **kwargs): - return data.decode("base64") + return data.decode('base64') getInfo = create_getInfo(FileSharkPl) diff --git a/module/plugins/hoster/FileStoreTo.py b/module/plugins/hoster/FileStoreTo.py index e69041172..8a5171219 100644 --- a/module/plugins/hoster/FileStoreTo.py +++ b/module/plugins/hoster/FileStoreTo.py @@ -8,7 +8,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class FileStoreTo(SimpleHoster): __name__ = "FileStoreTo" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.05" __pattern__ = r'http://(?:www\.)?filestore\.to/\?d=(?P<ID>\w+)' @@ -18,8 +18,9 @@ class FileStoreTo(SimpleHoster): ("stickell", "l.stickell@yahoo.it")] - INFO_PATTERN = r'File: <span[^>]*>(?P<N>.+)</span><br />Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' - OFFLINE_PATTERN = r'>Download-Datei wurde nicht gefunden<' + INFO_PATTERN = r'File: <span.*?>(?P<N>.+?)<.*>Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>Download-Datei wurde nicht gefunden<' + TEMP_OFFLINE_PATTERN = r'>Der Download ist nicht bereit !<' def setup(self): @@ -27,11 +28,10 @@ class FileStoreTo(SimpleHoster): self.multiDL = True - def handleFree(self): + def handleFree(self, pyfile): self.wait(10) - ldc = re.search(r'wert="(\w+)"', self.html).group(1) - link = self.load("http://filestore.to/ajax/download.php", get={"LDC": ldc}) - self.download(link) + self.link = self.load("http://filestore.to/ajax/download.php", + get={'D': re.search(r'"D=(\w+)', self.html).group(1)}) getInfo = create_getInfo(FileStoreTo) diff --git a/module/plugins/hoster/FilebeerInfo.py b/module/plugins/hoster/FilebeerInfo.py index 92813d833..51a0137a0 100644 --- a/module/plugins/hoster/FilebeerInfo.py +++ b/module/plugins/hoster/FilebeerInfo.py @@ -8,7 +8,7 @@ class FilebeerInfo(DeadHoster): __type__ = "hoster" __version__ = "0.03" - __pattern__ = r'http://(?:www\.)?filebeer\.info/(?!\d*~f)(?P<ID>\w+).*' + __pattern__ = r'http://(?:www\.)?filebeer\.info/(?!\d*~f)(?P<ID>\w+)' __description__ = """Filebeer.info plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 778116ec2..6fb153658 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -10,9 +10,9 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class FilecloudIo(SimpleHoster): __name__ = "FilecloudIo" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.08" - __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P<ID>\w+).*' + __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P<ID>\w+)' __description__ = """Filecloud.io hoster plugin""" __license__ = "GPLv3" @@ -20,17 +20,21 @@ class FilecloudIo(SimpleHoster): ("stickell", "l.stickell@yahoo.it")] - SIZE_PATTERN = r'{var __ab1 = (?P<S>\d+);}' - NAME_PATTERN = r'id="aliasSpan">(?P<N>.*?) <' - OFFLINE_PATTERN = r'l10n\.(FILES__DOESNT_EXIST|REMOVED)' + LOGIN_ACCOUNT = True + + NAME_PATTERN = r'id="aliasSpan">(?P<N>.*?) <' + SIZE_PATTERN = r'{var __ab1 = (?P<S>\d+);}' + OFFLINE_PATTERN = r'l10n\.(FILES__DOESNT_EXIST|REMOVED)' TEMP_OFFLINE_PATTERN = r'l10n\.FILES__WARNING' UKEY_PATTERN = r'\'ukey\'\s*:\'(\w+)' - AB1_PATTERN = r'if\( __ab1 == \'(\w+)\' \)' + AB1_PATTERN = r'if\( __ab1 == \'(\w+)\' \)' + ERROR_MSG_PATTERN = r'var __error_msg\s*=\s*l10n\.(.*?);' + RECAPTCHA_PATTERN = r'var __recaptcha_public\s*=\s*\'(.+?)\';' - LINK_PATTERN = r'"(http://s\d+\.filecloud\.io/%s/\d+/.*?)"' + LINK_FREE_PATTERN = r'"(http://s\d+\.filecloud\.io/%s/\d+/.*?)"' def setup(self): @@ -39,7 +43,7 @@ class FilecloudIo(SimpleHoster): self.chunkLimit = 1 - def handleFree(self): + def handleFree(self, pyfile): data = {"ukey": self.info['pattern']['ID']} m = re.search(self.AB1_PATTERN, self.html) @@ -55,14 +59,11 @@ class FilecloudIo(SimpleHoster): if captcha_key is None: self.error(_("ReCaptcha key not found")) - if not self.account: - self.fail(_("User not logged in")) - elif not self.account.logged_in: - challenge, response = recaptcha.challenge(captcha_key) - self.account.form_data = {"recaptcha_challenge_field": challenge, - "recaptcha_response_field" : response} - self.account.relogin(self.user) - self.retry(2) + response, challenge = recaptcha.challenge(captcha_key) + self.account.form_data = {"recaptcha_challenge_field": challenge, + "recaptcha_response_field" : response} + self.account.relogin(self.user) + self.retry(2) json_url = "http://filecloud.io/download-request.json" res = self.load(json_url, post=data) @@ -77,7 +78,7 @@ class FilecloudIo(SimpleHoster): data['ctype'] = "recaptcha" for _i in xrange(5): - data['recaptcha_challenge'], data['recaptcha_response'] = recaptcha.challenge(captcha_key) + data['recaptcha_response'], data['recaptcha_challenge'] = recaptcha.challenge(captcha_key) json_url = "http://filecloud.io/download-request.json" res = self.load(json_url, post=data) @@ -95,9 +96,9 @@ class FilecloudIo(SimpleHoster): if res['dl']: self.html = self.load('http://filecloud.io/download.html') - m = re.search(self.LINK_PATTERN % self.info['pattern']['ID'], self.html) + m = re.search(self.LINK_FREE_PATTERN % self.info['pattern']['ID'], self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) if "size" in self.info and self.info['size']: self.check_data = {"size": int(self.info['size'])} @@ -108,7 +109,7 @@ class FilecloudIo(SimpleHoster): self.fail(_("Unexpected server response")) - def handlePremium(self): + def handlePremium(self, pyfile): akey = self.account.getAccountData(self.user)['akey'] ukey = self.info['pattern']['ID'] self.logDebug("Akey: %s | Ukey: %s" % (akey, ukey)) @@ -117,7 +118,7 @@ class FilecloudIo(SimpleHoster): self.logDebug("FetchDownloadUrl: " + rep) rep = json_loads(rep) if rep['status'] == 'ok': - self.download(rep['download_url'], disposition=True) + self.link = rep['download_url'] else: self.fail(rep['message']) diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 4c7bb7978..95d61cd6a 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -21,7 +21,7 @@ def getInfo(urls): class FilefactoryCom(SimpleHoster): __name__ = "FilefactoryCom" __type__ = "hoster" - __version__ = "0.52" + __version__ = "0.53" __pattern__ = r'https?://(?:www\.)?filefactory\.com/(file|trafficshare/\w+)/\w+' @@ -34,7 +34,7 @@ class FilefactoryCom(SimpleHoster): INFO_PATTERN = r'<div id="file_name"[^>]*>\s*<h2>(?P<N>[^<]+)</h2>\s*<div id="file_info">\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+) uploaded' OFFLINE_PATTERN = r'<h2>File Removed</h2>|This file is no longer available' - LINK_PATTERN = r'"([^"]+filefactory\.com/get.+?)"' + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'"([^"]+filefactory\.com/get.+?)"' WAIT_PATTERN = r'<div id="countdown_clock" data-delay="(\d+)">' PREMIUM_ONLY_PATTERN = r'>Premium Account Required' @@ -42,49 +42,44 @@ class FilefactoryCom(SimpleHoster): COOKIES = [("filefactory.com", "locale", "en_US.utf8")] - def handleFree(self): + def handleFree(self, pyfile): if "Currently only Premium Members can download files larger than" in self.html: self.fail(_("File too large for free download")) elif "All free download slots on this server are currently in use" in self.html: self.retry(50, 15 * 60, _("All free slots are busy")) - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("Free download link not found")) - dl_link = m.group(1) + self.link = m.group(1) m = re.search(self.WAIT_PATTERN, self.html) if m: - self.wait(int(m.group(1))) + self.wait(m.group(1)) - self.download(dl_link, disposition=True) + def checkFile(self): check = self.checkDownload({'multiple': "You are currently downloading too many files at once.", - 'error': '<div id="errorMessage">'}) + 'error' : '<div id="errorMessage">'}) if check == "multiple": self.logDebug("Parallel downloads detected; waiting 15 minutes") self.retry(wait_time=15 * 60, reason=_("Parallel downloads")) + elif check == "error": self.error(_("Unknown error")) + return super(FilefactoryCom, self).checkFile() + - def handlePremium(self): - header = self.load(self.pyfile.url, just_header=True) + def handlePremium(self, pyfile): + self.link = self.directLink(self.load(pyfile.url, just_header=True)) - if 'location' in header: - url = header['location'].strip() - if not url.startswith("http://"): - url = urljoin("http://www.filefactory.com", url) - elif 'content-disposition' in header: - url = self.pyfile.url - else: - html = self.load(self.pyfile.url) - m = re.search(self.LINK_PATTERN, html) + if not self.link: + html = self.load(pyfile.url) + m = re.search(self.LINK_PREMIUM_PATTERN, html) if m: - url = m.group(1) + self.link = m.group(1) else: self.error(_("Premium download link not found")) - - self.download(url, disposition=True) diff --git a/module/plugins/hoster/FilejungleCom.py b/module/plugins/hoster/FilejungleCom.py index 5d493ed7c..cd890778b 100644 --- a/module/plugins/hoster/FilejungleCom.py +++ b/module/plugins/hoster/FilejungleCom.py @@ -9,7 +9,7 @@ class FilejungleCom(FileserveCom): __type__ = "hoster" __version__ = "0.51" - __pattern__ = r'http://(?:www\.)?filejungle\.com/f/(?P<id>[^/]+).*' + __pattern__ = r'http://(?:www\.)?filejungle\.com/f/(?P<ID>[^/]+)' __description__ = """Filejungle.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/FileomCom.py b/module/plugins/hoster/FileomCom.py index 9c379546d..23f059546 100644 --- a/module/plugins/hoster/FileomCom.py +++ b/module/plugins/hoster/FileomCom.py @@ -18,8 +18,6 @@ class FileomCom(XFSHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "fileom.com" - NAME_PATTERN = r'Filename: <span>(?P<N>.+?)<' SIZE_PATTERN = r'File Size: <span class="size">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 950474c06..89f7fe9a4 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -12,7 +12,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepostCom(SimpleHoster): __name__ = "FilepostCom" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.33" __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/(?P<ID>[^/]+)' @@ -29,7 +29,7 @@ class FilepostCom(SimpleHoster): FLP_TOKEN_PATTERN = r'set_store_options\({token: \'(.+?)\'' - def handleFree(self): + def handleFree(self, pyfile): m = re.search(self.FLP_TOKEN_PATTERN, self.html) if m is None: self.error(_("Token")) @@ -52,17 +52,20 @@ class FilepostCom(SimpleHoster): if 'var is_pass_exists = true;' in self.html: # Solve password - for file_pass in self.getPassword().splitlines(): + password = self.getPassword() + + if password: + self.logInfo(_("Password protected link, trying ") + file_pass) + get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' post_dict['file_pass'] = file_pass - self.logInfo(_("Password protected link, trying ") + file_pass) - download_url = self.getJsonResponse(get_dict, post_dict, 'link') - if download_url: - break + self.link = self.getJsonResponse(get_dict, post_dict, 'link') + if not self.link: + self.fail(_("Incorrect password")) else: - self.fail(_("No or incorrect password")) + self.fail(_("No password found")) else: # Solve recaptcha @@ -71,7 +74,7 @@ class FilepostCom(SimpleHoster): for i in xrange(5): get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' if i: - post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field'] = recaptcha.challenge( + post_dict['recaptcha_response_field'], post_dict['recaptcha_challenge_field'] = recaptcha.challenge( captcha_key) self.logDebug(u"RECAPTCHA: %s : %s : %s" % ( captcha_key, post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field'])) @@ -109,9 +112,9 @@ class FilepostCom(SimpleHoster): self.retry(wait_time=res['js']['params']['next_download']) # ~? self.retry(wait_time=js_answer['params']['next_download']) - elif ('Wrong file password' in res['js']['error'] - or 'You entered a wrong CAPTCHA code' in res['js']['error'] - or 'CAPTCHA Code nicht korrekt' in res['js']['error']): + elif 'Wrong file password' in res['js']['error'] \ + or 'You entered a wrong CAPTCHA code' in res['js']['error'] \ + or 'CAPTCHA Code nicht korrekt' in res['js']['error']: return None elif 'CAPTCHA' in res['js']['error']: diff --git a/module/plugins/hoster/FilepupNet.py b/module/plugins/hoster/FilepupNet.py index 65ac7a8f9..6ac9994cc 100644 --- a/module/plugins/hoster/FilepupNet.py +++ b/module/plugins/hoster/FilepupNet.py @@ -12,7 +12,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepupNet(SimpleHoster): __name__ = "FilepupNet" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?filepup\.net/files/\w+' @@ -27,7 +27,7 @@ class FilepupNet(SimpleHoster): OFFLINE_PATTERN = r'>This file has been deleted' - LINK_PATTERN = r'(http://www\.filepup\.net/get/.+?)\'' + LINK_FREE_PATTERN = r'(http://www\.filepup\.net/get/.+?)\'' def setup(self): @@ -35,17 +35,13 @@ class FilepupNet(SimpleHoster): self.chunkLimit = 1 - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) + def handleFree(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("Download link not found")) dl_link = m.group(1) self.download(dl_link, post={'task': "download"}) - check = self.checkDownload({'html': re.compile("html")}) - if check == "html": - self.error(_("Downloaded file is an html page")) - getInfo = create_getInfo(FilepupNet) diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py index 9a1008759..85ff7da33 100644 --- a/module/plugins/hoster/FilerNet.py +++ b/module/plugins/hoster/FilerNet.py @@ -4,6 +4,7 @@ # http://filer.net/get/ivgf5ztw53et3ogd # http://filer.net/get/hgo14gzcng3scbvv +import pycurl import re from urlparse import urljoin @@ -15,13 +16,13 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class FilerNet(SimpleHoster): __name__ = "FilerNet" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.16" __pattern__ = r'https?://(?:www\.)?filer\.net/get/\w+' __description__ = """Filer.net hoster plugin""" __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it") + __authors__ = [("stickell", "l.stickell@yahoo.it"), ("Walter Purcaro", "vuolter@gmail.com")] @@ -41,40 +42,33 @@ class FilerNet(SimpleHoster): self.info.pop('error', None) - def handleFree(self): + def handleFree(self, pyfile): inputs = self.parseHtmlForm(input_names={'token': re.compile(r'.+')})[1] if 'token' not in inputs: self.error(_("Unable to detect token")) - self.html = self.load(self.pyfile.url, post={'token': inputs['token']}, decode=True) + self.html = self.load(pyfile.url, post={'token': inputs['token']}, decode=True) inputs = self.parseHtmlForm(input_names={'hash': re.compile(r'.+')})[1] if 'hash' not in inputs: self.error(_("Unable to detect hash")) - recaptcha = ReCaptcha(self) - - for _i in xrange(5): - challenge, response = recaptcha.challenge() - - header = self.load(self.pyfile.url, - post={'recaptcha_challenge_field': challenge, - 'recaptcha_response_field' : response, - 'hash' : inputs['hash']}) - - if 'location' in header and header['location']: - self.correctCaptcha() - self.link = header['location'] - return - else: - self.invalidCaptcha() - - - def downloadLink(self, link): - if not link: - return - - self.download(urljoin("http://filer.net/", link), disposition=True) + recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge() + + #@NOTE: Work-around for v0.4.9 just_header issue + #@TODO: Check for v0.4.10 + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) + self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response, + 'hash' : inputs['hash']}) + self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) + + if 'location' in self.req.http.header.lower(): + self.link = re.search(r'location: (\S+)', self.req.http.header, re.I).group(1) + self.correctCaptcha() + else: + self.invalidCaptcha() getInfo = create_getInfo(FilerNet) diff --git a/module/plugins/hoster/FilerioCom.py b/module/plugins/hoster/FilerioCom.py index b43247c9d..12b7e7705 100644 --- a/module/plugins/hoster/FilerioCom.py +++ b/module/plugins/hoster/FilerioCom.py @@ -15,8 +15,6 @@ class FilerioCom(XFSHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "filerio.in" - URL_REPLACEMENTS = [(r'filekeen\.com', "filerio.in")] OFFLINE_PATTERN = r'>"File Not Found|File has been removed' diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index d93a2eada..09da46b01 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -32,9 +32,9 @@ def getInfo(urls): class FilesMailRu(Hoster): __name__ = "FilesMailRu" __type__ = "hoster" - __version__ = "0.31" + __version__ = "0.32" - __pattern__ = r'http://(?:www\.)?files\.mail\.ru/.*' + __pattern__ = r'http://(?:www\.)?files\.mail\.ru/.+' __description__ = """Files.mail.ru hoster plugin""" __license__ = "GPLv3" @@ -42,8 +42,7 @@ class FilesMailRu(Hoster): def setup(self): - if not self.account: - self.multiDL = False + self.multiDL = bool(self.account) def process(self, pyfile): diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 782f09188..cc977ac25 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -2,13 +2,13 @@ import re -from pyload.utils import json_loads -from pyload.network.RequestFactory import getURL -from pyload.plugin.Hoster import Hoster -from pyload.plugin.Plugin import chunks -from pyload.plugin.hoster.UnrestrictLi import secondsToMidnight -from pyload.plugin.internal.captcha import ReCaptcha -from pyload.utils import parseFileSize +from module.common.json_layer import json_loads +from module.network.RequestFactory import getURL +from module.plugins.Hoster import Hoster +from module.plugins.Plugin import chunks +from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import secondsToMidnight +from module.utils import parseFileSize def checkFile(plugin, urls): @@ -33,9 +33,9 @@ def checkFile(plugin, urls): class FileserveCom(Hoster): __name__ = "FileserveCom" __type__ = "hoster" - __version__ = "0.52" + __version__ = "0.54" - __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<id>[^/]+).*' + __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P<ID>[^/]+)' __description__ = """Fileserve.com hoster plugin""" __license__ = "GPLv3" @@ -50,7 +50,7 @@ class FileserveCom(Hoster): LINKCHECK_TR = r'<tr>\s*(<td>http://www\.fileserve\.com/file/.*?)</tr>' LINKCHECK_TD = r'<td>(?:<[^>]*>| )*([^<]*)' - CAPTCHA_KEY_PATTERN = r'var reCAPTCHA_publickey=\'(?P<key>.+?)\'' + CAPTCHA_KEY_PATTERN = r'var reCAPTCHA_publickey=\'(.+?)\'' LONG_WAIT_PATTERN = r'<li class="title">You need to wait (\d+) (\w+) to start another download\.</li>' LINK_EXPIRED_PATTERN = r'Your download link has expired' DAILY_LIMIT_PATTERN = r'Your daily download limit has been reached' @@ -59,7 +59,7 @@ class FileserveCom(Hoster): def setup(self): self.resumeDownload = self.multiDL = self.premium - self.file_id = re.match(self.__pattern__, self.pyfile.url).group('id') + self.file_id = re.match(self.__pattern__, self.pyfile.url).group('ID') self.url = "%s%s" % (self.URLS[0], self.file_id) self.logDebug("File ID: %s URL: %s" % (self.file_id, self.url)) @@ -118,14 +118,16 @@ class FileserveCom(Hoster): self.logDebug(self.req.http.lastEffectiveURL) check = self.checkDownload({"expired": self.LINK_EXPIRED_PATTERN, - "wait": re.compile(self.LONG_WAIT_PATTERN), - "limit": self.DAILY_LIMIT_PATTERN}) + "wait" : re.compile(self.LONG_WAIT_PATTERN), + "limit" : self.DAILY_LIMIT_PATTERN}) if check == "expired": self.logDebug("Download link was expired") self.retry() + elif check == "wait": self.doLongWait(self.lastCheck) + elif check == "limit": self.logWarning(_("Download limited reached for today")) self.setWait(secondsToMidnight(gmt=2), True) @@ -155,11 +157,11 @@ class FileserveCom(Hoster): def doCaptcha(self): - captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group("key") + captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1) recaptcha = ReCaptcha(self) for _i in xrange(5): - challenge, response = recaptcha.challenge(captcha_key) + response, challenge = recaptcha.challenge(captcha_key) res = json_loads(self.load(self.URLS[2], post={'recaptcha_challenge_field' : challenge, 'recaptcha_response_field' : response, @@ -204,12 +206,9 @@ class FileserveCom(Hoster): self.download(premium_url or self.pyfile.url) - if not premium_url: - check = self.checkDownload({"login": re.compile(self.NOT_LOGGED_IN_PATTERN)}) - - if check == "login": - self.account.relogin(self.user) - self.retry(reason=_("Not logged in")) + if not premium_url and self.checkDownload({"login": re.compile(self.NOT_LOGGED_IN_PATTERN)}): + self.account.relogin(self.user) + self.retry(reason=_("Not logged in")) def getInfo(urls): diff --git a/module/plugins/hoster/FlyFilesNet.py b/module/plugins/hoster/FlyFilesNet.py index 2330ba786..5aff3e811 100644 --- a/module/plugins/hoster/FlyFilesNet.py +++ b/module/plugins/hoster/FlyFilesNet.py @@ -13,7 +13,7 @@ class FlyFilesNet(SimpleHoster): __type__ = "hoster" __version__ = "0.10" - __pattern__ = r'http://(?:www\.)?flyfiles\.net/.*' + __pattern__ = r'http://(?:www\.)?flyfiles\.net/.+' __description__ = """FlyFiles.net hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py index 002173b89..8d13ea0b7 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -8,9 +8,9 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class FourSharedCom(SimpleHoster): __name__ = "FourSharedCom" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.31" - __pattern__ = r'https?://(?:www\.)?4shared(\-china)?\.com/(account/)?(download|get|file|document|photo|video|audio|mp3|office|rar|zip|archive|music)/.+?/.*' + __pattern__ = r'https?://(?:www\.)?4shared(\-china)?\.com/(account/)?(download|get|file|document|photo|video|audio|mp3|office|rar|zip|archive|music)/.+' __description__ = """4Shared.com hoster plugin""" __license__ = "GPLv3" @@ -25,37 +25,38 @@ class FourSharedCom(SimpleHoster): NAME_REPLACEMENTS = [(r"&#(\d+).", lambda m: unichr(int(m.group(1))))] SIZE_REPLACEMENTS = [(",", "")] - DOWNLOAD_URL_PATTERN = r'name="d3link" value="(.*?)"' - DOWNLOAD_BUTTON_PATTERN = r'id="btnLink" href="(.*?)"' - FID_PATTERN = r'name="d3fid" value="(.*?)"' + DIRECT_LINK = False + LOGIN_ACCOUNT = True + LINK_FREE_PATTERN = r'name="d3link" value="(.*?)"' + LINK_BTN_PATTERN = r'id="btnLink" href="(.*?)"' - def handleFree(self): - if not self.account: - self.fail(_("User not logged in")) + ID_PATTERN = r'name="d3fid" value="(.*?)"' - m = re.search(self.DOWNLOAD_BUTTON_PATTERN, self.html) + + def handleFree(self, pyfile): + m = re.search(self.LINK_BTN_PATTERN, self.html) if m: link = m.group(1) else: - link = re.sub(r'/(download|get|file|document|photo|video|audio)/', r'/get/', self.pyfile.url) + link = re.sub(r'/(download|get|file|document|photo|video|audio)/', r'/get/', pyfile.url) self.html = self.load(link) - m = re.search(self.DOWNLOAD_URL_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("Download link")) - link = m.group(1) + + self.link = m.group(1) try: - m = re.search(self.FID_PATTERN, self.html) + m = re.search(self.ID_PATTERN, self.html) res = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % m.group(1)) self.logDebug(res) except Exception: pass self.wait(20) - self.download(link) getInfo = create_getInfo(FourSharedCom) diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index f11607591..9a11f933d 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -2,15 +2,15 @@ import re -from pyload.plugin.Hoster import Hoster -from pyload.plugin.hoster.UnrestrictLi import secondsToMidnight -from pyload.plugin.internal.captcha import ReCaptcha +from module.plugins.Hoster import Hoster +from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import secondsToMidnight class FreakshareCom(Hoster): __name__ = "FreakshareCom" __type__ = "hoster" - __version__ = "0.39" + __version__ = "0.40" __pattern__ = r'http://(?:www\.)?freakshare\.(net|com)/files/\S*?/' @@ -43,23 +43,27 @@ class FreakshareCom(Hoster): self.download(pyfile.url, post=self.req_opts) - check = self.checkDownload({"bad": "bad try", - "paralell": "> Sorry, you cant download more then 1 files at time. <", - "empty": "Warning: Unknown: Filename cannot be empty", - "wrong_captcha": "Wrong Captcha!", + check = self.checkDownload({"bad" : "bad try", + "paralell" : "> Sorry, you cant download more then 1 files at time. <", + "empty" : "Warning: Unknown: Filename cannot be empty", + "wrong_captcha" : "Wrong Captcha!", "downloadserver": "No Downloadserver. Please try again later!"}) if check == "bad": self.fail(_("Bad Try")) + elif check == "paralell": self.setWait(300, True) self.wait() self.retry() + elif check == "empty": self.fail(_("File not downloadable")) + elif check == "wrong_captcha": self.invalidCaptcha() self.retry() + elif check == "downloadserver": self.retry(5, 15 * 60, _("No Download server")) diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py index f65793dab..76ffca505 100644 --- a/module/plugins/hoster/FreeWayMe.py +++ b/module/plugins/hoster/FreeWayMe.py @@ -1,16 +1,16 @@ # -*- coding: utf-8 -*- -from pyload.plugin.Hoster import Hoster +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -class FreeWayMe(Hoster): +class FreeWayMe(MultiHoster): __name__ = "FreeWayMe" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.16" - __pattern__ = r'https://(?:www\.)?free-way\.me/.*' + __pattern__ = r'https://(?:www\.)?free-way\.me/.+' - __description__ = """FreeWayMe hoster plugin""" + __description__ = """FreeWayMe multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Nicolas Giese", "james@free-way.me")] @@ -21,16 +21,33 @@ class FreeWayMe(Hoster): self.chunkLimit = 1 - def process(self, pyfile): - if not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "FreeWayMe") - self.fail(_("No FreeWay account provided")) - - self.logDebug("Old URL: %s" % pyfile.url) - - (user, data) = self.account.selectAccount() - - self.download( - "https://www.free-way.me/load.php", - get={"multiget": 7, "url": pyfile.url, "user": user, "pw": self.account.getpw(user), "json": ""}, - disposition=True) + def handlePremium(self, pyfile): + user, data = self.account.selectAccount() + + for _i in xrange(5): + # try it five times + header = self.load("https://www.free-way.me/load.php", + get={'multiget': 7, + 'url' : pyfile.url, + 'user' : user, + 'pw' : self.account.getAccountData(user)['password'], + 'json' : ""}, + just_header=True) + + if 'location' in header: + headers = self.load(header['location'], just_header=True) + if headers['code'] == 500: + # error on 2nd stage + self.logError(_("Error [stage2]")) + else: + # seems to work.. + self.download(header['location']) + break + else: + # error page first stage + self.logError(_("Error [stage1]")) + + #@TODO: handle errors + + +getInfo = create_getInfo(FreeWayMe) diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 6647a58b7..186cb2f87 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -3,6 +3,7 @@ import re from time import strptime, mktime, gmtime +from urlparse import urljoin from pyload.network.RequestFactory import getURL from pyload.plugin.internal.SimpleHoster import SimpleHoster, parseFileInfo @@ -24,9 +25,9 @@ def doubleDecode(m): class FshareVn(SimpleHoster): __name__ = "FshareVn" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.20" - __pattern__ = r'http://(?:www\.)?fshare\.vn/file/.*' + __pattern__ = r'http://(?:www\.)?fshare\.vn/file/.+' __description__ = """FshareVn hoster plugin""" __license__ = "GPLv3" @@ -38,63 +39,57 @@ class FshareVn(SimpleHoster): NAME_REPLACEMENTS = [("(.*)", doubleDecode)] - LINK_PATTERN = r'action="(http://download.*?)[#"]' + LINK_FREE_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", - "arrlinks": pyfile.url - }, decode=True) - self.getFileInfo() + def preload(self): + self.html = self.load("http://www.fshare.vn/check_link.php", + post={'action': "check_link", 'arrlinks': pyfile.url}, + decode=True) - if self.premium: - self.handlePremium() - else: - self.handleFree() - self.checkDownloadedFile() + if isinstance(self.TEXT_ENCODING, basestring): + self.html = unicode(self.html, self.TEXT_ENCODING) - def handleFree(self): - self.html = self.load(self.pyfile.url, decode=True) + def handleFree(self, pyfile): + self.html = self.load(pyfile.url, decode=True) self.checkErrors() action, inputs = self.parseHtmlForm('frm_download') - self.url = self.pyfile.url + action + url = urljoin(pyfile.url, action) if not inputs: self.error(_("No FORM")) + elif 'link_file_pwd_dl' in inputs: - for password in self.getPassword().splitlines(): + password = self.getPassword() + + if password: self.logInfo(_("Password protected link, trying ") + password) inputs['link_file_pwd_dl'] = password - self.html = self.load(self.url, post=inputs, decode=True) - if not 'name="link_file_pwd_dl"' in self.html: - break + self.html = self.load(url, post=inputs, decode=True) + + if 'name="link_file_pwd_dl"' in self.html: + self.fail(_("Incorrect password")) else: - self.fail(_("No or incorrect password")) + self.fail(_("No password found")) + else: - self.html = self.load(self.url, post=inputs, decode=True) + self.html = self.load(url, post=inputs, decode=True) self.checkErrors() m = re.search(r'var count = (\d+)', self.html) self.setWait(int(m.group(1)) if m else 30) - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) - self.url = m.group(1) - self.logDebug("FREE DL URL: %s" % self.url) + self.error(_("LINK_FREE_PATTERN not found")) + self.link = m.group(1) self.wait() - self.download(self.url) - - - def handlePremium(self): - self.download(self.pyfile.url) def checkErrors(self): @@ -113,13 +108,3 @@ class FshareVn(SimpleHoster): self.retry(30, 2 * 60, msg) self.info.pop('error', None) - - - def checkDownloadedFile(self): - # check download - check = self.checkDownload({ - "not_found": "<head><title>404 Not Found</title></head>" - }) - - if check == "not_found": - self.fail(_("File not m on server")) diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 4183f9b3c..6924c5910 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -12,7 +12,7 @@ from pyload.plugin.Hoster import Hoster class Ftp(Hoster): __name__ = "Ftp" __type__ = "hoster" - __version__ = "0.43" + __version__ = "0.46" __pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+' @@ -43,12 +43,11 @@ class Ftp(Hoster): if netloc in servers: self.logDebug("Logging on to %s" % netloc) - self.req.addAuth(self.account.accounts[netloc]['password']) + self.req.addAuth(self.account.getAccountInfo(netloc)['password']) else: - for pwd in self.getPassword().splitlines(): - if ":" in pwd: - self.req.addAuth(pwd.strip()) - break + pwd = self.getPassword() + if ':' in pwd: + self.req.addAuth(pwd) self.req.http.c.setopt(pycurl.NOBODY, 1) diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py index 405fe1937..d12084d42 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -10,7 +10,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class GigapetaCom(SimpleHoster): __name__ = "GigapetaCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?gigapeta\.com/dl/\w+' @@ -26,7 +26,7 @@ class GigapetaCom(SimpleHoster): COOKIES = [("gigapeta.com", "lang", "us")] - def handleFree(self): + def handleFree(self, pyfile): captcha_key = str(randint(1, 100000000)) captcha_url = "http://gigapeta.com/img/captcha.gif?x=%s" % captcha_key @@ -34,7 +34,7 @@ class GigapetaCom(SimpleHoster): self.checkErrors() captcha = self.decryptCaptcha(captcha_url) - self.html = self.load(self.pyfile.url, + self.html = self.load(pyfile.url, post={'captcha_key': captcha_key, 'captcha' : captcha, 'download' : "Download"}, diff --git a/module/plugins/hoster/GooIm.py b/module/plugins/hoster/GooIm.py index bd21178d2..331d63a99 100644 --- a/module/plugins/hoster/GooIm.py +++ b/module/plugins/hoster/GooIm.py @@ -11,7 +11,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class GooIm(SimpleHoster): __name__ = "GooIm" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'https?://(?:www\.)?goo\.im/.+' @@ -29,11 +29,9 @@ class GooIm(SimpleHoster): self.multiDL = True - def handleFree(self): - url = self.pyfile.url - self.html = self.load(url, cookies=True) + def handleFree(self, pyfile): self.wait(10) - self.download(url, cookies=True) + self.download(pyfile.url, cookies=True) getInfo = create_getInfo(GooIm) diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py new file mode 100644 index 000000000..0c8ca9c52 --- /dev/null +++ b/module/plugins/hoster/GoogledriveCom.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -* +# +# Test links: +# https://drive.google.com/file/d/0B6RNTe4ygItBQm15RnJiTmMyckU/view?pli=1 + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.utils import html_unescape + + +class GoogledriveCom(SimpleHoster): + __name__ = "GoogledriveCom" + __type__ = "hoster" + __version__ = "0.03" + + __pattern__ = r'https?://(?:www\.)?drive\.google\.com/file/.+' + + __description__ = """Drive.google.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + DISPOSITION = False + + NAME_PATTERN = r'"og:title" content="(?P<N>.*?)">' + OFFLINE_PATTERN = r'align="center"><p class="errorMessage"' + + + def setup(self): + self.multiDL = True + self.resumeDownload = True + self.chunkLimit = 1 + + + def handleFree(self, pyfile): + try: + link1 = re.search(r'"(https://docs.google.com/uc\?id.*?export=download)",', + self.html.decode('unicode-escape')).group(1) + + except AttributeError: + self.error(_("Hop #1 not found")) + + else: + self.logDebug("Next hop: %s" % link1) + + self.html = self.load(link1).decode('unicode-escape') + + try: + link2 = html_unescape(re.search(r'href="(/uc\?export=download.*?)">', + self.html).group(1)) + + except AttributeError: + self.error(_("Hop #2 not found")) + + else: + self.logDebug("Next hop: %s" % link2) + + link3 = self.load("https://docs.google.com" + link2, just_header=True) + self.logDebug("DL-Link: %s" % link3['location']) + + self.link = link3['location'] + + +getInfo = create_getInfo(GoogledriveCom) diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index b4f4f1f1c..8a00e01b0 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -import re +from urlparse import urljoin from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -8,41 +8,28 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class HellshareCz(SimpleHoster): __name__ = "HellshareCz" __type__ = "hoster" - __version__ = "0.83" + __version__ = "0.85" - __pattern__ = r'(http://(?:www\.)?hellshare\.(?:cz|com|sk|hu|pl)/[^?]*/\d+).*' + __pattern__ = r'http://(?:www\.)?hellshare\.(?:cz|com|sk|hu|pl)/[^?]*/\d+' __description__ = """Hellshare.cz hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<h1 id="filename"[^>]*>(?P<N>[^<]+)</h1>' - SIZE_PATTERN = r'<strong id="FileSize_master">(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' + CHECK_TRAFFIC = True + LOGIN_ACCOUNT = True + + NAME_PATTERN = r'<h1 id="filename"[^>]*>(?P<N>[^<]+)</h1>' + SIZE_PATTERN = r'<strong id="FileSize_master">(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' OFFLINE_PATTERN = r'<h1>File not found.</h1>' - SHOW_WINDOW_PATTERN = r'<a href="([^?]+/(\d+)/\?do=(fileDownloadButton|relatedFileDownloadButton-\2)-showDownloadWindow)"' + + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'<a href="([^?]+/(\d+)/\?do=(fileDownloadButton|relatedFileDownloadButton-\2)-showDownloadWindow)"' def setup(self): - self.resumeDownload = self.multiDL = True if self.account else False + self.resumeDownload = self.multiDL = bool(self.account) self.chunkLimit = 1 - def process(self, pyfile): - if not self.account: - self.fail(_("User not logged in")) - pyfile.url = re.match(self.__pattern__, pyfile.url).group(1) - self.html = self.load(pyfile.url, decode=True) - self.getFileInfo() - if not self.checkTrafficLeft(): - self.fail(_("Not enough traffic left for user ") + self.user) - - m = re.search(self.SHOW_WINDOW_PATTERN, self.html) - if m is None: - self.error(_("SHOW_WINDOW_PATTERN not found")) - - self.url = "http://www.hellshare.com" + m.group(1) - self.download(self.url) - - getInfo = create_getInfo(HellshareCz) diff --git a/module/plugins/hoster/HellspyCz.py b/module/plugins/hoster/HellspyCz.py index 984af3c4e..0d33b35b9 100644 --- a/module/plugins/hoster/HellspyCz.py +++ b/module/plugins/hoster/HellspyCz.py @@ -8,7 +8,7 @@ class HellspyCz(DeadHoster): __type__ = "hoster" __version__ = "0.28" - __pattern__ = r'http://(?:www\.)?(?:hellspy\.(?:cz|com|sk|hu|pl)|sciagaj\.pl)(/\S+/\d+)/?.*' + __pattern__ = r'http://(?:www\.)?(?:hellspy\.(?:cz|com|sk|hu|pl)|sciagaj\.pl)(/\S+/\d+)' __description__ = """HellSpy.cz hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/HugefilesNet.py b/module/plugins/hoster/HugefilesNet.py index 7b27f4ab6..f5085c8c3 100644 --- a/module/plugins/hoster/HugefilesNet.py +++ b/module/plugins/hoster/HugefilesNet.py @@ -17,8 +17,6 @@ class HugefilesNet(XFSHoster): __authors__ = [("stickell", "l.stickell@yahoo.it")] - HOSTER_DOMAIN = "hugefiles.net" - SIZE_PATTERN = r'File Size:</span>\s*<span[^>]*>(?P<S>[^<]+)</span></div>' FORM_INPUTS_MAP = {'ctype': re.compile(r'\d+')} diff --git a/module/plugins/hoster/HundredEightyUploadCom.py b/module/plugins/hoster/HundredEightyUploadCom.py index 4614dc54f..2edb6310d 100644 --- a/module/plugins/hoster/HundredEightyUploadCom.py +++ b/module/plugins/hoster/HundredEightyUploadCom.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -# -# Test links: -# http://180upload.com/js9qdm6kjnrs from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo @@ -18,10 +15,5 @@ class HundredEightyUploadCom(XFSHoster): __authors__ = [("stickell", "l.stickell@yahoo.it")] - HOSTER_DOMAIN = "180upload.com" - - NAME_PATTERN = r'Filename:</b></td><td nowrap>(?P<N>.+)</td></tr>-->' - SIZE_PATTERN = r'Size:</b></td><td>(?P<S>[\d.,]+) (?P<U>[\w^_]+)\s*<small>' - getInfo = create_getInfo(HundredEightyUploadCom) diff --git a/module/plugins/hoster/IcyFilesCom.py b/module/plugins/hoster/IcyFilesCom.py index 17aa1352c..201626fa5 100644 --- a/module/plugins/hoster/IcyFilesCom.py +++ b/module/plugins/hoster/IcyFilesCom.py @@ -8,7 +8,7 @@ class IcyFilesCom(DeadHoster): __type__ = "hoster" __version__ = "0.06" - __pattern__ = r'http://(?:www\.)?icyfiles\.com/(.*)' + __pattern__ = r'http://(?:www\.)?icyfiles\.com/(.+)' __description__ = """IcyFiles.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py index 8ccb35308..056b05a65 100644 --- a/module/plugins/hoster/IfileIt.py +++ b/module/plugins/hoster/IfileIt.py @@ -1,16 +1,12 @@ # -*- coding: utf-8 -*- -import re +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -from pyload.utils import json_loads -from pyload.plugin.internal.captcha import ReCaptcha -from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo - -class IfileIt(SimpleHoster): +class IfileIt(DeadHoster): __name__ = "IfileIt" __type__ = "hoster" - __version__ = "0.28" + __version__ = "0.29" __pattern__ = r'^unmatchable$' @@ -19,49 +15,4 @@ class IfileIt(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - LINK_PATTERN = r'</span> If it doesn\'t, <a target="_blank" href="([^"]+)">' - RECAPTCHA_PATTERN = r'var __recaptcha_public\s*=\s*\'(.+?)\'' - INFO_PATTERN = r'<span style="cursor: default;[^>]*>\s*(?P<N>.*?)\s* \s*<strong>\s*(?P<S>[\d.,]+)\s*(?P<U>[\w^_]+)\s*</strong>\s*</span>' - OFFLINE_PATTERN = r'<span style="cursor: default;[^>]*>\s* \s*<strong>\s*</strong>\s*</span>' - TEMP_OFFLINE_PATTERN = r'<span class="msg_red">Downloading of this file is temporarily disabled</span>' - - - def handleFree(self): - ukey = re.match(self.__pattern__, self.pyfile.url).group(1) - json_url = 'http://ifile.it/new_download-request.json' - post_data = {"ukey": ukey, "ab": "0"} - res = json_loads(self.load(json_url, post=post_data)) - - self.logDebug(res) - - if res['status'] == 3: - self.offline() - - if res['captcha']: - captcha_key = re.search(self.RECAPTCHA_PATTERN, self.html).group(1) - - recaptcha = ReCaptcha(self) - post_data['ctype'] = "recaptcha" - - for _i in xrange(5): - challenge, response = recaptcha.challenge(captcha_key) - post_data.update({'recaptcha_challenge': challenge, - 'recaptcha_response' : response}) - res = json_loads(self.load(json_url, post=post_data)) - self.logDebug(res) - - if res['retry']: - self.invalidCaptcha() - else: - self.correctCaptcha() - break - else: - self.fail(_("Incorrect captcha")) - - if not "ticket_url" in res: - self.error(_("No download URL")) - - self.download(res['ticket_url']) - - getInfo = create_getInfo(IfileIt) diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index f31096a1c..33da64ba2 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -8,9 +8,9 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class IfolderRu(SimpleHoster): __name__ = "IfolderRu" __type__ = "hoster" - __version__ = "0.38" + __version__ = "0.39" - __pattern__ = r'http://(?:www\.)?(?:ifolder\.ru|rusfolder\.(?:com|net|ru))/(?:files/)?(?P<ID>\d+).*' + __pattern__ = r'http://(?:www\.)?(?:ifolder\.ru|rusfolder\.(?:com|net|ru))/(?:files/)?(?P<ID>\d+)' __description__ = """Ifolder.ru hoster plugin""" __license__ = "GPLv3" @@ -18,25 +18,27 @@ class IfolderRu(SimpleHoster): SIZE_REPLACEMENTS = [(u'Кб', 'KB'), (u'Мб', 'MB'), (u'Гб', 'GB')] - NAME_PATTERN = ur'(?:<div><span>)?Название:(?:</span>)? <b>(?P<N>[^<]+)</b><(?:/div|br)>' - SIZE_PATTERN = ur'(?:<div><span>)?Размер:(?:</span>)? <b>(?P<S>[^<]+)</b><(?:/div|br)>' + + NAME_PATTERN = ur'(?:<div><span>)?Название:(?:</span>)? <b>(?P<N>[^<]+)</b><(?:/div|br)>' + SIZE_PATTERN = ur'(?:<div><span>)?Размер:(?:</span>)? <b>(?P<S>[^<]+)</b><(?:/div|br)>' OFFLINE_PATTERN = ur'<p>Файл номер <b>[^<]*</b> (не найден|удален) !!!</p>' 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\'' - LINK_PATTERN = r'<a id="download_file_href" href="([^"]+)"' + + LINK_FREE_PATTERN = r'<a id="download_file_href" href="([^"]+)"' + WRONG_CAPTCHA_PATTERN = ur'<font color=Red>неверный код,<br>введите еще раз</font><br>' def setup(self): - self.resumeDownload = self.multiDL = True if self.account else False - self.chunkLimit = 1 + self.resumeDownload = self.multiDL = bool(self.account) + self.chunkLimit = 1 - def process(self, pyfile): - file_id = re.match(self.__pattern__, pyfile.url).group('ID') - self.html = self.load("http://rusfolder.com/%s" % file_id, cookies=True, decode=True) + def handleFree(self, pyfile): + self.html = self.load("http://rusfolder.com/%s" % self.info['pattern']['ID'], cookies=True, decode=True) self.getFileInfo() url = re.search(r"location\.href = '(http://ints\..*?=)'", self.html).group(1) @@ -68,9 +70,7 @@ class IfolderRu(SimpleHoster): else: self.fail(_("Invalid captcha")) - download_url = re.search(self.LINK_PATTERN, self.html).group(1) - self.correctCaptcha() - self.download(download_url) + self.link = re.search(self.LINK_PATTERN, self.html).group(1) getInfo = create_getInfo(IfolderRu) diff --git a/module/plugins/hoster/JumbofilesCom.py b/module/plugins/hoster/JumbofilesCom.py index cae54ba97..2331179bc 100644 --- a/module/plugins/hoster/JumbofilesCom.py +++ b/module/plugins/hoster/JumbofilesCom.py @@ -8,9 +8,9 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class JumbofilesCom(SimpleHoster): __name__ = "JumbofilesCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" - __pattern__ = r'http://(?:www\.)?jumbofiles\.com/(\w{12}).*' + __pattern__ = r'http://(?:www\.)?jumbofiles\.com/(?P<ID>\w{12})' __description__ = """JumboFiles.com hoster plugin""" __license__ = "GPLv3" @@ -19,7 +19,7 @@ class JumbofilesCom(SimpleHoster): INFO_PATTERN = r'<TR><TD>(?P<N>[^<]+?)\s*<small>\((?P<S>[\d.,]+)\s*(?P<U>[\w^_]+)' OFFLINE_PATTERN = r'Not Found or Deleted / Disabled due to inactivity or DMCA' - LINK_PATTERN = r'<meta http-equiv="refresh" content="10;url=(.+)">' + LINK_FREE_PATTERN = r'<meta http-equiv="refresh" content="10;url=(.+)">' def setup(self): @@ -27,12 +27,10 @@ class JumbofilesCom(SimpleHoster): self.multiDL = True - def handleFree(self): - ukey = re.match(self.__pattern__, self.pyfile.url).group(1) - post_data = {"id": ukey, "op": "download3", "rand": ""} + def handleFree(self, pyfile): + post_data = {"id": self.info['pattern']['ID'], "op": "download3", "rand": ""} html = self.load(self.pyfile.url, post=post_data, decode=True) - url = re.search(self.LINK_PATTERN, html).group(1) - self.download(url) + self.link = re.search(self.LINK_FREE_PATTERN, html).group(1) getInfo = create_getInfo(JumbofilesCom) diff --git a/module/plugins/hoster/JunocloudMe.py b/module/plugins/hoster/JunocloudMe.py index 80c1568ce..ad37b01e4 100644 --- a/module/plugins/hoster/JunocloudMe.py +++ b/module/plugins/hoster/JunocloudMe.py @@ -15,13 +15,9 @@ class JunocloudMe(XFSHoster): __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "junocloud.me" - URL_REPLACEMENTS = [(r'//(www\.)?junocloud', "//dl3.junocloud")] - SIZE_PATTERN = r'<p class="request_filesize">Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)</p>' - - OFFLINE_PATTERN = r'>No such file with this filename<' + OFFLINE_PATTERN = r'>No such file with this filename<' TEMP_OFFLINE_PATTERN = r'The page may have been renamed, removed or be temporarily unavailable.<' diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index 8f8e8cb67..3ed11aa13 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -2,20 +2,20 @@ import re -from urlparse import urljoin, urlparse +from urlparse import urljoin -from pyload.plugin.internal.captcha import ReCaptcha -from pyload.plugin.internal.SimpleHoster import _isDirectLink, SimpleHoster, create_getInfo +from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -class Keep2shareCc(SimpleHoster): - __name__ = "Keep2shareCc" +class Keep2ShareCc(SimpleHoster): + __name__ = "Keep2ShareCc" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.21" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P<ID>\w+)' - __description__ = """Keep2share.cc hoster plugin""" + __description__ = """Keep2Share.cc hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it"), ("Walter Purcaro", "vuolter@gmail.com")] @@ -29,7 +29,8 @@ class Keep2shareCc(SimpleHoster): 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' - LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'"([^"]+url.html?file=.+?)"|window\.location\.href = \'(.+?)\';' + LINK_FREE_PATTERN = r'"([^"]+url.html?file=.+?)"|window\.location\.href = \'(.+?)\';' + LINK_PREMIUM_PATTERN = r'window\.location\.href = \'(.+?)\';' CAPTCHA_PATTERN = r'src="(/file/captcha\.html.+?)"' @@ -56,7 +57,7 @@ class Keep2shareCc(SimpleHoster): # string to time convert courtesy of https://stackoverflow.com/questions/10663720 ftr = [3600, 60, 1] - wait_time = sum([a * b for a, b in zip(ftr, map(int, m.group(1).split(':')))]) + wait_time = sum(a * b for a, b in zip(ftr, map(int, m.group(1).split(':')))) self.wantReconnect = True self.retry(wait_time=wait_time, reason="Please wait to download this file") @@ -64,9 +65,9 @@ class Keep2shareCc(SimpleHoster): self.info.pop('error', None) - def handleFree(self): + def handleFree(self, pyfile): self.fid = re.search(r'<input type="hidden" name="slow_id" value="([^"]+)">', self.html).group(1) - self.html = self.load(self.pyfile.url, post={'yt0': '', 'slow_id': self.fid}) + self.html = self.load(pyfile.url, post={'yt0': '', 'slow_id': self.fid}) self.checkErrors() @@ -77,56 +78,35 @@ class Keep2shareCc(SimpleHoster): self.wait(30) - self.html = self.load(self.pyfile.url, post={'uniqueId': self.fid, 'free': 1}) - - self.checkErrors() + self.html = self.load(pyfile.url) m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_FREE_PATTERN not found")) + self.error(_("Free download link not found")) self.link = m.group(1) - - def handleCaptcha(self): recaptcha = ReCaptcha(self) + post_data = {'free' : 1, + 'freeDownloadRequest': 1, + 'uniqueId' : self.fid, + 'yt0' : ''} - for _i in xrange(5): - post_data = {'free' : 1, - 'freeDownloadRequest': 1, - 'uniqueId' : self.fid, - 'yt0' : ''} - - m = re.search(self.CAPTCHA_PATTERN, self.html) - if m: - captcha_url = urljoin(self.base, m.group(1)) - post_data['CaptchaForm[code]'] = self.decryptCaptcha(captcha_url) - else: - challenge, response = recaptcha.challenge() - post_data.update({'recaptcha_challenge_field': challenge, - 'recaptcha_response_field' : response}) - - self.html = self.load(self.pyfile.url, post=post_data) - - if 'recaptcha' not in self.html: - self.correctCaptcha() - break - else: - self.invalidCaptcha() + m = re.search(self.CAPTCHA_PATTERN, self.html) + if m: + captcha_url = urljoin("http://k2s.cc/", m.group(1)) + post_data['CaptchaForm[code]'] = self.decryptCaptcha(captcha_url) else: - self.fail(_("All captcha attempts failed")) + response, challenge = recaptcha.challenge() + post_data.update({'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) + self.html = self.load(self.pyfile.url, post=post_data) - def downloadLink(self, link): - if not link: - return - - p = urlparse(self.pyfile.url) - base = "%s://%s" % (p.scheme, p.netloc) - link = _isDirectLink(self, link, self.premium) - - if link: - self.download(urljoin(base, link), disposition=True) + if 'verification code is incorrect' not in self.html: + self.correctCaptcha() + else: + self.invalidCaptcha() -getInfo = create_getInfo(Keep2shareCc) +getInfo = create_getInfo(Keep2ShareCc) diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py index 050ee283f..73fa494b0 100644 --- a/module/plugins/hoster/KingfilesNet.py +++ b/module/plugins/hoster/KingfilesNet.py @@ -9,7 +9,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class KingfilesNet(SimpleHoster): __name__ = "KingfilesNet" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.07" __pattern__ = r'http://(?:www\.)?kingfiles\.net/(?P<ID>\w{12})' @@ -26,7 +26,7 @@ class KingfilesNet(SimpleHoster): RAND_ID_PATTERN = r'type=\"hidden\" name=\"rand\" value=\"(.+)\">' - LINK_PATTERN = r'var download_url = \'(.+)\';' + LINK_FREE_PATTERN = r'var download_url = \'(.+)\';' def setup(self): @@ -34,19 +34,19 @@ class KingfilesNet(SimpleHoster): self.multiDL = True - def handleFree(self): + def handleFree(self, pyfile): # Click the free user button post_data = {'op' : "download1", 'usr_login' : "", 'id' : self.info['pattern']['ID'], - 'fname' : self.pyfile.name, + 'fname' : pyfile.name, 'referer' : "", 'method_free': "+"} - self.html = self.load(self.pyfile.url, post=post_data, cookies=True, decode=True) + self.html = self.load(pyfile.url, post=post_data, cookies=True, decode=True) solvemedia = SolveMedia(self) - challenge, response = solvemedia.challenge() + response, challenge = solvemedia.challenge() # Make the downloadlink appear and load the file m = re.search(self.RAND_ID_PATTERN, self.html) @@ -59,24 +59,20 @@ class KingfilesNet(SimpleHoster): post_data = {'op' : "download2", 'id' : self.info['pattern']['ID'], 'rand' : rand, - 'referer' : self.pyfile.url, + 'referer' : pyfile.url, 'method_free' : "+", 'method_premium' : "", 'adcopy_response' : response, 'adcopy_challenge': challenge, 'down_direct' : "1"} - self.html = self.load(self.pyfile.url, post=post_data, cookies=True, decode=True) + self.html = self.load(pyfile.url, post=post_data, cookies=True, decode=True) - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("Download url not found")) - self.download(m.group(1), cookies=True, disposition=True) - - check = self.checkDownload({'html': re.compile("<html>")}) - if check == "html": - self.error(_("Downloaded file is an html page")) + self.link = m.group(1) getInfo = create_getInfo(KingfilesNet) diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index f6ec6fb34..2c725427d 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -8,25 +8,24 @@ import re -from urllib import urlencode, urlopen from urlparse import urljoin -from pyload.utils import json_loads, json_dumps -from pyload.plugin.hoster.UnrestrictLi import secondsToMidnight -from pyload.plugin.internal.captcha import ReCaptcha -from pyload.plugin.internal.SimpleHoster import SimpleHoster +from module.common.json_layer import json_loads, json_dumps +from module.network.RequestFactory import getURL +from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, secondsToMidnight -def api_download_info(url): +def api_response(url): json_data = ["yw7XQy2v9", ["download/info", {"link": url}]] - post_data = urlencode({'r': json_dumps(json_data)}) - api_rep = urlopen("http://api.letitbit.net/json", data=post_data).read() + api_rep = getURL("http://api.letitbit.net/json", + post={'r': json_dumps(json_data)}) return json_loads(api_rep) def getInfo(urls): for url in urls: - api_rep = api_download_info(url) + api_rep = api_response(url) if api_rep['status'] == 'OK': info = api_rep['data'][0] yield (info['name'], info['size'], 2, url) @@ -37,9 +36,9 @@ def getInfo(urls): class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.30" - __pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.*' + __pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.+' __description__ = """Letitbit.net hoster plugin""" __license__ = "GPLv3" @@ -50,7 +49,7 @@ class LetitbitNet(SimpleHoster): URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "letitbit.net")] SECONDS_PATTERN = r'seconds\s*=\s*(\d+);' - CAPTCHA_CONTROL_FIELD = r'recaptcha_control_field\s=\s\'(?P<value>.+?)\'' + CAPTCHA_CONTROL_FIELD = r'recaptcha_control_field\s=\s\'(.+?)\'' def setup(self): @@ -58,7 +57,7 @@ class LetitbitNet(SimpleHoster): def getFileInfo(self): - api_rep = api_download_info(self.pyfile.url) + api_rep = api_response(self.pyfile.url) if api_rep['status'] == 'OK': self.api_data = api_rep['data'][0] self.pyfile.name = self.api_data['name'] @@ -67,12 +66,12 @@ class LetitbitNet(SimpleHoster): self.offline() - def handleFree(self): + def handleFree(self, pyfile): action, inputs = self.parseHtmlForm('id="ifree_form"') if not action: self.error(_("ifree_form")) - self.pyfile.size = float(inputs['sssize']) + pyfile.size = float(inputs['sssize']) self.logDebug(action, inputs) inputs['desc'] = "" @@ -80,38 +79,52 @@ class LetitbitNet(SimpleHoster): m = re.search(self.SECONDS_PATTERN, self.html) seconds = int(m.group(1)) if m else 60 + self.logDebug("Seconds found", seconds) + m = re.search(self.CAPTCHA_CONTROL_FIELD, self.html) recaptcha_control_field = m.group(1) + self.logDebug("ReCaptcha control field found", recaptcha_control_field) + self.wait(seconds) res = self.load("http://letitbit.net/ajax/download3.php", post=" ", cookies=True) if res != '1': self.error(_("Unknown response - ajax_check_url")) + self.logDebug(res) recaptcha = ReCaptcha(self) - challenge, response = recaptcha.challenge() + response, challenge = recaptcha.challenge() post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, "recaptcha_control_field": recaptcha_control_field} + self.logDebug("Post data to send", post_data) + res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data, cookies=True) + self.logDebug(res) + if not res: self.invalidCaptcha() + if res == "error_free_download_blocked": self.logWarning(_("Daily limit reached")) self.wait(secondsToMidnight(gmt=2), True) + if res == "error_wrong_captcha": self.invalidCaptcha() self.retry() + elif res.startswith('['): urls = json_loads(res) + elif res.startswith('http://'): urls = [res] + else: self.error(_("Unknown response - captcha check")) @@ -127,11 +140,11 @@ class LetitbitNet(SimpleHoster): self.fail(_("Download did not finish correctly")) - def handlePremium(self): + def handlePremium(self, pyfile): api_key = self.user premium_key = self.account.getAccountData(self.user)['password'] - json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": self.pyfile.url}]] + json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": pyfile.url}]] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) self.logDebug("API Data: " + api_rep) api_rep = json_loads(api_rep) @@ -139,4 +152,4 @@ class LetitbitNet(SimpleHoster): if api_rep['status'] == 'FAIL': self.fail(api_rep['data']) - self.download(api_rep['data'][0][0], disposition=True) + self.link = api_rep['data'][0][0] diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 57acac758..5b0fab43a 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -4,73 +4,55 @@ import re from urlparse import urlsplit -from pyload.utils import json_loads, json_dumps -from pyload.plugin.Hoster import Hoster +from module.common.json_layer import json_loads, json_dumps +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -class LinksnappyCom(Hoster): +class LinksnappyCom(MultiHoster): __name__ = "LinksnappyCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.08" - __pattern__ = r'https?://(?:[^/]*\.)?linksnappy\.com' + __pattern__ = r'https?://(?:[^/]+\.)?linksnappy\.com' - __description__ = """Linksnappy.com hoster plugin""" + __description__ = """Linksnappy.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - SINGLE_CHUNK_HOSTERS = ('easybytez.com') + SINGLE_CHUNK_HOSTERS = ["easybytez.com"] - def setup(self): - self.chunkLimit = -1 - self.resumeDownload = True + def handlePremium(self, pyfile): + host = self._get_host(pyfile.url) + json_params = json_dumps({'link' : pyfile.url, + 'type' : host, + 'username': self.user, + 'password': self.account.getAccountData(self.user)['password']}) + r = self.load("http://gen.linksnappy.com/genAPI.php", + post={'genLinks': json_params}) - def process(self, pyfile): - if re.match(self.__pattern__, pyfile.url): - new_url = pyfile.url - elif not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "Linksnappy.com") - self.fail(_("No Linksnappy.com account provided")) - else: - self.logDebug("Old URL: %s" % pyfile.url) - host = self._get_host(pyfile.url) - json_params = json_dumps({'link': pyfile.url, - 'type': host, - 'username': self.user, - 'password': self.account.getAccountData(self.user)['password']}) - r = self.load('http://gen.linksnappy.com/genAPI.php', - post={'genLinks': json_params}) - self.logDebug("JSON data: " + r) - - j = json_loads(r)['links'][0] - - if j['error']: - msg = _("Error converting the link") - self.logError(msg, j['error']) - self.fail(msg) - - pyfile.name = j['filename'] - new_url = j['generated'] + self.logDebug("JSON data: " + r) - if host in self.SINGLE_CHUNK_HOSTERS: - self.chunkLimit = 1 - else: - self.setup() + j = json_loads(r)['links'][0] - if new_url != pyfile.url: - self.logDebug("New URL: " + new_url) + if j['error']: + self.error(_("Error converting the link")) - self.download(new_url, disposition=True) + pyfile.name = j['filename'] + self.link = j['generated'] - check = self.checkDownload({"html302": "<title>302 Found</title>"}) - if check == "html302": - self.retry(wait_time=5, reason=_("Linksnappy returns only HTML data")) + if host in self.SINGLE_CHUNK_HOSTERS: + self.chunkLimit = 1 + else: + self.setup() @staticmethod def _get_host(url): host = urlsplit(url).netloc return re.search(r'[\w-]+\.\w+$', host).group(0) + + +getInfo = create_getInfo(LinksnappyCom) diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py index 052d79214..0f344a88b 100644 --- a/module/plugins/hoster/LoadTo.py +++ b/module/plugins/hoster/LoadTo.py @@ -13,7 +13,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class LoadTo(SimpleHoster): __name__ = "LoadTo" __type__ = "hoster" - __version__ = "0.18" + __version__ = "0.22" __pattern__ = r'http://(?:www\.)?load\.to/\w+' @@ -27,7 +27,7 @@ class LoadTo(SimpleHoster): SIZE_PATTERN = r'Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>Can\'t find file' - LINK_PATTERN = r'<form method="post" action="(.+?)"' + LINK_FREE_PATTERN = r'<form method="post" action="(.+?)"' WAIT_PATTERN = r'type="submit" value="Download \((\d+)\)"' URL_REPLACEMENTS = [(r'(\w)$', r'\1/')] @@ -38,38 +38,31 @@ class LoadTo(SimpleHoster): self.chunkLimit = 1 - def handleFree(self): + def handleFree(self, pyfile): # Search for Download URL - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) download_url = m.group(1) # Set Timer - may be obsolete m = re.search(self.WAIT_PATTERN, self.html) if m: - self.wait(int(m.group(1))) + self.wait(m.group(1)) # Load.to is using solvemedia captchas since ~july 2014: - solvemedia = SolveMedia(self) + solvemedia = SolveMedia(self) captcha_key = solvemedia.detect_key() if captcha_key is None: self.download(download_url) else: - challenge, response = solvemedia.challenge(captcha_key) - - self.download(download_url, post={"adcopy_challenge": challenge, "adcopy_response": response}) - - check = self.checkDownload({'404': re.compile("\A<h1>404 Not Found</h1>"), 'html': re.compile("html")}) - - if check == "404": - self.invalidCaptcha() - self.retry() - elif check == "html": - self.logWarning(_("Downloaded file is an html page, will retry")) - self.retry() + response, challenge = solvemedia.challenge(captcha_key) + self.download(download_url, + post={'adcopy_challenge': challenge, + 'adcopy_response' : response, + 'returnUrl' : pyfile.url}) getInfo = create_getInfo(LoadTo) diff --git a/module/plugins/hoster/LomafileCom.py b/module/plugins/hoster/LomafileCom.py index 18f9a7ad8..475cdacaa 100644 --- a/module/plugins/hoster/LomafileCom.py +++ b/module/plugins/hoster/LomafileCom.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -class LomafileCom(XFSHoster): +class LomafileCom(DeadHoster): __name__ = "LomafileCom" __type__ = "hoster" - __version__ = "0.51" + __version__ = "0.52" __pattern__ = r'http://lomafile\.com/\w{12}' @@ -16,15 +16,4 @@ class LomafileCom(XFSHoster): ("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "lomafile.com" - - NAME_PATTERN = r'<a href="http://lomafile\.com/w{12}/(?P<N>.+?)">' - SIZE_PATTERN = r'Size:</b></td><td>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' - - OFFLINE_PATTERN = r'>(No such file|Software error:<)' - TEMP_OFFLINE_PATTERN = r'The page may have been renamed, removed or be temporarily unavailable.<' - - CAPTCHA_PATTERN = r'(http://lomafile\.com/captchas/[^"\']+)' - - getInfo = create_getInfo(LomafileCom) diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index 5025bd7d4..33f8ab393 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -11,7 +11,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class LuckyShareNet(SimpleHoster): __name__ = "LuckyShareNet" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.06" __pattern__ = r'https?://(?:www\.)?luckyshare\.net/(?P<ID>\d{10,})' @@ -41,17 +41,18 @@ class LuckyShareNet(SimpleHoster): # TODO: There should be a filesize limit for free downloads # TODO: Some files could not be downloaded in free mode - def handleFree(self): + def handleFree(self, pyfile): rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + self.info['pattern']['ID'], decode=True) + self.logDebug("JSON: " + rep) - json = self.parseJson(rep) - self.wait(int(json['time'])) + json = self.parseJson(rep) + self.wait(json['time']) recaptcha = ReCaptcha(self) for _i in xrange(5): - challenge, response = recaptcha.challenge() + response, challenge = recaptcha.challenge() rep = self.load(r"http://luckyshare.net/download/verify/challenge/%s/response/%s/hash/%s" % (challenge, response, json['hash']), decode=True) self.logDebug("JSON: " + rep) diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index e14b16d8e..5adf004d0 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -15,23 +15,28 @@ def checkHTMLHeader(url): try: for _i in xrange(3): header = getURL(url, just_header=True) + for line in header.splitlines(): line = line.lower() + if 'location' in line: url = line.split(':', 1)[1].strip() if 'error.php?errno=320' in url: return url, 1 + if not url.startswith('http://'): url = 'http://www.mediafire.com' + url + break + elif 'content-disposition' in line: return url, 2 else: break except Exception: return url, 3 - - return url, 0 + else: + return url, 0 def getInfo(urls): @@ -49,7 +54,7 @@ def getInfo(urls): class MediafireCom(SimpleHoster): __name__ = "MediafireCom" __type__ = "hoster" - __version__ = "0.80" + __version__ = "0.84" __pattern__ = r'http://(?:www\.)?mediafire\.com/(file/|(view/?|download\.php)?\?)(\w{11}|\w{15})($|/)' @@ -59,16 +64,12 @@ class MediafireCom(SimpleHoster): ("stickell", "l.stickell@yahoo.it")] - LINK_PATTERN = r'<div class="download_link"[^>]*(?:z-index:(?P<zindex>\d+))?[^>]*>\s*<a href="(?P<href>http://[^"]+)"' - JS_KEY_PATTERN = r'DoShow\(\'mfpromo1\'\);[^{]*{((\w+)=\'\';.*?)eval\(\2\);' - JS_ZMODULO_PATTERN = r'\(\'z-index\'\)\) \% (\d+)\)\);' - PAGE1_ACTION_PATTERN = r'<link rel="canonical" href="([^"]+)"/>' - PASSWORD_PATTERN = r'<form name="form_password"' - - NAME_PATTERN = r'<META NAME="description" CONTENT="(?P<N>[^"]+)"/>' - INFO_PATTERN = r'oFileSharePopup\.ald\(\'(?P<ID>[^\']*)\',\'(?P<N>[^\']*)\',\'(?P<S>[^\']*)\',\'\',\'(?P<sha256>[^\']*)\'\)' + NAME_PATTERN = r'<META NAME="description" CONTENT="(?P<N>[^"]+)"/>' + INFO_PATTERN = r'oFileSharePopup\.ald\(\'(?P<ID>[^\']*)\',\'(?P<N>[^\']*)\',\'(?P<S>[^\']*)\',\'\',\'(?P<H>[^\']*)\'\)' OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>' + PASSWORD_PATTERN = r'<form name="form_password"' + def setup(self): self.multiDL = False @@ -77,35 +78,38 @@ class MediafireCom(SimpleHoster): def process(self, pyfile): pyfile.url = re.sub(r'/view/?\?', '/?', pyfile.url) - self.url, result = checkHTMLHeader(pyfile.url) - self.logDebug("Location (%d): %s" % (result, self.url)) + self.link, result = checkHTMLHeader(pyfile.url) + self.logDebug("Location (%d): %s" % (result, self.link)) if result == 0: - self.html = self.load(self.url, decode=True) + self.html = self.load(self.link, decode=True) self.checkCaptcha() self.multiDL = True self.check_data = self.getFileInfo() if self.account: - self.handlePremium() + self.handlePremium(pyfile) else: - self.handleFree() + self.handleFree(pyfile) elif result == 1: self.offline() else: self.multiDL = True - self.download(self.url, disposition=True) + self.download(self.link, disposition=True) + + def handleFree(self, pyfile): + if self.PASSWORD_PATTERN in self.html: + password = self.getPassword() - def handleFree(self): - passwords = self.getPassword().splitlines() - while self.PASSWORD_PATTERN in self.html: - if len(passwords): - password = passwords.pop(0) + if password: self.logInfo(_("Password protected link, trying ") + password) - self.html = self.load(self.url, post={"downloadp": password}) + self.html = self.load(self.link, post={"downloadp": password}) + + if self.PASSWORD_PATTERN in self.html: + self.fail(_("Incorrect password")) else: - self.fail(_("No or incorrect password")) + self.fail(_("No password found")) m = re.search(r'kNO = r"(http://.*?)";', self.html) if m is None: @@ -117,8 +121,8 @@ class MediafireCom(SimpleHoster): def checkCaptcha(self): solvemedia = SolveMedia(self) - challenge, response = solvemedia.challenge() - self.html = self.load(self.url, + response, challenge = solvemedia.challenge() + self.html = self.load(self.link, post={'adcopy_challenge': challenge, 'adcopy_response' : response}, decode=True) diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index 5fe1315be..4ad20b265 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -1,18 +1,20 @@ # -*- coding: utf-8 -*- +import os import random import re from array import array from base64 import standard_b64decode -from os import remove from Crypto.Cipher import AES from Crypto.Util import Counter -from pycurl import SSL_CIPHER_LIST +# from pycurl import SSL_CIPHER_LIST + +from module.common.json_layer import json_loads, json_dumps +from module.plugins.Hoster import Hoster +from module.utils import decode, fs_decode, fs_encode -from pyload.utils import json_loads, json_dumps -from pyload.plugin.Hoster import Hoster ############################ General errors ################################### # EINTERNAL (-1): An internal error has occurred. Please submit a bug report, detailing the exact circumstances in which this error occurred @@ -46,15 +48,17 @@ from pyload.plugin.Hoster import Hoster class MegaCoNz(Hoster): __name__ = "MegaCoNz" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.26" - __pattern__ = r'https?://(\w+\.)?mega\.co\.nz/#!([\w!-]+)' + __pattern__ = r'(?:https?://(?:www\.)?mega\.co\.nz/|mega:|chrome:.+?)#(?P<TYPE>N|)!(?P<ID>[\w^_]+)!(?P<KEY>[\w,\\-]+)' __description__ = """Mega.co.nz hoster plugin""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "ranan@pyload.org")] + __authors__ = [("RaNaN", "ranan@pyload.org"), + ("Walter Purcaro", "vuolter@gmail.com")] + - API_URL = "https://g.api.mega.co.nz/cs" + API_URL = "https://eu.api.mega.co.nz/cs" FILE_SUFFIX = ".crypted" @@ -65,13 +69,18 @@ class MegaCoNz(Hoster): def getCipherKey(self, key): """ Construct the cipher key from the given data """ - a = array("I", key) - key_array = array("I", [a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7]]) - return key_array + a = array("I", self.b64_decode(key)) + + k = array("I", (a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7])) + iv = a[4:6] + array("I", (0, 0)) + meta_mac = a[6:8] + return k, iv, meta_mac - def callApi(self, **kwargs): + + def api_response(self, **kwargs): """ Dispatch a call to the api, see https://mega.co.nz/#developers """ + # generate a session id, no idea where to obtain elsewhere uid = random.randint(10 << 9, 10 ** 10) @@ -81,9 +90,11 @@ class MegaCoNz(Hoster): def decryptAttr(self, data, key): - cbc = AES.new(self.getCipherKey(key), AES.MODE_CBC, "\0" * 16) - attr = cbc.decrypt(self.b64_decode(data)) - self.logDebug("Decrypted Attr: " + attr) + k, iv, meta_mac = self.getCipherKey(key) + cbc = AES.new(k, AES.MODE_CBC, "\0" * 16) + attr = decode(cbc.decrypt(self.b64_decode(data))) + + self.logDebug("Decrypted Attr: %s" % attr) if not attr.startswith("MEGA"): self.fail(_("Decryption failed")) @@ -95,76 +106,111 @@ class MegaCoNz(Hoster): """ Decrypts the file at lastDownload` """ # upper 64 bit of counter start - n = key[16:24] + n = self.b64_decode(key)[16:24] # convert counter to long and shift bytes - ctr = Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64) - cipher = AES.new(self.getCipherKey(key), AES.MODE_CTR, counter=ctr) + k, iv, meta_mac = self.getCipherKey(key) + ctr = Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64) + cipher = AES.new(k, AES.MODE_CTR, counter=ctr) self.pyfile.setStatus("decrypting") + self.pyfile.setProgress(0) - file_crypted = self.lastDownload + file_crypted = fs_encode(self.lastDownload) file_decrypted = file_crypted.rsplit(self.FILE_SUFFIX)[0] try: - f = open(file_crypted, "rb") + f = open(file_crypted, "rb") df = open(file_decrypted, "wb") + except IOError, e: - self.fail(str(e)) + self.fail(e) - # TODO: calculate CBC-MAC for checksum + chunk_size = 2 ** 15 # buffer size, 32k + # file_mac = [0, 0, 0, 0] # calculate CBC-MAC for checksum - size = 2 ** 15 # buffer size, 32k - while True: - buf = f.read(size) + chunks = os.path.getsize(file_crypted) / chunk_size + 1 + for i in xrange(chunks): + buf = f.read(chunk_size) if not buf: break - df.write(cipher.decrypt(buf)) + chunk = cipher.decrypt(buf) + df.write(chunk) + + self.pyfile.setProgress(int((100.0 / chunks) * i)) + + # chunk_mac = [iv[0], iv[1], iv[0], iv[1]] + # for i in xrange(0, chunk_size, 16): + # block = chunk[i:i+16] + # if len(block) % 16: + # block += '=' * (16 - (len(block) % 16)) + # block = array("I", block) + + # chunk_mac = [chunk_mac[0] ^ a_[0], chunk_mac[1] ^ block[1], chunk_mac[2] ^ block[2], chunk_mac[3] ^ block[3]] + # chunk_mac = aes_cbc_encrypt_a32(chunk_mac, k) + + # file_mac = [file_mac[0] ^ chunk_mac[0], file_mac[1] ^ chunk_mac[1], file_mac[2] ^ chunk_mac[2], file_mac[3] ^ chunk_mac[3]] + # file_mac = aes_cbc_encrypt_a32(file_mac, k) + + self.pyfile.setProgress(100) f.close() df.close() - remove(file_crypted) - self.lastDownload = file_decrypted + # if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] != meta_mac: + # os.remove(file_decrypted) + # self.fail(_("Checksum mismatch")) + os.remove(file_crypted) + self.lastDownload = fs_decode(file_decrypted) - def process(self, pyfile): - key = None - # match is guaranteed because plugin was chosen to handle url - node = re.match(self.__pattern__, pyfile.url).group(2) - if "!" in node: - node, key = node.split("!") + def checkError(self, code): + ecode = abs(code) + + if ecode in (9, 16, 21): + self.offline() + + elif ecode in (3, 13, 17, 18, 19): + self.tempOffline() + + elif ecode in (1, 4, 6, 10, 15, 21): + self.retry(5, 30, _("Error code: [%s]") % -ecode) - self.logDebug("File id: %s | Key: %s" % (node, key)) + else: + self.fail(_("Error code: [%s]") % -ecode) - if not key: - self.fail(_("No file key provided in the URL")) + + def process(self, pyfile): + pattern = re.match(self.__pattern__, pyfile.url).groupdict() + id = pattern['ID'] + key = pattern['KEY'] + public = pattern['TYPE'] == '' + + self.logDebug("ID: %s" % id, "Key: %s" % key, "Type: %s" % ("public" if public else "node")) # g is for requesting a download url # this is similar to the calls in the mega js app, documentation is very bad - dl = self.callApi(a="g", g=1, p=node, ssl=1)[0] + if public: + mega = self.api_response(a="g", g=1, p=id, ssl=1)[0] + else: + mega = self.api_response(a="g", g=1, n=id, ssl=1)[0] - if "e" in dl: - e = dl['e'] - # ETEMPUNAVAIL (-18): Resource temporarily not available, please try again later - if e == -18: - self.retry() - else: - self.fail(_("Error code:") + e) + if isinstance(mega, int): + self.checkError(mega) + elif "e" in mega: + self.checkError(mega['e']) - # TODO: map other error codes, e.g - # EACCESS (-11): Access violation (e.g., trying to write to a read-only share) - - key = self.b64_decode(key) - attr = self.decryptAttr(dl['at'], key) + attr = self.decryptAttr(mega['at'], key) pyfile.name = attr['n'] + self.FILE_SUFFIX + pyfile.size = mega['s'] + + # self.req.http.c.setopt(SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") - self.req.http.c.setopt(SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") + self.download(mega['g']) - self.download(dl['g']) self.decryptFile(key) # Everything is finished and final name can be set diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index d473cbbf1..b42362800 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -4,18 +4,18 @@ import re from urllib import unquote_plus -from pyload.utils import json_loads -from pyload.plugin.Hoster import Hoster +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -class MegaDebridEu(Hoster): +class MegaDebridEu(MultiHoster): __name__ = "MegaDebridEu" __type__ = "hoster" - __version__ = "0.40" + __version__ = "0.46" - __pattern__ = r'^https?://(?:w{3}\d+\.mega-debrid\.eu|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/download/file/[^/]+/.+$' + __pattern__ = r'http://((?:www\d+\.|s\d+\.)?mega-debrid\.eu|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/download/file/[\w^_]+' - __description__ = """mega-debrid.eu hoster plugin""" + __description__ = """mega-debrid.eu multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] @@ -30,26 +30,18 @@ class MegaDebridEu(Hoster): return "" - def process(self, pyfile): - if re.match(self.__pattern__, pyfile.url): - new_url = pyfile.url - elif not self.account: - self.exitOnFail("Please enter your %s account or deactivate this plugin" % "Mega-debrid.eu") - else: - if not self.connectToApi(): - self.exitOnFail("Unable to connect to Mega-debrid.eu") + def handlePremium(self, pyfile): + if not self.api_load(): + self.exitOnFail("Unable to connect to Mega-debrid.eu") - self.logDebug("Old URL: %s" % pyfile.url) - new_url = self.debridLink(pyfile.url) - self.logDebug("New URL: " + new_url) + self.link = self.debridLink(pyfile.url) - filename = self.getFilename(new_url) - if filename != "": + filename = self.getFilename(self.link) + if filename: pyfile.name = filename - self.download(new_url, disposition=True) - def connectToApi(self): + def api_load(self): """ Connexion to the mega-debrid API Return True if succeed @@ -92,3 +84,6 @@ class MegaDebridEu(Hoster): self.resetAccount() else: self.fail(_(msg)) + + +getInfo = create_getInfo(MegaDebridEu) diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py index 93a70a54e..7d8a25c03 100644 --- a/module/plugins/hoster/MegaRapidCz.py +++ b/module/plugins/hoster/MegaRapidCz.py @@ -4,8 +4,9 @@ import re from pycurl import HTTPHEADER -from pyload.network.RequestFactory import getRequest -from pyload.plugin.internal.SimpleHoster import SimpleHoster, parseFileInfo +from module.network.HTTPRequest import BadHeader +from module.network.RequestFactory import getRequest +from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo def getInfo(urls): @@ -22,7 +23,7 @@ def getInfo(urls): class MegaRapidCz(SimpleHoster): __name__ = "MegaRapidCz" __type__ = "hoster" - __version__ = "0.54" + __version__ = "0.56" __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+' @@ -38,10 +39,11 @@ class MegaRapidCz(SimpleHoster): SIZE_PATTERN = r'<td class="i">Velikost:</td>\s*<td class="h"><strong>\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong></td>' OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán' - FORCE_CHECK_TRAFFIC = True + CHECK_TRAFFIC = True - LINK_PATTERN = r'<a href="([^"]+)" title="Stahnout">([^<]+)</a>' - ERR_LOGIN_PATTERN = ur'<div class="error_div"><strong>Stahování je přístupné pouze přihlášeným uživatelům' + LINK_PREMIUM_PATTERN = r'<a href="([^"]+)" title="Stahnout">([^<]+)</a>' + + ERR_LOGIN_PATTERN = ur'<div class="error_div"><strong>Stahování je přístupné pouze přihlášeným uživatelům' ERR_CREDIT_PATTERN = ur'<div class="error_div"><strong>Stahování zdarma je možné jen přes náš' @@ -49,18 +51,10 @@ class MegaRapidCz(SimpleHoster): self.chunkLimit = 1 - def handlePremium(self): - try: - self.html = self.load(self.pyfile.url, decode=True) - except BadHeader, e: - self.account.relogin(self.user) - self.retry(wait_time=60, reason=str(e)) - - m = re.search(self.LINK_PATTERN, self.html) + def handlePremium(self, pyfile): + m = re.search(self.LINK_PREMIUM_PATTERN, self.html) if m: - link = m.group(1) - self.logDebug("Premium link: %s" % link) - self.download(link, disposition=True) + self.link = m.group(1) else: if re.search(self.ERR_LOGIN_PATTERN, self.html): self.relogin(self.user) diff --git a/module/plugins/hoster/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py index ea1aafd70..f8fcb97fe 100644 --- a/module/plugins/hoster/MegacrypterCom.py +++ b/module/plugins/hoster/MegacrypterCom.py @@ -10,9 +10,9 @@ from pyload.plugin.hoster.MegaCoNz import MegaCoNz class MegacrypterCom(MegaCoNz): __name__ = "MegacrypterCom" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" - __pattern__ = r'(https?://\w{0,10}\.?megacrypter\.com/[\w!-]+)' + __pattern__ = r'https?://\w{0,10}\.?megacrypter\.com/[\w!-]+' __description__ = """Megacrypter.com decrypter plugin""" __license__ = "GPLv3" @@ -23,7 +23,7 @@ class MegacrypterCom(MegaCoNz): FILE_SUFFIX = ".crypted" - def callApi(self, **kwargs): + def api_response(self, **kwargs): """ Dispatch a call to the api, see megacrypter.com/api_doc """ self.logDebug("JSON request: " + json_dumps(kwargs)) res = self.load(self.API_URL, post=json_dumps(kwargs)) @@ -33,13 +33,13 @@ class MegacrypterCom(MegaCoNz): def process(self, pyfile): # match is guaranteed because plugin was chosen to handle url - node = re.match(self.__pattern__, pyfile.url).group(1) + node = re.match(self.__pattern__, pyfile.url).group(0) # get Mega.co.nz link info - info = self.callApi(link=node, m="info") + info = self.api_response(link=node, m="info") # get crypted file URL - dl = self.callApi(link=node, m="dl") + dl = self.api_response(link=node, m="dl") # TODO: map error codes, implement password protection # if info['pass'] is True: @@ -50,6 +50,7 @@ class MegacrypterCom(MegaCoNz): pyfile.name = info['name'] + self.FILE_SUFFIX self.download(dl['url']) + self.decryptFile(key) # Everything is finished and final name can be set diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index ffcab9415..84777adeb 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -10,7 +10,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class MegasharesCom(SimpleHoster): __name__ = "MegasharesCom" __type__ = "hoster" - __version__ = "0.27" + __version__ = "0.28" __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index\.php)?\?d\d{2}=|dl/)\w+' @@ -39,11 +39,11 @@ class MegasharesCom(SimpleHoster): self.multiDL = self.premium - def handlePremium(self): + def handlePremium(self, pyfile): self.handleDownload(True) - def handleFree(self): + def handleFree(self, pyfile): if self.NO_SLOTS_PATTERN in self.html: self.retry(wait_time=5 * 60) diff --git a/module/plugins/hoster/MovReelCom.py b/module/plugins/hoster/MovReelCom.py index c55269a89..3e18a8960 100644 --- a/module/plugins/hoster/MovReelCom.py +++ b/module/plugins/hoster/MovReelCom.py @@ -15,11 +15,6 @@ class MovReelCom(XFSHoster): __authors__ = [("JorisV83", "jorisv83-pyload@yahoo.com")] - HOSTER_DOMAIN = "movreel.com" - - NAME_PATTERN = r'Filename: <b>(?P<N>.+?)<' - SIZE_PATTERN = r'Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' - LINK_PATTERN = r'<a href="([^"]+)">Download Link' diff --git a/module/plugins/hoster/MultihostersCom.py b/module/plugins/hoster/MultihostersCom.py new file mode 100644 index 000000000..bcd7c6237 --- /dev/null +++ b/module/plugins/hoster/MultihostersCom.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from module.plugins.hoster.ZeveraCom import ZeveraCom + + +class MultihostersCom(ZeveraCom): + __name__ = "MultihostersCom" + __type__ = "hoster" + __version__ = "0.03" + + __pattern__ = r'https?://(?:www\.)multihosters\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' + + __description__ = """Multihosters.com multi-hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("tjeh", "tjeh@gmx.net")] diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index 817f457bf..ca626a833 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -10,9 +10,9 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class MultishareCz(SimpleHoster): __name__ = "MultishareCz" __type__ = "hoster" - __version__ = "0.35" + __version__ = "0.40" - __pattern__ = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+).*' + __pattern__ = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+)' __description__ = """MultiShare.cz hoster plugin""" __license__ = "GPLv3" @@ -21,60 +21,34 @@ class MultishareCz(SimpleHoster): SIZE_REPLACEMENTS = [(' ', '')] - MULTI_HOSTER = True + CHECK_TRAFFIC = True + MULTI_HOSTER = True INFO_PATTERN = ur'(?:<li>Název|Soubor): <strong>(?P<N>[^<]+)</strong><(?:/li><li|br)>Velikost: <strong>(?P<S>[^<]+)</strong>' OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>Požadovaný soubor neexistuje.</strong></p>' - def process(self, pyfile): - msurl = re.match(self.__pattern__, pyfile.url) - if msurl: - self.fileID = msurl.group('ID') - self.html = self.load(pyfile.url, decode=True) - self.getFileInfo() + def handleFree(self, pyfile): + self.download("http://www.multishare.cz/html/download_free.php", get={'ID': self.info['pattern']['ID']}) - if self.premium: - self.handlePremium() - else: - self.handleFree() - else: - self.handleOverriden() + def handlePremium(self, pyfile): + self.download("http://www.multishare.cz/html/download_premium.php", get={'ID': self.info['pattern']['ID']}) - def handleFree(self): - self.download("http://www.multishare.cz/html/download_free.php?ID=%s" % self.fileID) + def handleMulti(self, pyfile): + self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": pyfile.url}, decode=True) - def handlePremium(self): - if not self.checkCredit(): - self.logWarning(_("Not enough credit left to download file")) - self.resetAccount() + self.checkInfo() - self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.fileID) - - - def handleOverriden(self): - if not self.premium: - self.fail(_("Only premium users can download from other hosters")) - - self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": self.pyfile.url}, decode=True) - self.getFileInfo() - - if not self.checkCredit(): + if not self.checkTrafficLeft(): self.fail(_("Not enough credit left to download file")) - url = "http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random()) - params = {"u_ID": self.acc_info['u_ID'], "u_hash": self.acc_info['u_hash'], "link": self.pyfile.url} - self.logDebug(url, params) - self.download(url, get=params) - - - def checkCredit(self): - self.acc_info = self.account.getAccountInfo(self.user, True) - self.logInfo(_("User %s has %i MB left") % (self.user, self.acc_info['trafficleft'] / 1024)) - - return self.pyfile.size / 1024 <= self.acc_info['trafficleft'] + self.download("http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random()), + get={'u_ID' : self.acc_info['u_ID'], + 'u_hash': self.acc_info['u_hash'], + 'link' : pyfile.url}, + disposition=True) getInfo = create_getInfo(MultishareCz) diff --git a/module/plugins/hoster/MyfastfileCom.py b/module/plugins/hoster/MyfastfileCom.py index b67b221d2..3862bfe32 100644 --- a/module/plugins/hoster/MyfastfileCom.py +++ b/module/plugins/hoster/MyfastfileCom.py @@ -2,18 +2,18 @@ import re -from pyload.plugin.Hoster import Hoster -from pyload.utils import json_loads +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -class MyfastfileCom(Hoster): +class MyfastfileCom(MultiHoster): __name__ = "MyfastfileCom" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.08" - __pattern__ = r'http://(?:www\.)?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/' + __pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/' - __description__ = """Myfastfile.com hoster plugin""" + __description__ = """Myfastfile.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] @@ -21,27 +21,19 @@ class MyfastfileCom(Hoster): def setup(self): self.chunkLimit = -1 - self.resumeDownload = True - - - def process(self, pyfile): - if re.match(self.__pattern__, pyfile.url): - new_url = pyfile.url - elif not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "Myfastfile.com") - self.fail(_("No Myfastfile.com account provided")) - else: - self.logDebug("Original URL: %s" % pyfile.url) - page = self.load('http://myfastfile.com/api.php', - get={'user': self.user, 'pass': self.account.getAccountData(self.user)['password'], - 'link': pyfile.url}) - self.logDebug("JSON data: " + page) - page = json_loads(page) - if page['status'] != 'ok': - self.fail(_("Unable to unrestrict link")) - new_url = page['link'] - - if new_url != pyfile.url: - self.logDebug("Unrestricted URL: " + new_url) - - self.download(new_url, disposition=True) + + + def handlePremium(self, pyfile): + self.html = self.load('http://myfastfile.com/api.php', + get={'user': self.user, 'pass': self.account.getAccountData(self.user)['password'], + 'link': pyfile.url}) + self.logDebug("JSON data: " + self.html) + + self.html = json_loads(self.html) + if self.html['status'] != 'ok': + self.fail(_("Unable to unrestrict link")) + + self.link = self.html['link'] + + +getInfo = create_getInfo(MyfastfileCom) diff --git a/module/plugins/hoster/MystoreTo.py b/module/plugins/hoster/MystoreTo.py new file mode 100644 index 000000000..3bb424d4d --- /dev/null +++ b/module/plugins/hoster/MystoreTo.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +# +# Test link: +# http://mystore.to/dl/mxcA50jKfP + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class MystoreTo(SimpleHoster): + __name__ = "MystoreTo" + __type__ = "hoster" + __version__ = "0.03" + + __pattern__ = r'https?://(?:www\.)?mystore\.to/dl/.+' + + __description__ = """Mystore.to hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "")] + + + NAME_PATTERN = r'<h1>(?P<N>.+?)<' + SIZE_PATTERN = r'FILESIZE: (?P<S>[\d\.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>file not found<' + + + def setup(self): + self.chunkLimit = 1 + self.resumeDownload = True + self.multiDL = True + + + def handleFree(self, pyfile): + try: + fid = re.search(r'wert="(.+?)"', self.html).group(1) + + except AttributeError: + self.error(_("File-ID not found")) + + self.link = self.load("http://mystore.to/api/download", + post={'FID': fid}) + + +getInfo = create_getInfo(MystoreTo) diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py index 5dfb4e245..1738d9724 100644 --- a/module/plugins/hoster/NarodRu.py +++ b/module/plugins/hoster/NarodRu.py @@ -10,7 +10,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class NarodRu(SimpleHoster): __name__ = "NarodRu" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" __pattern__ = r'http://(?:www\.)?narod(\.yandex)?\.ru/(disk|start/\d+\.\w+-narod\.yandex\.ru)/(?P<ID>\d+)/.+' @@ -28,29 +28,35 @@ class NarodRu(SimpleHoster): (r"/start/\d+\.\w+-narod\.yandex\.ru/(\d{6,15})/\w+/(\w+)", r"/disk/\1/\2")] CAPTCHA_PATTERN = r'<number url="(.*?)">(\w+)</number>' - LINK_PATTERN = r'<a class="h-link" rel="yandex_bar" href="(.+?)">' + LINK_FREE_PATTERN = r'<a class="h-link" rel="yandex_bar" href="(.+?)">' - def handleFree(self): + def handleFree(self, pyfile): for _i in xrange(5): self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random() * 777)) + m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: self.error(_("Captcha")) + post_data = {"action": "sendcapcha"} captcha_url, post_data['key'] = m.groups() post_data['rep'] = self.decryptCaptcha(captcha_url) - self.html = self.load(self.pyfile.url, post=post_data, decode=True) - m = re.search(self.LINK_PATTERN, self.html) + self.html = self.load(pyfile.url, post=post_data, decode=True) + + m = re.search(self.LINK_FREE_PATTERN, self.html) if m: url = 'http://narod.ru' + m.group(1) self.correctCaptcha() break + elif u'<b class="error-msg"><strong>Ошиблись?</strong>' in self.html: self.invalidCaptcha() + else: self.error(_("Download link")) + else: self.fail(_("No valid captcha code entered")) diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 4ecd8d67b..2ed298ffa 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -3,7 +3,7 @@ import re from urlparse import urljoin -from time import sleep, time +from time import time from pyload.network.RequestFactory import getURL from pyload.plugin.Hoster import Hoster @@ -23,7 +23,7 @@ def getInfo(urls): for url in chunk: match = id_regex.search(url) if match: - ids = ids + match.group(1) + ";" + ids = ids + match.group('ID') + ";" api = getURL(apiurl, get={'auth' : "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", @@ -62,9 +62,9 @@ def getInfo(urls): class NetloadIn(Hoster): __name__ = "NetloadIn" __type__ = "hoster" - __version__ = "0.47" + __version__ = "0.49" - __pattern__ = r'https?://(?:[^/]*\.)?netload\.in/(?:datei(.*?)(?:\.htm|/)|index\.php?id=10&file_id=)' + __pattern__ = r'https?://(?:www\.)?netload\.in/(?P<PATH>datei|index\.php\?id=10&file_id=)(?P<ID>\w+)' __description__ = """Netload.in hoster plugin""" __license__ = "GPLv3" @@ -73,6 +73,9 @@ class NetloadIn(Hoster): ("Gregy", "gregy@gregy.cz")] + RECAPTCHA_KEY = "6LcLJMQSAAAAAJzquPUPKNovIhbK6LpSqCjYrsR1" + + def setup(self): self.multiDL = self.resumeDownload = self.premium @@ -88,7 +91,7 @@ class NetloadIn(Hoster): def prepare(self): - self.download_api_data() + self.api_load() if self.api_data and self.api_data['filename']: self.pyfile.name = self.api_data['filename'] @@ -111,14 +114,14 @@ class NetloadIn(Hoster): return False - def download_api_data(self, n=0): + def api_load(self, n=0): url = self.url id_regex = re.compile(self.__pattern__) match = id_regex.search(url) if match: #normalize url - self.url = 'http://www.netload.in/datei%s.htm' % match.group(1) + self.url = 'http://www.netload.in/datei%s.htm' % match.group('ID') self.logDebug("URL: %s" % self.url) else: self.api_data = False @@ -126,11 +129,12 @@ class NetloadIn(Hoster): apiurl = "http://api.netload.in/info.php" html = self.load(apiurl, cookies=False, - get={"file_id": match.group(1), "auth": "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", "bz": "1", + get={"file_id": match.group('ID'), "auth": "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", "bz": "1", "md5": "1"}, decode=True).strip() if not html and n <= 3: - sleep(0.2) - self.download_api_data(n + 1) + self.setWait(2) + self.wait() + self.api_load(n + 1) return self.logDebug("APIDATA: " + html) @@ -234,7 +238,7 @@ class NetloadIn(Hoster): recaptcha = ReCaptcha(self) for _i in xrange(5): - challenge, response = recaptcha.challenge() + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) response_page = self.load("http://www.netload.in/index.php?id=10", post={'captcha_check' : '1', @@ -253,7 +257,7 @@ class NetloadIn(Hoster): download_url = self.get_file_url(response_page) self.logDebug("Download URL after get_file: " + download_url) if not download_url.startswith("http://"): - self.error("download url: %s" % download_url) + self.error(_("Download url: %s") % download_url) self.wait() self.url = download_url diff --git a/module/plugins/hoster/NitroflareCom.py b/module/plugins/hoster/NitroflareCom.py new file mode 100644 index 000000000..5bbef64de --- /dev/null +++ b/module/plugins/hoster/NitroflareCom.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- +# +# Note: +# Right now premium support is not added +# Thus, any file that require premium support +# cannot be downloaded. Only the file that is free to +# download can be downloaded. + +import re + +from module.common.json_layer import json_loads +from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster + + +class NitroflareCom(SimpleHoster): + __name__ = "NitroflareCom" + __type__ = "hoster" + __version__ = "0.08" + + __pattern__ = r'https?://(?:www\.)?nitroflare\.com/view/(?P<ID>[\w^_]+)' + + __description__ = """Nitroflare.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("sahil", "sahilshekhawat01@gmail.com"), + ("Walter Purcaro", "vuolter@gmail.com"), + ("Stickell", "l.stickell@yahoo.it")] + + # URL_REPLACEMENTS = [("http://", "https://")] + + INFO_PATTERN = r'title="(?P<N>.+?)".+>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>File doesn\'t exist' + + LINK_FREE_PATTERN = r'(https?://[\w\-]+\.nitroflare\.com/.+?)"' + + RECAPTCHA_KEY = "6Lenx_USAAAAAF5L1pmTWvWcH73dipAEzNnmNLgy" + + PREMIUM_ONLY_PATTERN = r'This file is available with Premium only' + WAIT_PATTERN = r'You have to wait .+' + ERROR_PATTERN = r'downloading is not possible' + + + def checkErrors(self): + if not self.html: + return + + if not self.premium and re.search(self.PREMIUM_ONLY_PATTERN, self.html): + self.fail(_("Link require a premium account to be handled")) + + elif hasattr(self, 'WAIT_PATTERN'): + m = re.search(self.WAIT_PATTERN, self.html) + if m: + wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in + re.findall(r'(\d+)\s*(hr|hour|min|sec)', m.group(0), re.I)) + self.wait(wait_time, wait_time > 300) + return + + elif hasattr(self, 'ERROR_PATTERN'): + m = re.search(self.ERROR_PATTERN, self.html) + if m: + errmsg = self.info['error'] = m.group(1) + self.error(errmsg) + + self.info.pop('error', None) + + + def handleFree(self, pyfile): + # used here to load the cookies which will be required later + self.load(pyfile.url, post={'goToFreePage': ""}) + + self.load("https://www.nitroflare.com/ajax/setCookie.php", post={'fileId': self.info['pattern']['ID']}) + self.html = self.load("https://www.nitroflare.com/ajax/freeDownload.php", + post={'method': "startTimer", 'fileId': self.info['pattern']['ID']}) + + self.checkErrors() + + try: + js_file = self.load("http://nitroflare.com/js/downloadFree.js?v=1.0.1") + var_time = re.search("var time = (\\d+);", js_file) + wait_time = int(var_time.groups()[0]) + + except Exception: + wait_time = 60 + + self.wait(wait_time) + + recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + + self.html = self.load("https://www.nitroflare.com/ajax/freeDownload.php", + post={'method' : "fetchDownload", + 'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) + + if "The captcha wasn't entered correctly" in self.html: + self.logWarning("The captcha wasn't entered correctly") + return + + if "You have to fill the captcha" in self.html: + self.logWarning("Captcha unfilled") + return + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + self.link = m.group(1) + else: + self.logError("Unable to detect direct link") diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py new file mode 100644 index 000000000..43ae8b3cc --- /dev/null +++ b/module/plugins/hoster/NoPremiumPl.py @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster + + +class NoPremiumPl(MultiHoster): + __name__ = "NoPremiumPl" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'https?://direct\.nopremium\.pl.+' + + __description__ = """NoPremium.pl multi-hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@nopremium.pl")] + + + API_URL = "http://crypt.nopremium.pl" + + API_QUERY = {'site' : "nopremium", + 'output' : "json", + 'username': "", + 'password': "", + 'url' : ""} + + ERROR_CODES = {0 : "[%s] Incorrect login credentials", + 1 : "[%s] Not enough transfer to download - top-up your account", + 2 : "[%s] Incorrect / dead link", + 3 : "[%s] Error connecting to hosting, try again later", + 9 : "[%s] Premium account has expired", + 15: "[%s] Hosting no longer supported", + 80: "[%s] Too many incorrect login attempts, account blocked for 24h"} + + + def prepare(self): + super(NoPremiumPl, self).prepare() + + data = self.account.getAccountData(self.user) + + self.usr = data['usr'] + self.pwd = data['pwd'] + + + def runFileQuery(self, url, mode=None): + query = self.API_QUERY.copy() + + query["username"] = self.usr + query["password"] = self.pwd + query["url"] = url + + if mode == "fileinfo": + query['check'] = 2 + query['loc'] = 1 + + self.logDebug(query) + + return self.load(self.API_URL, post=query) + + + def handleFree(self, pyfile): + try: + data = self.runFileQuery(pyfile.url, 'fileinfo') + + except Exception: + self.logDebug("runFileQuery error") + self.tempOffline() + + try: + parsed = json_loads(data) + + except Exception: + self.logDebug("loads error") + self.tempOffline() + + self.logDebug(parsed) + + if "errno" in parsed.keys(): + if parsed["errno"] in self.ERROR_CODES: + # error code in known + self.fail(self.ERROR_CODES[parsed["errno"]] % self.__name__) + else: + # error code isn't yet added to plugin + self.fail( + parsed["errstring"] + or _("Unknown error (code: %s)") % parsed["errno"] + ) + + if "sdownload" in parsed: + if parsed["sdownload"] == "1": + self.fail( + _("Download from %s is possible only using NoPremium.pl website \ + directly") % parsed["hosting"]) + + pyfile.name = parsed["filename"] + pyfile.size = parsed["filesize"] + + try: + self.link = self.runFileQuery(pyfile.url, 'filedownload') + + except Exception: + self.logDebug("runFileQuery error #2") + self.tempOffline() diff --git a/module/plugins/hoster/NosuploadCom.py b/module/plugins/hoster/NosuploadCom.py index 56f70208d..842481a60 100644 --- a/module/plugins/hoster/NosuploadCom.py +++ b/module/plugins/hoster/NosuploadCom.py @@ -17,10 +17,9 @@ class NosuploadCom(XFSHoster): __authors__ = [("igel", "igelkun@myopera.com")] - HOSTER_DOMAIN = "nosupload.com" - SIZE_PATTERN = r'<p><strong>Size:</strong> (?P<S>[\d.,]+) (?P<U>[\w^_]+)</p>' LINK_PATTERN = r'<a class="select" href="(http://.+?)">Download</a>' + WAIT_PATTERN = r'Please wait.*?>(\d+)</span>' diff --git a/module/plugins/hoster/NovafileCom.py b/module/plugins/hoster/NovafileCom.py index 7c709a777..f73570ec2 100644 --- a/module/plugins/hoster/NovafileCom.py +++ b/module/plugins/hoster/NovafileCom.py @@ -20,12 +20,10 @@ class NovafileCom(XFSHoster): ("stickell", "l.stickell@yahoo.it")] - HOSTER_DOMAIN = "novafile.com" - - SIZE_PATTERN = r'<div class="size">(?P<S>.+?)</div>' ERROR_PATTERN = r'class="alert[^"]*alert-separate"[^>]*>\s*(?:<p>)?(.*?)\s*</' + WAIT_PATTERN = r'<p>Please wait <span id="count"[^>]*>(\d+)</span> seconds</p>' + LINK_PATTERN = r'<a href="(http://s\d+\.novafile\.com/.*?)" class="btn btn-green">Download File</a>' - WAIT_PATTERN = r'<p>Please wait <span id="count"[^>]*>(\d+)</span> seconds</p>' getInfo = create_getInfo(NovafileCom) diff --git a/module/plugins/hoster/NowDownloadSx.py b/module/plugins/hoster/NowDownloadSx.py index 0a66319ab..44a24471b 100644 --- a/module/plugins/hoster/NowDownloadSx.py +++ b/module/plugins/hoster/NowDownloadSx.py @@ -9,9 +9,9 @@ from pyload.utils import fixup class NowDownloadSx(SimpleHoster): __name__ = "NowDownloadSx" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.07" - __pattern__ = r'http://(?:www\.)?nowdownload\.(at|ch|co|eu|sx)/(dl/|download\.php\?id=)\w+' + __pattern__ = r'http://(?:www\.)?(nowdownload\.(at|ch|co|eu|sx)/(dl/|download\.php\?id=)|likeupload\.org/)\w+' __description__ = """NowDownload.sx hoster plugin""" __license__ = "GPLv3" @@ -25,7 +25,7 @@ class NowDownloadSx(SimpleHoster): TOKEN_PATTERN = r'"(/api/token\.php\?token=\w+)"' CONTINUE_PATTERN = r'"(/dl2/\w+/\w+)"' WAIT_PATTERN = r'\.countdown\(\{until: \+(\d+),' - LINK_PATTERN = r'(http://s\d+\.coolcdn\.info/nowdownload/.+?)["\']' + LINK_FREE_PATTERN = r'(http://s\d+\.coolcdn\.info/nowdownload/.+?)["\']' NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<[^>]*>', '')] @@ -36,7 +36,7 @@ class NowDownloadSx(SimpleHoster): self.chunkLimit = -1 - def handleFree(self): + def handleFree(self, pyfile): tokenlink = re.search(self.TOKEN_PATTERN, self.html) continuelink = re.search(self.CONTINUE_PATTERN, self.html) if tokenlink is None or continuelink is None: @@ -54,7 +54,7 @@ class NowDownloadSx(SimpleHoster): self.html = self.load(baseurl + str(continuelink.group(1))) - url = re.search(self.LINK_PATTERN, self.html) + url = re.search(self.LINK_FREE_PATTERN, self.html) if url is None: self.error(_("Download link not found")) diff --git a/module/plugins/hoster/NowVideoSx.py b/module/plugins/hoster/NowVideoSx.py index e672aeff5..fc1d06d19 100644 --- a/module/plugins/hoster/NowVideoSx.py +++ b/module/plugins/hoster/NowVideoSx.py @@ -8,16 +8,16 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class NowVideoSx(SimpleHoster): __name__ = "NowVideoSx" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.10" - __pattern__ = r'http://(?:www\.)?nowvideo\.(at|ch|co|eu|sx)/(video|mobile/#/videos)/(?P<ID>\w+)' + __pattern__ = r'http://(?:www\.)?nowvideo\.(at|ch|co|eu|li|sx)/(video|mobile/#/videos)/(?P<ID>\w+)' __description__ = """NowVideo.sx hoster plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://www.nowvideo.at/video/\g<ID>')] + URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://www.nowvideo.sx/video/\g<ID>')] NAME_PATTERN = r'<h4>(?P<N>.+?)<' OFFLINE_PATTERN = r'>This file no longer exists' @@ -31,8 +31,8 @@ class NowVideoSx(SimpleHoster): self.multiDL = True - def handleFree(self): - self.html = self.load("http://www.nowvideo.at/mobile/video.php", get={'id': self.info['pattern']['ID']}) + def handleFree(self, pyfile): + self.html = self.load("http://www.nowvideo.sx/mobile/video.php", get={'id': self.info['pattern']['ID']}) m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index 70e117cf7..43d41c538 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -13,7 +13,7 @@ from pyload.plugin.internal.captcha import ReCaptcha class OboomCom(Hoster): __name__ = "OboomCom" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.31" __pattern__ = r'https?://(?:www\.)?oboom\.com/(#(id=|/)?)?(?P<ID>\w{8})' @@ -74,7 +74,7 @@ class OboomCom(Hoster): recaptcha = ReCaptcha(self) for _i in xrange(5): - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) apiUrl = "https://www.oboom.com/1.0/download/ticket" params = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index 91cc7f001..5be05ea17 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -8,7 +8,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" - __version__ = "0.74" + __version__ = "0.78" __pattern__ = r'https?://(?:www\.)?(?:(?P<ID1>\w+)\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P<ID2>\w+))?' @@ -28,9 +28,10 @@ class OneFichierCom(SimpleHoster): OFFLINE_PATTERN = r'File not found !\s*<' - COOKIES = [("1fichier.com", "LG", "en")] + COOKIES = [("1fichier.com", "LG", "en")] + DISPOSITION = False #: Remove in 0.4.10 - WAIT_PATTERN = r'>You must wait (\d+)' + WAIT_PATTERN = r'>You must wait (\d+) minutes' def setup(self): @@ -38,14 +39,7 @@ class OneFichierCom(SimpleHoster): self.resumeDownload = True - def handle(self, reconnect): - m = re.search(self.WAIT_PATTERN, self.html) - if m: - wait_time = int(m.group(1)) * 60 - - self.wait(wait_time, reconnect) - self.retry(reason="You have to wait been each free download") - + def handleFree(self, pyfile): id = self.info['pattern']['ID1'] or self.info['pattern']['ID2'] url, inputs = self.parseHtmlForm('action="https://1fichier.com/\?%s' % id) @@ -60,12 +54,8 @@ class OneFichierCom(SimpleHoster): self.download(url, post=inputs) - def handleFree(self): - return self.handle(True) - - - def handlePremium(self): - return self.handle(False) + def handlePremium(self, pyfile): + self.download(pyfile.url, post={'dl': "Download", 'did': 0}) getInfo = create_getInfo(OneFichierCom) diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py index c78d96a09..67563ca3d 100644 --- a/module/plugins/hoster/OverLoadMe.py +++ b/module/plugins/hoster/OverLoadMe.py @@ -5,19 +5,19 @@ import re from random import randrange from urllib import unquote -from pyload.utils import json_loads -from pyload.plugin.Hoster import Hoster -from pyload.utils import parseFileSize +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo +from module.utils import parseFileSize -class OverLoadMe(Hoster): +class OverLoadMe(MultiHoster): __name__ = "OverLoadMe" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.09" - __pattern__ = r'https?://.*overload\.me.*' + __pattern__ = r'https?://.*overload\.me/.+' - __description__ = """Over-Load.me hoster plugin""" + __description__ = """Over-Load.me multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("marley", "marley@over-load.me")] @@ -27,58 +27,50 @@ class OverLoadMe(Hoster): name = unquote(url.rsplit("/", 1)[1]) except IndexError: name = "Unknown_Filename..." + if name.endswith("..."): #: incomplete filename, append random stuff name += "%s.tmp" % randrange(100, 999) + return name def setup(self): self.chunkLimit = 5 - self.resumeDownload = True - def process(self, pyfile): - if re.match(self.__pattern__, pyfile.url): - new_url = pyfile.url - elif not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "Over-Load") - self.fail(_("No Over-Load account provided")) - else: - self.logDebug("Old URL: %s" % pyfile.url) - data = self.account.getAccountData(self.user) - - page = self.load("https://api.over-load.me/getdownload.php", - get={"auth": data['password'], "link": pyfile.url}) - data = json_loads(page) - - self.logDebug("Returned Data: %s" % data) - - if data['error'] == 1: - self.logWarning(data['msg']) - self.tempOffline() - else: - if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['filename']: - pyfile.name = data['filename'] - pyfile.size = parseFileSize(data['filesize']) - new_url = data['downloadlink'] - - if self.getConfig("https"): - new_url = new_url.replace("http://", "https://") + def handlePremium(self, pyfile): + https = "https" if self.getConfig("ssl") else "http" + data = self.account.getAccountData(self.user) + page = self.load(https + "://api.over-load.me/getdownload.php", + get={'auth': data['password'], + 'link': pyfile.url}) + + data = json_loads(page) + + self.logDebug(data) + + if data['error'] == 1: + self.logWarning(data['msg']) + self.tempOffline() else: - new_url = new_url.replace("https://", "http://") + if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['filename']: + pyfile.name = data['filename'] + pyfile.size = parseFileSize(data['filesize']) - if new_url != pyfile.url: - self.logDebug("New URL: %s" % new_url) + http_repl = ["http://", "https://"] + self.link = data['downloadlink'].replace(*http_repl if self.getConfig("ssl") else *http_repl[::-1]) if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'): # only use when name wasn't already set - pyfile.name = self.getFilename(new_url) - - self.download(new_url, disposition=True) + pyfile.name = self.getFilename(self.link) - check = self.checkDownload( - {"error": "<title>An error occured while processing your request</title>"}) - if check == "error": + def checkFile(self): + if self.checkDownload({"error": "<title>An error occured while processing your request</title>"}) # usual this download can safely be retried self.retry(wait_time=60, reason=_("An error occured while generating link.")) + + return super(OverLoadMe, self).checkFile() + + +getInfo = create_getInfo(OverLoadMe) diff --git a/module/plugins/hoster/PornhostCom.py b/module/plugins/hoster/PornhostCom.py index aab337b2d..70ce4f32e 100644 --- a/module/plugins/hoster/PornhostCom.py +++ b/module/plugins/hoster/PornhostCom.py @@ -73,8 +73,7 @@ class PornhostCom(Hoster): if not self.html: self.download_html() - if (re.search(r'gallery not found', self.html) is not None or - re.search(r'You will be redirected to', self.html) is not None): + if re.search(r'gallery not found|You will be redirected to', self.html): return False else: return True diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py index 2dd72f75e..b66b9a505 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -3,79 +3,53 @@ from __future__ import with_statement from os import remove -from os.path import exists -from urllib import quote -from pyload.plugin.Hoster import Hoster -from pyload.utils import fs_encode +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo +from module.utils import fs_encode -class PremiumTo(Hoster): +class PremiumTo(MultiHoster): __name__ = "PremiumTo" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.21" - __pattern__ = r'https?://(?:www\.)?premium\.to/.+' + __pattern__ = r'^unmatchable$' - __description__ = """Premium.to hoster plugin""" + __description__ = """Premium.to multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.org"), ("zoidberg", "zoidberg@mujmail.cz"), ("stickell", "l.stickell@yahoo.it")] - def setup(self): - self.resumeDownload = True - self.chunkLimit = 1 + CHECK_TRAFFIC = True - def process(self, pyfile): - if not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "premium.to") - self.fail(_("No premium.to account provided")) - - self.logDebug("Old URL: %s" % pyfile.url) - - tra = self.getTraffic() - + def handlePremium(self, pyfile): #raise timeout to 2min - self.req.setOption("timeout", 120) - self.download("http://premium.to/api/getfile.php", get={'username': self.account.username, 'password': self.account.password, - 'link' : quote(pyfile.url, "")}, + 'link' : pyfile.url}, disposition=True) - check = self.checkDownload({"nopremium": "No premium account available"}) - if check == "nopremium": + def checkFile(self): + if self.checkDownload({'nopremium': "No premium account available"}): self.retry(60, 5 * 60, "No premium account available") err = '' if self.req.http.code == '420': # Custom error code send - fail - lastDownload = fs_encode(self.lastDownload) - - if exists(lastDownload): - with open(lastDownload, "rb") as f: - err = f.read(256).strip() - remove(lastDownload) - else: - err = _('File does not exist') - - trb = self.getTraffic() - self.logInfo(_("Filesize: %d, Traffic used %d, traffic left %d") % (pyfile.size, tra - trb, trb)) + file = fs_encode(self.lastDownload) + with open(file, "rb") as f: + err = f.read(256).strip() + remove(file) if err: self.fail(err) + return super(PremiumTo, self).checkFile() + - def getTraffic(self): - try: - api_r = self.load("http://premium.to/api/straffic.php", - get={'username': self.account.username, 'password': self.account.password}) - traffic = sum(map(int, api_r.split(';'))) - except Exception: - traffic = 0 - return traffic +getInfo = create_getInfo(PremiumTo) diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py index 5f0685483..3d19c88ac 100644 --- a/module/plugins/hoster/PremiumizeMe.py +++ b/module/plugins/hoster/PremiumizeMe.py @@ -1,27 +1,22 @@ # -*- coding: utf-8 -*- -from pyload.utils import json_loads -from pyload.plugin.Hoster import Hoster +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -class PremiumizeMe(Hoster): +class PremiumizeMe(MultiHoster): __name__ = "PremiumizeMe" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.16" - __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.activate + __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady - __description__ = """Premiumize.me hoster plugin""" + __description__ = """Premiumize.me multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] - def process(self, pyfile): - # Check account - if not self.account or not self.account.canUse(): - self.logError(_("Please enter your %s account or deactivate this plugin") % "premiumize.me") - self.fail(_("No valid premiumize.me account provided")) - + def handlePremium(self, pyfile): # In some cases hostsers do not supply us with a filename at download, so we # are going to set a fall back filename (e.g. for freakshare or xfileshare) pyfile.name = pyfile.name.split('/').pop() # Remove everthing before last slash @@ -33,7 +28,7 @@ class PremiumizeMe(Hoster): pyfile.name = ".".join(temp) # Get account data - (user, data) = self.account.selectAccount() + user, data = self.account.selectAccount() # Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api) data = json_loads(self.load("https://api.premiumize.me/pm-api/v1.php", @@ -44,13 +39,22 @@ class PremiumizeMe(Hoster): # Check status and decide what to do status = data['status'] + if status == 200: - self.download(data['result']['location'], disposition=True) + self.link = data['result']['location'] + return + elif status == 400: self.fail(_("Invalid link")) + elif status == 404: self.offline() + elif status >= 500: self.tempOffline() + else: self.fail(data['statusmessage']) + + +getInfo = create_getInfo(PremiumizeMe) diff --git a/module/plugins/hoster/PromptfileCom.py b/module/plugins/hoster/PromptfileCom.py index f0752692e..2aaf14736 100644 --- a/module/plugins/hoster/PromptfileCom.py +++ b/module/plugins/hoster/PromptfileCom.py @@ -8,7 +8,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class PromptfileCom(SimpleHoster): __name__ = "PromptfileCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __pattern__ = r'https?://(?:www\.)?promptfile\.com/' @@ -21,10 +21,10 @@ class PromptfileCom(SimpleHoster): OFFLINE_PATTERN = r'<span style="[^"]*" title="File Not Found">File Not Found</span>' CHASH_PATTERN = r'<input type="hidden" name="chash" value="([^"]*)" />' - LINK_PATTERN = r'<a href=\"(.+)\" target=\"_blank\" class=\"view_dl_link\">Download File</a>' + LINK_FREE_PATTERN = r'<a href=\"(.+)\" target=\"_blank\" class=\"view_dl_link\">Download File</a>' - def handleFree(self): + def handleFree(self, pyfile): # STAGE 1: get link to continue m = re.search(self.CHASH_PATTERN, self.html) if m is None: @@ -32,14 +32,14 @@ class PromptfileCom(SimpleHoster): chash = m.group(1) self.logDebug("Read chash %s" % chash) # continue to stage2 - self.html = self.load(self.pyfile.url, decode=True, post={'chash': chash}) + self.html = self.load(pyfile.url, decode=True, post={'chash': chash}) # STAGE 2: get the direct link - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) - self.download(m.group(1), disposition=True) + self.link = m.group(1) getInfo = create_getInfo(PromptfileCom) diff --git a/module/plugins/hoster/PutdriveCom.py b/module/plugins/hoster/PutdriveCom.py new file mode 100644 index 000000000..7f4b7b6cc --- /dev/null +++ b/module/plugins/hoster/PutdriveCom.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from module.plugins.hoster.ZeveraCom import ZeveraCom + + +class PutdriveCom(ZeveraCom): + __name__ = "PutdriveCom" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'https?://(?:www\.)putdrive\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' + + __description__ = """Multihosters.com multi-hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 4c4b5df9d..5a3fd871b 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -8,9 +8,9 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class QuickshareCz(SimpleHoster): __name__ = "QuickshareCz" __type__ = "hoster" - __version__ = "0.55" + __version__ = "0.56" - __pattern__ = r'http://(?:[^/]*\.)?quickshare\.cz/stahnout-soubor/.*' + __pattern__ = r'http://(?:[^/]*\.)?quickshare\.cz/stahnout-soubor/.+' __description__ = """Quickshare.cz hoster plugin""" __license__ = "GPLv3" @@ -43,16 +43,15 @@ class QuickshareCz(SimpleHoster): self.premium = False if self.premium: - self.handlePremium() + self.handlePremium(pyfile) else: - self.handleFree() + self.handleFree(pyfile) - check = self.checkDownload({"err": re.compile(r"\AChyba!")}, max_size=100) - if check == "err": + if self.checkDownload({"error": re.compile(r"\AChyba!")}, max_size=100): self.fail(_("File not m or plugin defect")) - def handleFree(self): + def handleFree(self, pyfile): # 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")) @@ -81,7 +80,7 @@ class QuickshareCz(SimpleHoster): self.download(download_url) - def handlePremium(self): + def handlePremium(self, pyfile): 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")) self.download(download_url, get=data) diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py index c6dfae9a6..8ab8cb7c4 100644 --- a/module/plugins/hoster/RPNetBiz.py +++ b/module/plugins/hoster/RPNetBiz.py @@ -2,84 +2,79 @@ import re -from pyload.plugin.Hoster import Hoster -from pyload.utils import json_loads +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo +from module.common.json_layer import json_loads -class RPNetBiz(Hoster): +class RPNetBiz(MultiHoster): __name__ = "RPNetBiz" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.14" - __description__ = """RPNet.biz hoster plugin""" + __description__ = """RPNet.biz multi-hoster plugin""" __license__ = "GPLv3" - __pattern__ = r'https?://.*rpnet\.biz' + __pattern__ = r'https?://.+rpnet\.biz' __authors__ = [("Dman", "dmanugm@gmail.com")] def setup(self): self.chunkLimit = -1 - self.resumeDownload = True - def process(self, pyfile): - if re.match(self.__pattern__, pyfile.url): - link_status = {'generated': pyfile.url} - elif not self.account: - # Check account - self.logError(_("Please enter your %s account or deactivate this plugin") % "rpnet") - self.fail(_("No rpnet account provided")) - else: - (user, data) = self.account.selectAccount() - - self.logDebug("Original URL: %s" % pyfile.url) - # Get the download link - res = self.load("https://premium.rpnet.biz/client_api.php", - get={"username": user, - "password": data['password'], - "action": "generate", - "links": pyfile.url}) - - self.logDebug("JSON data: %s" % res) - link_status = json_loads(res)['links'][0] # get the first link... since we only queried one - - # Check if we only have an id as a HDD link - if 'id' in link_status: - self.logDebug("Need to wait at least 30 seconds before requery") - self.setWait(30) # wait for 30 seconds + def handlePremium(self, pyfile): + user, data = self.account.selectAccount() + + # Get the download link + res = self.load("https://premium.rpnet.biz/client_api.php", + get={"username": user, + "password": data['password'], + "action" : "generate", + "links" : pyfile.url}) + + self.logDebug("JSON data: %s" % res) + link_status = json_loads(res)['links'][0] # get the first link... since we only queried one + + # Check if we only have an id as a HDD link + if 'id' in link_status: + self.logDebug("Need to wait at least 30 seconds before requery") + self.setWait(30) # wait for 30 seconds + self.wait() + # Lets query the server again asking for the status on the link, + # we need to keep doing this until we reach 100 + max_tries = 30 + my_try = 0 + while (my_try <= max_tries): + self.logDebug("Try: %d ; Max Tries: %d" % (my_try, max_tries)) + res = self.load("https://premium.rpnet.biz/client_api.php", + get={"username": user, + "password": data['password'], + "action": "downloadInformation", + "id": link_status['id']}) + self.logDebug("JSON data hdd query: %s" % res) + download_status = json_loads(res)['download'] + + if download_status['status'] == '100': + link_status['generated'] = download_status['rpnet_link'] + self.logDebug("Successfully downloaded to rpnet HDD: %s" % link_status['generated']) + break + else: + self.logDebug("At %s%% for the file download" % download_status['status']) + + self.setWait(30) self.wait() - # Lets query the server again asking for the status on the link, - # we need to keep doing this until we reach 100 - max_tries = 30 - my_try = 0 - while (my_try <= max_tries): - self.logDebug("Try: %d ; Max Tries: %d" % (my_try, max_tries)) - res = self.load("https://premium.rpnet.biz/client_api.php", - get={"username": user, - "password": data['password'], - "action": "downloadInformation", - "id": link_status['id']}) - self.logDebug("JSON data hdd query: %s" % res) - download_status = json_loads(res)['download'] - - if download_status['status'] == '100': - link_status['generated'] = download_status['rpnet_link'] - self.logDebug("Successfully downloaded to rpnet HDD: %s" % link_status['generated']) - break - else: - self.logDebug("At %s%% for the file download" % download_status['status']) - - self.setWait(30) - self.wait() - my_try += 1 - - if my_try > max_tries: # We went over the limit! - self.fail(_("Waited for about 15 minutes for download to finish but failed")) + my_try += 1 + + if my_try > max_tries: # We went over the limit! + self.fail(_("Waited for about 15 minutes for download to finish but failed")) if 'generated' in link_status: - self.download(link_status['generated'], disposition=True) + self.link = link_status['generated'] + return elif 'error' in link_status: self.fail(link_status['error']) else: self.fail(_("Something went wrong, not supposed to enter here")) + + +getInfo = create_getInfo(RPNetBiz) diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py new file mode 100644 index 000000000..85591f51f --- /dev/null +++ b/module/plugins/hoster/RapideoPl.py @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster + + +class RapideoPl(MultiHoster): + __name__ = "RapideoPl" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'^unmatchable$' + + __description__ = """Rapideo.pl multi-hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@rapideo.pl")] + + + API_URL = "http://enc.rapideo.pl" + + API_QUERY = {'site' : "newrd", + 'output' : "json", + 'username': "", + 'password': "", + 'url' : ""} + + ERROR_CODES = {0 : "[%s] Incorrect login credentials", + 1 : "[%s] Not enough transfer to download - top-up your account", + 2 : "[%s] Incorrect / dead link", + 3 : "[%s] Error connecting to hosting, try again later", + 9 : "[%s] Premium account has expired", + 15: "[%s] Hosting no longer supported", + 80: "[%s] Too many incorrect login attempts, account blocked for 24h"} + + + def prepare(self): + super(RapideoPl, self).prepare() + + data = self.account.getAccountData(self.user) + + self.usr = data['usr'] + self.pwd = data['pwd'] + + + def runFileQuery(self, url, mode=None): + query = self.API_QUERY.copy() + + query["username"] = self.usr + query["password"] = self.pwd + query["url"] = url + + if mode == "fileinfo": + query['check'] = 2 + query['loc'] = 1 + + self.logDebug(query) + + return self.load(self.API_URL, post=query) + + + def handleFree(self, pyfile): + try: + data = self.runFileQuery(pyfile.url, 'fileinfo') + + except Exception: + self.logDebug("RunFileQuery error") + self.tempOffline() + + try: + parsed = json_loads(data) + + except Exception: + self.logDebug("Loads error") + self.tempOffline() + + self.logDebug(parsed) + + if "errno" in parsed.keys(): + if parsed["errno"] in self.ERROR_CODES: + # error code in known + self.fail(self.ERROR_CODES[parsed["errno"]] % self.__name__) + else: + # error code isn't yet added to plugin + self.fail( + parsed["errstring"] + or _("Unknown error (code: %s)") % parsed["errno"] + ) + + if "sdownload" in parsed: + if parsed["sdownload"] == "1": + self.fail( + _("Download from %s is possible only using Rapideo.pl website \ + directly") % parsed["hosting"]) + + pyfile.name = parsed["filename"] + pyfile.size = parsed["filesize"] + + try: + self.link = self.runFileQuery(pyfile.url, 'filedownload') + + except Exception: + self.logDebug("runFileQuery error #2") + self.tempOffline() diff --git a/module/plugins/hoster/RapidfileshareNet.py b/module/plugins/hoster/RapidfileshareNet.py index e5c75a7bd..6d54f72f2 100644 --- a/module/plugins/hoster/RapidfileshareNet.py +++ b/module/plugins/hoster/RapidfileshareNet.py @@ -6,7 +6,7 @@ from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class RapidfileshareNet(XFSHoster): __name__ = "RapidfileshareNet" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?rapidfileshare\.net/\w{12}' @@ -15,17 +15,11 @@ class RapidfileshareNet(XFSHoster): __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "rapidfileshare.net" - NAME_PATTERN = r'<input type="hidden" name="fname" value="(?P<N>.+?)">' SIZE_PATTERN = r'>http://www.rapidfileshare.net/\w+?</font> \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)</font>' - OFFLINE_PATTERN = r'>No such file with this filename' + OFFLINE_PATTERN = r'>No such file with this filename' TEMP_OFFLINE_PATTERN = r'The page may have been renamed, removed or be temporarily unavailable.<' - def handlePremium(self): - self.fail(_("Premium download not implemented")) - - getInfo = create_getInfo(RapidfileshareNet) diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 153b0314e..2dfd8f59c 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -4,17 +4,16 @@ import re from pycurl import HTTPHEADER -from pyload.utils import json_loads -from pyload.network.HTTPRequest import BadHeader -from pyload.plugin.hoster.UnrestrictLi import secondsToMidnight -from pyload.plugin.internal.captcha import AdsCaptcha, ReCaptcha, SolveMedia -from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.common.json_layer import json_loads +from module.network.HTTPRequest import BadHeader +from module.plugins.internal.CaptchaService import AdsCaptcha, ReCaptcha, SolveMedia +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, secondsToMidnight class RapidgatorNet(SimpleHoster): __name__ = "RapidgatorNet" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.32" __pattern__ = r'http://(?:www\.)?(rapidgator\.net|rg\.to)/file/\w+' @@ -30,24 +29,26 @@ class RapidgatorNet(SimpleHoster): COOKIES = [("rapidgator.net", "lang", "en")] - NAME_PATTERN = r'<title>Download file (?P<N>.*)</title>' - SIZE_PATTERN = r'File size:\s*<strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' + NAME_PATTERN = r'<title>Download file (?P<N>.*)</title>' + SIZE_PATTERN = r'File size:\s*<strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' OFFLINE_PATTERN = r'>(File not found|Error 404)' JSVARS_PATTERN = r'\s+var\s*(startTimerUrl|getDownloadUrl|captchaUrl|fid|secs)\s*=\s*\'?(.*?)\'?;' - PREMIUM_ONLY_ERROR_PATTERN = r'You can download files up to|This file can be downloaded by premium only<' - DOWNLOAD_LIMIT_ERROR_PATTERN = r'You have reached your (daily|hourly) downloads limit' - WAIT_PATTERN = r'(?:Delay between downloads must be not less than|Try again in)\s*(\d+)\s*(hour|min)' - LINK_PATTERN = r'return \'(http://\w+.rapidgator.net/.*)\';' - RECAPTCHA_PATTERN = r'"http://api\.recaptcha\.net/challenge\?k=(.*?)"' + PREMIUM_ONLY_PATTERN = r'You can download files up to|This file can be downloaded by premium only<' + ERROR_PATTERN = r'You have reached your (daily|hourly) downloads limit' + WAIT_PATTERN = r'(Delay between downloads must be not less than|Try again in).+' + + LINK_FREE_PATTERN = r'return \'(http://\w+.rapidgator.net/.*)\';' + + RECAPTCHA_PATTERN = r'"http://api\.recaptcha\.net/challenge\?k=(.*?)"' ADSCAPTCHA_PATTERN = r'(http://api\.adscaptcha\.com/Get\.aspx[^"\']*)' SOLVEMEDIA_PATTERN = r'http://api\.solvemedia\.com/papi/challenge\.script\?k=(.*?)"' def setup(self): if self.account: - self.sid = self.account.getAccountData(self.user).get('SID', None) + self.sid = self.account.getAccountInfo(self.user).get('sid', None) else: self.sid = None @@ -85,51 +86,47 @@ class RapidgatorNet(SimpleHoster): self.retry(wait_time=60) - def handlePremium(self): - #self.logDebug("ACCOUNT_DATA", self.account.getAccountData(self.user)) + def handlePremium(self, pyfile): self.api_data = self.api_response('info') self.api_data['md5'] = self.api_data['hash'] - self.pyfile.name = self.api_data['filename'] - self.pyfile.size = self.api_data['size'] - url = self.api_response('download')['url'] - self.download(url) + pyfile.name = self.api_data['filename'] + pyfile.size = self.api_data['size'] + + self.link = self.api_response('download')['url'] - def handleFree(self): - self.checkFree() + def handleFree(self, pyfile): jsvars = dict(re.findall(self.JSVARS_PATTERN, self.html)) self.logDebug(jsvars) - self.req.http.lastURL = self.pyfile.url + self.req.http.lastURL = pyfile.url self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) url = "http://rapidgator.net%s?fid=%s" % ( jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars['fid']) jsvars.update(self.getJsonResponse(url)) - self.wait(int(jsvars.get('secs', 45)), False) + self.wait(jsvars.get('secs', 45), False) url = "http://rapidgator.net%s?sid=%s" % ( jsvars.get('getDownloadUrl', '/download/AjaxGetDownload'), jsvars['sid']) jsvars.update(self.getJsonResponse(url)) - self.req.http.lastURL = self.pyfile.url + self.req.http.lastURL = pyfile.url self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"]) url = "http://rapidgator.net%s" % jsvars.get('captchaUrl', '/download/captcha') self.html = self.load(url) for _i in xrange(5): - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m: - link = m.group(1) - self.logDebug(link) - self.download(link, disposition=True) + self.link = m.group(1) break else: - captcha, captcha_key = self.getCaptcha() - challenge, response = captcha.challenge(captcha_key) + captcha, captcha_key = self.handleCaptcha() + response, challenge = captcha.challenge(captcha_key) self.html = self.load(url, post={'DownloadCaptchaForm[captcha]': "", 'adcopy_challenge' : challenge, @@ -143,51 +140,27 @@ class RapidgatorNet(SimpleHoster): self.error(_("Download link")) - def getCaptcha(self): + def handleCaptcha(self): m = re.search(self.ADSCAPTCHA_PATTERN, self.html) if m: captcha_key = m.group(1) - captcha = AdsCaptcha(self) + captcha = AdsCaptcha(self) else: m = re.search(self.RECAPTCHA_PATTERN, self.html) if m: captcha_key = m.group(1) - captcha = ReCaptcha(self) + captcha = ReCaptcha(self) else: m = re.search(self.SOLVEMEDIA_PATTERN, self.html) if m: captcha_key = m.group(1) - captcha = SolveMedia(self) + captcha = SolveMedia(self) else: self.error(_("Captcha")) return captcha, captcha_key - def checkFree(self): - m = re.search(self.PREMIUM_ONLY_ERROR_PATTERN, self.html) - if m: - self.fail(_("Premium account needed for download")) - else: - m = re.search(self.WAIT_PATTERN, self.html) - - if m: - wait_time = int(m.group(1)) * {"hour": 60, "min": 1}[m.group(2)] - else: - m = re.search(self.DOWNLOAD_LIMIT_ERROR_PATTERN, self.html) - if m is None: - return - elif m.group(1) == "daily": - self.logWarning(_("You have reached your daily downloads limit for today")) - wait_time = secondsToMidnight(gmt=2) - else: - wait_time = 1 * 60 * 60 - - self.logDebug("Waiting %d minutes" % wait_time / 60) - self.wait(wait_time, True) - self.retry() - - def getJsonResponse(self, url): res = self.load(url, decode=True) if not res.startswith('{'): diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py index 4b6ef55bb..5c12bf924 100644 --- a/module/plugins/hoster/RapiduNet.py +++ b/module/plugins/hoster/RapiduNet.py @@ -13,7 +13,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class RapiduNet(SimpleHoster): __name__ = "RapiduNet" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.07" __pattern__ = r'https?://(?:www\.)?rapidu\.net/(?P<ID>\d{10})' @@ -24,8 +24,8 @@ class RapiduNet(SimpleHoster): COOKIES = [("rapidu.net", "rapidu_lang", "en")] - FILE_INFO_PATTERN = r'<h1 title="(?P<N>.*)">.*</h1>\s*<small>(?P<S>\d+(\.\d+)?)\s(?P<U>\w+)</small>' - OFFLINE_PATTERN = r'404 - File not found' + INFO_PATTERN = r'<h1 title="(?P<N>.*)">.*</h1>\s*<small>(?P<S>\d+(\.\d+)?)\s(?P<U>\w+)</small>' + OFFLINE_PATTERN = r'404 - File not found' ERROR_PATTERN = r'<div class="error">' @@ -34,22 +34,24 @@ class RapiduNet(SimpleHoster): def setup(self): self.resumeDownload = True - self.multiDL = True - self.limitDL = 0 if self.premium else 2 + self.multiDL = self.premium - def handleFree(self): - self.req.http.lastURL = self.pyfile.url + def handleFree(self, pyfile): + self.req.http.lastURL = pyfile.url self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) - jsvars = self.getJsonResponse("https://rapidu.net/ajax.php?a=getLoadTimeToDownload", {'_go': None}) + jsvars = self.getJsonResponse("https://rapidu.net/ajax.php", + get={'a': "getLoadTimeToDownload"}, + post={'_go': ""}, + decode=True) if str(jsvars['timeToDownload']) is "stop": - t = (24 * 60 * 60) - (int(time()) % (24 *60 * 60)) + altzone + t = (24 * 60 * 60) - (int(time()) % (24 * 60 * 60)) + altzone self.logInfo("You've reach your daily download transfer") - self.retry(10, 10 if t < 1 else None, "Try tomorrow again") #@NOTE: check t in case of not synchronised clock + self.retry(10, 10 if t < 1 else None, _("Try tomorrow again")) #@NOTE: check t in case of not synchronised clock else: self.wait(int(jsvars['timeToDownload']) - int(time())) @@ -57,24 +59,26 @@ class RapiduNet(SimpleHoster): recaptcha = ReCaptcha(self) for _i in xrange(10): - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) - - jsvars = self.getJsonResponse("https://rapidu.net/ajax.php?a=getCheckCaptcha", - {'_go' : None, - 'captcha1': challenge, - 'captcha2': response, - 'fileId' : self.info['ID']}) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) + + jsvars = self.getJsonResponse("https://rapidu.net/ajax.php", + get={'a': "getCheckCaptcha"}, + post={'_go' : "", + 'captcha1': challenge, + 'captcha2': response, + 'fileId' : self.info['pattern']['ID']}, + decode=True) if jsvars['message'] == 'success': self.download(jsvars['url']) break - def getJsonResponse(self, url, post_data): - res = self.load(url, post=post_data, decode=True) + def getJsonResponse(self, *args, **kwargs): + res = self.load(*args, **kwargs) if not res.startswith('{'): self.retry() - self.logDebug(url, res) + self.logDebug(res) return json_loads(res) diff --git a/module/plugins/hoster/RarefileNet.py b/module/plugins/hoster/RarefileNet.py index 6ea06720d..8f0bf8834 100644 --- a/module/plugins/hoster/RarefileNet.py +++ b/module/plugins/hoster/RarefileNet.py @@ -8,7 +8,7 @@ from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class RarefileNet(XFSHoster): __name__ = "RarefileNet" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __pattern__ = r'http://(?:www\.)?rarefile\.net/\w{12}' @@ -17,12 +17,7 @@ class RarefileNet(XFSHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - HOSTER_DOMAIN = "rarefile.net" - - NAME_PATTERN = r'<font color="red">(?P<N>.+?)<' - SIZE_PATTERN = r'>Size : (?P<S>[\d.,]+) (?P<U>[\w^_]+)' - - LINK_PATTERN = r'<a href="(?P<link>[^"]+)">(?P=link)</a>' + LINK_PATTERN = r'<a href="(.+?)">\1</a>' getInfo = create_getInfo(RarefileNet) diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index c78fc8b55..d0010b3bd 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -3,22 +3,22 @@ import re from random import randrange -from urllib import quote, unquote +from urllib import unquote from time import time -from pyload.utils import json_loads -from pyload.plugin.Hoster import Hoster -from pyload.utils import parseFileSize +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo +from module.utils import parseFileSize -class RealdebridCom(Hoster): +class RealdebridCom(MultiHoster): __name__ = "RealdebridCom" __type__ = "hoster" - __version__ = "0.53" + __version__ = "0.64" - __pattern__ = r'https?://(?:[^/]*\.)?real-debrid\..*' + __pattern__ = r'https?://((?:www\.|s\d+\.)?real-debrid\.com/dl/|[\w^_]\.rdb\.so/d/)[\w^_]+' - __description__ = """Real-Debrid.com hoster plugin""" + __description__ = """Real-Debrid.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] @@ -35,60 +35,45 @@ class RealdebridCom(Hoster): def setup(self): self.chunkLimit = 3 - self.resumeDownload = True - def process(self, pyfile): - if re.match(self.__pattern__, pyfile.url): - new_url = pyfile.url - elif not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "Real-debrid") - self.fail(_("No Real-debrid account provided")) - else: - self.logDebug("Old URL: %s" % pyfile.url) - password = self.getPassword().splitlines() - if not password: - password = "" - else: - password = password[0] - - data = json_loads(self.load("https://real-debrid.com/ajax/unrestrict.php", - get={'lang' : "en", - 'link' : quote(pyfile.url, ""), - 'password': password, - 'time' : int(time() * 1000)})) - - self.logDebug("Returned Data: %s" % data) - - if data['error'] != 0: - if data['message'] == "Your file is unavailable on the hoster.": - self.offline() - else: - self.logWarning(data['message']) - self.tempOffline() - else: - if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['file_name']: - pyfile.name = data['file_name'] - pyfile.size = parseFileSize(data['file_size']) - new_url = data['generated_links'][0][-1] + def handlePremium(self, pyfile): + data = json_loads(self.load("https://real-debrid.com/ajax/unrestrict.php", + get={'lang' : "en", + 'link' : pyfile.url, + 'password': self.getPassword(), + 'time' : int(time() * 1000)})) - if self.getConfig("https"): - new_url = new_url.replace("http://", "https://") + self.logDebug("Returned Data: %s" % data) + + if data['error'] != 0: + if data['message'] == "Your file is unavailable on the hoster.": + self.offline() + else: + self.logWarning(data['message']) + self.tempOffline() else: - new_url = new_url.replace("https://", "http://") + if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['file_name']: + pyfile.name = data['file_name'] + pyfile.size = parseFileSize(data['file_size']) + self.link = data['generated_links'][0][-1] - if new_url != pyfile.url: - self.logDebug("New URL: %s" % new_url) + if self.getConfig("ssl"): + self.link = self.link.replace("http://", "https://") + else: + self.link = self.link.replace("https://", "http://") if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'): #only use when name wasnt already set - pyfile.name = self.getFilename(new_url) - - self.download(new_url, disposition=True) + pyfile.name = self.getFilename(self.link) - check = self.checkDownload( - {"error": "<title>An error occured while processing your request</title>"}) - if check == "error": + def checkFile(self): + if self.checkDownload({"error": "<title>An error occured while processing your request</title>"}): #usual this download can safely be retried self.retry(wait_time=60, reason=_("An error occured while generating link")) + + return super(RealdebridCom, self).checkFile() + + +getInfo = create_getInfo(RealdebridCom) diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py index 7aa220187..28de35d08 100644 --- a/module/plugins/hoster/RehostTo.py +++ b/module/plugins/hoster/RehostTo.py @@ -1,44 +1,28 @@ # -*- coding: utf-8 -*- -from urllib import quote, unquote +from urllib import unquote -from pyload.plugin.Hoster import Hoster +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo -class RehostTo(Hoster): +class RehostTo(MultiHoster): __name__ = "RehostTo" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.21" - __pattern__ = r'https?://.*rehost\.to\..*' + __pattern__ = r'https?://.*rehost\.to\..+' - __description__ = """Rehost.com hoster plugin""" + __description__ = """Rehost.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.org")] - def getFilename(self, url): - return unquote(url.rsplit("/", 1)[1]) - - - def setup(self): - self.chunkLimit = 1 - self.resumeDownload = True - - - def process(self, pyfile): - if not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "rehost.to") - self.fail(_("No rehost.to account provided")) - - data = self.account.getAccountInfo(self.user) - long_ses = data['long_ses'] - - self.logDebug("Rehost.to: Old URL: %s" % pyfile.url) - - #raise timeout to 2min - self.req.setOption("timeout", 120) - + def handlePremium(self, pyfile): self.download("http://rehost.to/process_download.php", - get={'user': "cookie", 'pass': long_ses, 'dl': quote(pyfile.url, "")}, + get={'user': "cookie", + 'pass': self.account.getAccountInfo(self.user)['session'], + 'dl' : pyfile.url}, disposition=True) + + +getInfo = create_getInfo(RehostTo) diff --git a/module/plugins/hoster/RemixshareCom.py b/module/plugins/hoster/RemixshareCom.py index 96467c1e7..b1587ad6d 100644 --- a/module/plugins/hoster/RemixshareCom.py +++ b/module/plugins/hoster/RemixshareCom.py @@ -16,7 +16,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class RemixshareCom(SimpleHoster): __name__ = "RemixshareCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'https?://remixshare\.com/(download|dl)/\w+' @@ -29,7 +29,7 @@ class RemixshareCom(SimpleHoster): INFO_PATTERN = r'title=\'.+?\'>(?P<N>.+?)</span><span class=\'light2\'> \((?P<S>\d+) (?P<U>[\w^_]+)\)<' OFFLINE_PATTERN = r'<h1>Ooops!<' - LINK_PATTERN = r'(http://remixshare\.com/downloadfinal/.+?)"' + LINK_FREE_PATTERN = r'(http://remixshare\.com/downloadfinal/.+?)"' TOKEN_PATTERN = r'var acc = (\d+)' WAIT_PATTERN = r'var XYZ = r"(\d+)"' @@ -39,23 +39,22 @@ class RemixshareCom(SimpleHoster): self.chunkLimit = 1 - def handleFree(self): - b = re.search(self.LINK_PATTERN, self.html) + def handleFree(self, pyfile): + b = re.search(self.LINK_FREE_PATTERN, self.html) if not b: self.error(_("Cannot parse download url")) + c = re.search(self.TOKEN_PATTERN, self.html) if not c: self.error(_("Cannot parse file token")) - dl_url = b.group(1) + c.group(1) + + self.link = b.group(1) + c.group(1) #Check if we have to wait seconds = re.search(self.WAIT_PATTERN, self.html) if seconds: self.logDebug("Wait " + seconds.group(1)) - self.wait(int(seconds.group(1))) - - # Finally start downloading... - self.download(dl_url, disposition=True) + self.wait(seconds.group(1)) getInfo = create_getInfo(RemixshareCom) diff --git a/module/plugins/hoster/RyushareCom.py b/module/plugins/hoster/RyushareCom.py deleted file mode 100644 index e5b00db7f..000000000 --- a/module/plugins/hoster/RyushareCom.py +++ /dev/null @@ -1,81 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Test links: -# http://ryushare.com/cl0jy8ric2js/random.bin - -import re - -from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo -from pyload.plugin.internal.captcha import SolveMedia - - -class RyushareCom(XFSHoster): - __name__ = "RyushareCom" - __type__ = "hoster" - __version__ = "0.20" - - __pattern__ = r'http://(?:www\.)?ryushare\.com/\w+' - - __description__ = """Ryushare.com hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it"), - ("quareevo", "quareevo@arcor.de")] - - - HOSTER_DOMAIN = "ryushare.com" - - SIZE_PATTERN = r'You have requested <font color="red">[^<]+</font> \((?P<S>[\d.,]+) (?P<U>[\w^_]+)' - - WAIT_PATTERN = r'You have to wait ((?P<hour>\d+) hour[s]?, )?((?P<min>\d+) minute[s], )?(?P<sec>\d+) second[s]' - LINK_PATTERN = r'<a href="([^"]+)">Click here to download<' - - - def getDownloadLink(self): - retry = False - self.html = self.load(self.pyfile.url) - action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")}) - if "method_premium" in inputs: - del inputs['method_premium'] - - self.html = self.load(self.pyfile.url, post=inputs) - action, inputs = self.parseHtmlForm('F1') - - self.setWait(65) - # Wait 1 hour - if "You have reached the download-limit" in self.html: - self.setWait(1 * 60 * 60, True) - retry = True - - m = re.search(self.WAIT_PATTERN, self.html) - if m: - wait = m.groupdict(0) - waittime = int(wait['hour']) * 60 * 60 + int(wait['min']) * 60 + int(wait['sec']) - self.setWait(waittime, True) - retry = True - - self.wait() - if retry: - self.retry() - - for _i in xrange(5): - solvemedia = SolveMedia(self) - challenge, response = solvemedia.challenge() - - inputs['adcopy_challenge'] = challenge - inputs['adcopy_response'] = response - - self.html = self.load(self.pyfile.url, post=inputs) - if "WRONG CAPTCHA" in self.html: - self.invalidCaptcha() - else: - self.correctCaptcha() - break - else: - self.fail(_("You have entered 5 invalid captcha codes")) - - if "Click here to download" in self.html: - return re.search(r'<a href="([^"]+)">Click here to download</a>', self.html).group(1) - - -getInfo = create_getInfo(RyushareCom) diff --git a/module/plugins/hoster/SafesharingEu.py b/module/plugins/hoster/SafesharingEu.py index 3d7140c6e..c1fc9c68d 100644 --- a/module/plugins/hoster/SafesharingEu.py +++ b/module/plugins/hoster/SafesharingEu.py @@ -15,10 +15,6 @@ class SafesharingEu(XFSHoster): __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - HOSTER_DOMAIN = "safesharing.eu" - - WAIT_PATTERN = r'You have to wait (\d+) minutes' - ERROR_PATTERN = r'(?:<div class="alert alert-danger">)(.+?)(?:</div>)' diff --git a/module/plugins/hoster/SecureUploadEu.py b/module/plugins/hoster/SecureUploadEu.py index ec8bbfc57..0b2b603bf 100644 --- a/module/plugins/hoster/SecureUploadEu.py +++ b/module/plugins/hoster/SecureUploadEu.py @@ -15,8 +15,6 @@ class SecureUploadEu(XFSHoster): __authors__ = [("z00nx", "z00nx0@gmail.com")] - HOSTER_DOMAIN = "secureupload.eu" - INFO_PATTERN = r'<h3>Downloading (?P<N>[^<]+) \((?P<S>[^<]+)\)</h3>' diff --git a/module/plugins/hoster/SendmywayCom.py b/module/plugins/hoster/SendmywayCom.py deleted file mode 100644 index 86c505d2d..000000000 --- a/module/plugins/hoster/SendmywayCom.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo - - -class SendmywayCom(XFSHoster): - __name__ = "SendmywayCom" - __type__ = "hoster" - __version__ = "0.04" - - __pattern__ = r'http://(?:www\.)?sendmyway\.com/\w{12}' - - __description__ = """SendMyWay hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - HOSTER_DOMAIN = "sendmyway.com" - - NAME_PATTERN = r'<p class="file-name" ><.*?>\s*(?P<N>.+)' - SIZE_PATTERN = r'<small>\((?P<S>\d+) bytes\)</small>' - - -getInfo = create_getInfo(SendmywayCom) diff --git a/module/plugins/hoster/SendspaceCom.py b/module/plugins/hoster/SendspaceCom.py index abdf52fa6..5310051d1 100644 --- a/module/plugins/hoster/SendspaceCom.py +++ b/module/plugins/hoster/SendspaceCom.py @@ -8,28 +8,29 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class SendspaceCom(SimpleHoster): __name__ = "SendspaceCom" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.17" - __pattern__ = r'http://(?:www\.)?sendspace\.com/file/.*' + __pattern__ = r'https?://(?:www\.)?sendspace\.com/file/\w+' __description__ = """Sendspace.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<h2 class="bgray">\s*<(?:b|strong)>(?P<N>[^<]+)</' - SIZE_PATTERN = r'<div class="file_description reverse margin_center">\s*<b>File Size:</b>\s*(?P<S>[\d.,]+)(?P<U>[\w^_]+)\s*</div>' + NAME_PATTERN = r'<h2 class="bgray">\s*<(?:b|strong)>(?P<N>[^<]+)</' + SIZE_PATTERN = r'<div class="file_description reverse margin_center">\s*<b>File Size:</b>\s*(?P<S>[\d.,]+)(?P<U>[\w^_]+)\s*</div>' OFFLINE_PATTERN = r'<div class="msg error" style="cursor: default">Sorry, the file you requested is not available.</div>' - LINK_PATTERN = r'<a id="download_button" href="([^"]+)"' - CAPTCHA_PATTERN = r'<td><img src="(/captchas/captcha\.php?captcha=([^"]+))"></td>' + LINK_FREE_PATTERN = r'<a id="download_button" href="([^"]+)"' + + CAPTCHA_PATTERN = r'<td><img src="(/captchas/captcha\.php?captcha=([^"]+))"></td>' USER_CAPTCHA_PATTERN = r'<td><img src="/captchas/captcha\.php?user=([^"]+))"></td>' - def handleFree(self): + def handleFree(self, pyfile): params = {} for _i in xrange(3): - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m: if 'captcha_hash' in params: self.correctCaptcha() @@ -50,7 +51,7 @@ class SendspaceCom(SimpleHoster): params = {'download': "Regular Download"} self.logDebug(params) - self.html = self.load(self.pyfile.url, post=params) + self.html = self.load(pyfile.url, post=params) else: self.fail(_("Download link not found")) diff --git a/module/plugins/hoster/Share4WebCom.py b/module/plugins/hoster/Share4WebCom.py index 4748c6e2a..0c2ee358e 100644 --- a/module/plugins/hoster/Share4WebCom.py +++ b/module/plugins/hoster/Share4WebCom.py @@ -4,8 +4,8 @@ from pyload.plugin.hoster.UnibytesCom import UnibytesCom from pyload.plugin.internal.SimpleHoster import create_getInfo -class Share4webCom(UnibytesCom): - __name__ = "Share4webCom" +class Share4WebCom(UnibytesCom): + __name__ = "Share4WebCom" __type__ = "hoster" __version__ = "0.11" @@ -19,4 +19,4 @@ class Share4webCom(UnibytesCom): HOSTER_DOMAIN = "share4web.com" -getInfo = create_getInfo(UnibytesCom) +getInfo = create_getInfo(Share4WebCom) diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 55efe0019..b37b4b0bc 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -14,7 +14,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class ShareonlineBiz(SimpleHoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __version__ = "0.44" + __version__ = "0.48" __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P<ID>\w+)' @@ -28,9 +28,11 @@ class ShareonlineBiz(SimpleHoster): URL_REPLACEMENTS = [(__pattern__ + ".*", "http://www.share-online.biz/dl/\g<ID>")] + CHECK_TRAFFIC = True + RECAPTCHA_KEY = "6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX" - ERROR_INFO_PATTERN = r'<p class="b">Information:</p>\s*<div>\s*<strong>(.*?)</strong>' + ERROR_PATTERN = r'<p class="b">Information:</p>\s*<div>\s*<strong>(.*?)</strong>' @classmethod @@ -48,7 +50,7 @@ class ShareonlineBiz(SimpleHoster): if field[1] == "OK": info['fileid'] = field[0] info['status'] = 2 - info['name'] = field[2] + info['name'] = field[2] info['size'] = field[3] #: in bytes info['md5'] = field[4].strip().lower().replace("\n\n", "") #: md5 @@ -67,7 +69,7 @@ class ShareonlineBiz(SimpleHoster): recaptcha = ReCaptcha(self) for _i in xrange(5): - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) m = re.search(r'var wait=(\d+);', self.html) self.setWait(int(m.group(1)) if m else 30) @@ -86,18 +88,17 @@ class ShareonlineBiz(SimpleHoster): self.fail(_("No valid captcha solution received")) - def handleFree(self): - self.html = self.load(self.pyfile.url, cookies=True) #: refer, stuff - + def handleFree(self, pyfile): self.wait(3) - self.html = self.load("%s/free/" % self.pyfile.url, post={"dl_free": "1", "choice": "free"}, decode=True) + self.html = self.load("%s/free/" % pyfile.url, + post={'dl_free': "1", 'choice': "free"}, + decode=True) self.checkErrors() - res = self.handleCaptcha() - - download_url = res.decode("base64") + res = self.handleCaptcha() + download_url = res.decode('base64') if not download_url.startswith("http://"): self.error(_("Wrong download url")) @@ -108,17 +109,10 @@ class ShareonlineBiz(SimpleHoster): def checkFile(self): - # check download - check = self.checkDownload({ - 'empty' : re.compile(r"^$"), - 'cookie': re.compile(r'<div id="dl_failure"'), - 'fail' : re.compile(r"<title>Share-Online") - }) - - if check == "empty": - self.fail(_("Empty file")) + check = self.checkDownload({'cookie': re.compile(r'<div id="dl_failure"'), + 'fail' : re.compile(r"<title>Share-Online")}) - elif check == "cookie": + if check == "cookie": self.invalidCaptcha() self.retry(5, 60, _("Cookie failure")) @@ -126,13 +120,15 @@ class ShareonlineBiz(SimpleHoster): self.invalidCaptcha() self.retry(5, 5 * 60, _("Download failed")) + return super(ShareonlineBiz, self).checkFile() - def handlePremium(self): #: should be working better loading (account) api internally - self.account.getAccountInfo(self.user, True) + def handlePremium(self, pyfile): #: should be working better loading (account) api internally html = self.load("http://api.share-online.biz/account.php", - {"username": self.user, "password": self.account.accounts[self.user]['password'], - "act": "download", "lid": self.info['fileid']}) + get={'username': self.user, + 'password': self.account.getAccountData(self.user)['password'], + 'act' : "download", + 'lid' : self.info['fileid']}) self.api_data = dlinfo = {} @@ -145,8 +141,8 @@ class ShareonlineBiz(SimpleHoster): if not dlinfo['status'] == "online": self.offline() else: - self.pyfile.name = dlinfo['name'] - self.pyfile.size = int(dlinfo['size']) + pyfile.name = dlinfo['name'] + pyfile.size = int(dlinfo['size']) dlLink = dlinfo['url'] @@ -166,7 +162,7 @@ class ShareonlineBiz(SimpleHoster): errmsg = m.group(1).lower() try: - self.logError(errmsg, re.search(self.ERROR_INFO_PATTERN, self.html).group(1)) + self.logError(errmsg, re.search(self.ERROR_PATTERN, self.html).group(1)) except Exception: self.logError("Unknown error occurred", errmsg) diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py index 139426421..61e0f8723 100644 --- a/module/plugins/hoster/ShareplaceCom.py +++ b/module/plugins/hoster/ShareplaceCom.py @@ -10,9 +10,9 @@ from pyload.plugin.Hoster import Hoster class ShareplaceCom(Hoster): __name__ = "ShareplaceCom" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" - __pattern__ = r'(http://)?(?:www\.)?shareplace\.(com|org)/\?\w+' + __pattern__ = r'http://(?:www\.)?shareplace\.(com|org)/\?\w+' __description__ = """Shareplace.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/ShragleCom.py b/module/plugins/hoster/ShragleCom.py index f606726fe..cf975b2f5 100644 --- a/module/plugins/hoster/ShragleCom.py +++ b/module/plugins/hoster/ShragleCom.py @@ -8,7 +8,7 @@ class ShragleCom(DeadHoster): __type__ = "hoster" __version__ = "0.22" - __pattern__ = r'http://(?:www\.)?(cloudnator|shragle)\.com/files/(?P<ID>.*?)/' + __pattern__ = r'http://(?:www\.)?(cloudnator|shragle)\.com/files/(?P<ID>.+?)/' __description__ = """Cloudnator.com (Shragle.com) hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index f2e00cbf1..a87e7533f 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -4,79 +4,78 @@ import re from datetime import datetime, timedelta -from pyload.plugin.Hoster import Hoster -from pyload.plugin.hoster.UnrestrictLi import secondsToMidnight +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo +from module.plugins.internal.SimpleHoster import secondsToMidnight -class SimplyPremiumCom(Hoster): +class SimplyPremiumCom(MultiHoster): __name__ = "SimplyPremiumCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.08" - __pattern__ = r'https?://.*(simply-premium)\.com' + __pattern__ = r'https?://.+simply-premium\.com' - __description__ = """Simply-Premium.com hoster plugin""" + __description__ = """Simply-Premium.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("EvolutionClip", "evolutionclip@live.de")] def setup(self): self.chunkLimit = 16 - self.resumeDownload = False - def process(self, pyfile): - if re.match(self.__pattern__, pyfile.url): - new_url = pyfile.url - elif not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "Simply-Premium.com") - self.fail(_("No Simply-Premium.com account provided")) + def checkErrors(self): + if '<valid>0</valid>' in self.html or ( + "You are not allowed to download from this host" in self.html and self.premium): + self.account.relogin(self.user) + self.retry() + + elif "NOTFOUND" in self.html: + self.offline() + + elif "downloadlimit" in self.html: + self.logWarning(_("Reached maximum connctions")) + self.retry(5, 60, _("Reached maximum connctions")) + + elif "trafficlimit" in self.html: + self.logWarning(_("Reached daily limit for this host")) + self.retry(wait_time=secondsToMidnight(gmt=2), reason="Daily limit for this host reached") + + elif "hostererror" in self.html: + self.logWarning(_("Hoster temporarily unavailable, waiting 1 minute and retry")) + self.retry(5, 60, _("Hoster is temporarily unavailable")) + + + def handlePremium(self, pyfile): + for i in xrange(5): + self.html = self.load("http://www.simply-premium.com/premium.php", get={'info': "", 'link': self.pyfile.url}) + + if self.html: + self.logDebug("JSON data: " + self.html) + break else: - self.logDebug("Old URL: %s" % pyfile.url) - for i in xrange(5): - page = self.load("http://www.simply-premium.com/premium.php", get={'info': "", 'link': pyfile.url}) - self.logDebug("JSON data: " + page) - if page != '': - break - else: - self.logInfo(_("Unable to get API data, waiting 1 minute and retry")) - self.retry(5, 60, "Unable to get API data") - - if '<valid>0</valid>' in page or ( - "You are not allowed to download from this host" in page and self.premium): - self.account.relogin(self.user) - self.retry() - elif "NOTFOUND" in page: - self.offline() - elif "downloadlimit" in page: - self.logWarning(_("Reached maximum connctions")) - self.retry(5, 60, "Reached maximum connctions") - elif "trafficlimit" in page: - self.logWarning(_("Reached daily limit for this host")) - self.retry(wait_time=secondsToMidnight(gmt=2), "Daily limit for this host reached") - elif "hostererror" in page: - self.logWarning(_("Hoster temporarily unavailable, waiting 1 minute and retry")) - self.retry(5, 60, "Hoster is temporarily unavailable") - #page = json_loads(page) - #new_url = page.keys()[0] - #self.api_data = page[new_url] - - try: - self.pyfile.name = re.search(r'<name>([^<]+)</name>', page).group(1) - except AttributeError: - self.pyfile.name = "" - - try: - self.pyfile.size = re.search(r'<size>(\d+)</size>', page).group(1) - except AttributeError: - self.pyfile.size = 0 - - try: - new_url = re.search(r'<download>([^<]+)</download>', page).group(1) - except AttributeError: - new_url = 'http://www.simply-premium.com/premium.php?link=' + pyfile.url - - if new_url != pyfile.url: - self.logDebug("New URL: " + new_url) - - self.download(new_url, disposition=True) + self.logInfo(_("Unable to get API data, waiting 1 minute and retry")) + self.retry(5, 60, _("Unable to get API data")) + + self.checkErrors() + + try: + self.pyfile.name = re.search(r'<name>([^<]+)</name>', self.html).group(1) + + except AttributeError: + self.pyfile.name = "" + + try: + self.pyfile.size = re.search(r'<size>(\d+)</size>', self.html).group(1) + + except AttributeError: + self.pyfile.size = 0 + + try: + self.link = re.search(r'<download>([^<]+)</download>', self.html).group(1) + + except AttributeError: + self.link = 'http://www.simply-premium.com/premium.php?link=' + self.pyfile.url + + +getInfo = create_getInfo(SimplyPremiumCom) diff --git a/module/plugins/hoster/SimplydebridCom.py b/module/plugins/hoster/SimplydebridCom.py index f93e2bc12..24811d6aa 100644 --- a/module/plugins/hoster/SimplydebridCom.py +++ b/module/plugins/hoster/SimplydebridCom.py @@ -2,63 +2,47 @@ import re -from pyload.plugin.Hoster import Hoster +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo, replace_patterns -class SimplydebridCom(Hoster): +class SimplydebridCom(MultiHoster): __name__ = "SimplydebridCom" __type__ = "hoster" - __version__ = "0.10" + __version__ = "0.15" - __pattern__ = r'http://(?:www\.)?\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/sd\.php/*' + __pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/sd\.php' - __description__ = """Simply-debrid.com hoster plugin""" + __description__ = """Simply-debrid.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] - def setup(self): - self.resumeDownload = True - self.multiDL = True - self.chunkLimit = 1 - - - def process(self, pyfile): - if not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "simply-debrid.com") - self.fail(_("No simply-debrid.com account provided")) + def handlePremium(self, pyfile): + #fix the links for simply-debrid.com! + self.link = replace_patterns(pyfile.url, [("clz.to", "cloudzer.net/file") + ("http://share-online", "http://www.share-online") + ("ul.to", "uploaded.net/file") + ("uploaded.com", "uploaded.net") + ("filerio.com", "filerio.in") + ("lumfile.com", "lumfile.se")] - self.logDebug("Old URL: %s" % pyfile.url) + if 'fileparadox' in self.link: + self.link = self.link.replace("http://", "https://") - #fix the links for simply-debrid.com! - new_url = pyfile.url - new_url = new_url.replace("clz.to", "cloudzer.net/file") - new_url = new_url.replace("http://share-online", "http://www.share-online") - new_url = new_url.replace("ul.to", "uploaded.net/file") - new_url = new_url.replace("uploaded.com", "uploaded.net") - new_url = new_url.replace("filerio.com", "filerio.in") - new_url = new_url.replace("lumfile.com", "lumfile.se") - if('fileparadox' in new_url): - new_url = new_url.replace("http://", "https://") + self.html = self.load("http://simply-debrid.com/api.php", get={'dl': self.link}) + if 'tiger Link' in self.html or 'Invalid Link' in self.html or ('API' in self.html and 'ERROR' in self.html): + self.error(_("Unable to unrestrict link")) - if re.match(self.__pattern__, new_url): - new_url = new_url + self.link = self.html - self.logDebug("New URL: %s" % new_url) + self.wait(5) - if not re.match(self.__pattern__, new_url): - page = self.load("http://simply-debrid.com/api.php", get={'dl': new_url}) # +'&u='+self.user+'&p='+self.account.getAccountData(self.user)['password']) - if 'tiger Link' in page or 'Invalid Link' in page or ('API' in page and 'ERROR' in page): - self.fail(_("Unable to unrestrict link")) - new_url = page - self.setWait(5) - self.wait() - self.logDebug("Unrestricted URL: " + new_url) + def checkFile(self): + if self.checkDownload({"error": "No address associated with hostname"}): + self.retry(24, 3 * 60, _("Bad file downloaded")) - self.download(new_url, disposition=True) + return super(SimplydebridCom, self).checkFile() - check = self.checkDownload({"bad1": "No address associated with hostname", "bad2": "<html"}) - if check == "bad1" or check == "bad2": - self.retry(24, 3 * 60, "Bad file downloaded") +getInfo = create_getInfo(SimplydebridCom) diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py new file mode 100644 index 000000000..bd653ff59 --- /dev/null +++ b/module/plugins/hoster/SmoozedCom.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster + + +class SmoozedCom(MultiHoster): + __name__ = "SmoozedCom" + __type__ = "hoster" + __version__ = "0.03" + + __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady + + __description__ = """Smoozed.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("", "")] + + + def handlePremium(self, pyfile): + # In some cases hostsers do not supply us with a filename at download, so we + # are going to set a fall back filename (e.g. for freakshare or xfileshare) + pyfile.name = pyfile.name.split('/').pop() # Remove everthing before last slash + + # Correction for automatic assigned filename: Removing html at end if needed + suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"] + temp = pyfile.name.split('.') + + if temp.pop() in suffix_to_remove: + pyfile.name = ".".join(temp) + + # Check the link + get_data = {'session_key': self.account.getAccountInfo(self.user)['session'], + 'url' : pyfile.url} + + data = json_loads(self.load("http://www2.smoozed.com/api/check", get=get_data)) + + if data["state"] != "ok": + self.fail(data["message"]) + + if data["data"].get("state", "ok") != "ok": + if data["data"] == "Offline": + self.offline() + else: + self.fail(data["data"]["message"]) + + pyfile.name = data["data"]["name"] + pyfile.size = int(data["data"]["size"]) + + # Start the download + header = self.load("http://www2.smoozed.com/api/download", get=get_data, just_header=True) + + if not "location" in header: + self.fail(_("Unable to initialize download")) + else: + self.link = header["location"][-1] if isinstance(header["location"], list) else header["location"] + + + def checkFile(self): + if self.checkDownload({'error': '{"state":"error"}', + 'retry': '{"state":"retry"}'}): + self.fail(_("Error response received")) + + return super(SmoozedCom, self).checkFile() diff --git a/module/plugins/hoster/SoundcloudCom.py b/module/plugins/hoster/SoundcloudCom.py index cfb07b35d..fd5d1ea6c 100644 --- a/module/plugins/hoster/SoundcloudCom.py +++ b/module/plugins/hoster/SoundcloudCom.py @@ -11,7 +11,7 @@ class SoundcloudCom(Hoster): __type__ = "hoster" __version__ = "0.10" - __pattern__ = r'https?://(?:www\.)?soundcloud\.com/(?P<UID>.*?)/(?P<SID>.*)' + __pattern__ = r'https?://(?:www\.)?soundcloud\.com/(?P<UID>.+?)/(?P<SID>.+)' __description__ = """SoundCloud.com hoster plugin""" __license__ = "GPLv3" @@ -21,36 +21,36 @@ class SoundcloudCom(Hoster): def process(self, pyfile): # default UserAgent of HTTPRequest fails for this hoster so we use this one self.req.http.c.setopt(pycurl.USERAGENT, 'Mozilla/5.0') - page = self.load(pyfile.url) - m = re.search(r'<div class="haudio.*?large.*?" data-sc-track="(?P<ID>\d*)"', page) + self.html = self.load(pyfile.url) + m = re.search(r'<div class="haudio.*?large.*?" data-sc-track="(?P<ID>\d*)"', self.html) songId = clientId = "" if m: - songId = m.group("ID") + songId = m.group('ID') if len(songId) <= 0: self.logError(_("Could not find song id")) self.offline() else: - m = re.search(r'"clientID":"(?P<CID>.*?)"', page) + m = re.search(r'"clientID":"(?P<CID>.*?)"', self.html) if m: - clientId = m.group("CID") + clientId = m.group('CID') if len(clientId) <= 0: clientId = "b45b1aa10f1ac2941910a7f0d10f8e28" - m = re.search(r'<em itemprop="name">\s(?P<TITLE>.*?)\s</em>', page) + m = re.search(r'<em itemprop="name">\s(?P<TITLE>.*?)\s</em>', self.html) if m: - pyfile.name = m.group("TITLE") + ".mp3" + pyfile.name = m.group('TITLE') + ".mp3" else: - pyfile.name = re.match(self.__pattern__, pyfile.url).group("SID") + ".mp3" + pyfile.name = re.match(self.__pattern__, pyfile.url).group('SID') + ".mp3" # url to retrieve the actual song url - page = self.load("https://api.sndcdn.com/i1/tracks/%s/streams" % songId, get={"client_id": clientId}) + self.html = self.load("https://api.sndcdn.com/i1/tracks/%s/streams" % songId, get={"client_id": clientId}) # getting streams # for now we choose the first stream found in all cases # it could be improved if relevant for this hoster streams = [ - (result.group("QUALITY"), result.group("URL")) - for result in re.finditer(r'"(?P<QUALITY>.*?)":"(?P<URL>.*?)"', page) + (result.group('QUALITY'), result.group('URL')) + for result in re.finditer(r'"(?P<QUALITY>.*?)":"(?P<URL>.*?)"', self.html) ] self.logDebug("Found Streams", streams) self.logDebug("Downloading", streams[0][0], streams[0][1]) diff --git a/module/plugins/hoster/SpeedfileCz.py b/module/plugins/hoster/SpeedfileCz.py index f17aa6a59..3f17bbbe6 100644 --- a/module/plugins/hoster/SpeedfileCz.py +++ b/module/plugins/hoster/SpeedfileCz.py @@ -8,7 +8,7 @@ class SpeedfileCz(DeadHoster): __type__ = "hoster" __version__ = "0.32" - __pattern__ = r'http://(?:www\.)?speedfile\.cz/.*' + __pattern__ = r'http://(?:www\.)?speedfile\.cz/.+' __description__ = """Speedfile.cz hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/SpeedyshareCom.py b/module/plugins/hoster/SpeedyshareCom.py index 41c23f438..078cbf6c8 100644 --- a/module/plugins/hoster/SpeedyshareCom.py +++ b/module/plugins/hoster/SpeedyshareCom.py @@ -13,7 +13,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class SpeedyshareCom(SimpleHoster): __name__ = "SpeedyshareCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?(speedyshare\.com|speedy\.sh)/\w+' @@ -27,7 +27,7 @@ class SpeedyshareCom(SimpleHoster): OFFLINE_PATTERN = r'class=downloadfilenamenotfound>.*</span>' - LINK_PATTERN = r'<a href=\'(.*)\'><img src=/gf/slowdownload\.png alt=\'Slow Download\' border=0' + LINK_FREE_PATTERN = r'<a href=\'(.*)\'><img src=/gf/slowdownload\.png alt=\'Slow Download\' border=0' def setup(self): @@ -35,17 +35,10 @@ class SpeedyshareCom(SimpleHoster): self.chunkLimit = 1 - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) + def handleFree(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("Download link not found")) - - dl_link = urljoin("http://www.speedyshare.com", m.group(1)) - self.download(dl_link, disposition=True) - - check = self.checkDownload({'html': re.compile("html")}) - if check == "html": - self.error(_("Downloaded file is an html page")) + self.link = m.group(1) getInfo = create_getInfo(SpeedyshareCom) diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index e5e389e20..95e69abf4 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -25,7 +25,7 @@ class StreamCz(Hoster): __type__ = "hoster" __version__ = "0.20" - __pattern__ = r'https?://(?:www\.)?stream\.cz/[^/]+/\d+.*' + __pattern__ = r'https?://(?:www\.)?stream\.cz/[^/]+/\d+' __description__ = """Stream.cz hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/StreamcloudEu.py b/module/plugins/hoster/StreamcloudEu.py index 62e2504c4..c47c2c6a1 100644 --- a/module/plugins/hoster/StreamcloudEu.py +++ b/module/plugins/hoster/StreamcloudEu.py @@ -8,7 +8,7 @@ from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class StreamcloudEu(XFSHoster): __name__ = "StreamcloudEu" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __pattern__ = r'http://(?:www\.)?streamcloud\.eu/\w{12}' @@ -17,14 +17,14 @@ class StreamcloudEu(XFSHoster): __authors__ = [("seoester", "seoester@googlemail.com")] - HOSTER_DOMAIN = "streamcloud.eu" + WAIT_PATTERN = r'var count = (\d+)' LINK_PATTERN = r'file: "(http://(stor|cdn)\d+\.streamcloud\.eu:?\d*/.*/video\.(mp4|flv))",' def setup(self): - self.multiDL = True - self.chunkLimit = 1 + self.multiDL = True + self.chunkLimit = 1 self.resumeDownload = self.premium diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index 1aaa555a9..811136405 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -17,7 +17,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo, ti class TurbobitNet(SimpleHoster): __name__ = "TurbobitNet" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.19" __pattern__ = r'http://(?:www\.)?turbobit\.net/(?:download/free/)?(?P<ID>\w+)' @@ -35,26 +35,29 @@ class TurbobitNet(SimpleHoster): SIZE_PATTERN = r'class="file-size">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'<h2>File Not Found</h2>|html\(\'File (?:was )?not found' - LINK_PATTERN = r'(?P<url>/download/redirect/[^"\']+)' - LIMIT_WAIT_PATTERN = r'<div id=\'timeout\'>(\d+)<' + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'(/download/redirect/[^"\']+)' - CAPTCHA_PATTERN = r'<img alt="Captcha" src="(.+?)"' + LIMIT_WAIT_PATTERN = r'<div id=\'timeout\'>(\d+)<' + CAPTCHA_PATTERN = r'<img alt="Captcha" src="(.+?)"' - def handleFree(self): - self.url = "http://turbobit.net/download/free/%s" % self.info['pattern']['ID'] - self.html = self.load(self.url, ref=True, decode=True) + def handleFree(self, pyfile): + self.html = self.load("http://turbobit.net/download/free/%s" % self.info['pattern']['ID'], + decode=True) rtUpdate = self.getRtUpdate() self.solveCaptcha() + self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) - self.url = self.getDownloadUrl(rtUpdate) - self.wait() - self.html = self.load(self.url) + self.html = self.load(self.getDownloadUrl(rtUpdate)) + self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"]) - self.downloadFile() + + m = re.search(self.LINK_FREE_PATTERN, self.html) + if m: + self.link = m.group(1) def solveCaptcha(self): @@ -72,7 +75,7 @@ class TurbobitNet(SimpleHoster): if inputs['captcha_type'] == 'recaptcha': recaptcha = ReCaptcha(self) - inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge() + inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() else: m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: @@ -137,13 +140,17 @@ class TurbobitNet(SimpleHoster): self.logDebug("URL", self.js.engine, out) if out.startswith('/download/'): return "http://turbobit.net%s" % out.strip() + except Exception, e: self.logError(e) else: if self.retries >= 2: # retry with updated js self.delStorage("rtUpdate") - self.retry() + else: + self.retry() + + self.wait() def decrypt(self, data): @@ -157,17 +164,4 @@ class TurbobitNet(SimpleHoster): return "%s GMT%+03d%02d" % (time.strftime("%a %b %d %Y %H:%M:%S", lt), -tz // 3600, tz % 3600) - def handlePremium(self): - self.logDebug("Premium download as user %s" % self.user) - self.downloadFile() - - - def downloadFile(self): - m = re.search(self.LINK_PATTERN, self.html) - if m is None: - self.error(_("Download link not found")) - self.url = "http://turbobit.net" + m.group('url') - self.download(self.url) - - getInfo = create_getInfo(TurbobitNet) diff --git a/module/plugins/hoster/TurbouploadCom.py b/module/plugins/hoster/TurbouploadCom.py index 6be6280fb..f821438dd 100644 --- a/module/plugins/hoster/TurbouploadCom.py +++ b/module/plugins/hoster/TurbouploadCom.py @@ -8,7 +8,7 @@ class TurbouploadCom(DeadHoster): __type__ = "hoster" __version__ = "0.03" - __pattern__ = r'http://(?:www\.)?turboupload\.com/(\w+).*' + __pattern__ = r'http://(?:www\.)?turboupload\.com/(\w+)' __description__ = """Turboupload.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/TusfilesNet.py b/module/plugins/hoster/TusfilesNet.py index 303d001df..9fdb6eae1 100644 --- a/module/plugins/hoster/TusfilesNet.py +++ b/module/plugins/hoster/TusfilesNet.py @@ -1,12 +1,13 @@ # -*- coding: utf-8 -*- -from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo +from module.network.HTTPRequest import BadHeader +from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class TusfilesNet(XFSHoster): __name__ = "TusfilesNet" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.09" __pattern__ = r'https?://(?:www\.)?tusfiles\.net/\w{12}' @@ -16,20 +17,24 @@ class TusfilesNet(XFSHoster): ("guidobelix", "guidobelix@hotmail.it")] - HOSTER_DOMAIN = "tusfiles.net" - - INFO_PATTERN = r'\](?P<N>.+) - (?P<S>[\d.,]+) (?P<U>[\w^_]+)\[' - OFFLINE_PATTERN = r'>File Not Found|<Title>TusFiles - Fast Sharing Files!' + INFO_PATTERN = r'\](?P<N>.+) - (?P<S>[\d.,]+) (?P<U>[\w^_]+)\[' + OFFLINE_PATTERN = r'>File Not Found|<Title>TusFiles - Fast Sharing Files!|The file you are trying to download is no longer available' def setup(self): - self.multiDL = False - self.chunkLimit = -1 + self.chunkLimit = -1 + self.multiDL = True self.resumeDownload = True - def handlePremium(self): - return self.handleFree() + def downloadLink(self, link): + try: + return super(TusfilesNet, self).downloadLink(link) + + except BadHeader, e: + if e.code is 503: + self.multiDL = False + raise Retry("503") getInfo = create_getInfo(TusfilesNet) diff --git a/module/plugins/hoster/TwoSharedCom.py b/module/plugins/hoster/TwoSharedCom.py index 637f9058c..53911762d 100644 --- a/module/plugins/hoster/TwoSharedCom.py +++ b/module/plugins/hoster/TwoSharedCom.py @@ -8,20 +8,20 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class TwoSharedCom(SimpleHoster): __name__ = "TwoSharedCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" - __pattern__ = r'http://(?:www\.)?2shared\.com/(account/)?(download|get|file|document|photo|video|audio)/.*' + __pattern__ = r'http://(?:www\.)?2shared\.com/(account/)?(download|get|file|document|photo|video|audio)/.+' __description__ = """2Shared.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<h1>(?P<N>.*)</h1>' - SIZE_PATTERN = r'<span class="dtitle">File size:</span>\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + NAME_PATTERN = r'<h1>(?P<N>.*)</h1>' + SIZE_PATTERN = r'<span class="dtitle">File size:</span>\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'The file link that you requested is not valid\.|This file was deleted\.' - LINK_PATTERN = r'window.location =\'(.+?)\';' + LINK_FREE_PATTERN = r'window.location =\'(.+?)\';' def setup(self): @@ -29,13 +29,4 @@ class TwoSharedCom(SimpleHoster): self.multiDL = True - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) - if m is None: - self.error(_("Download link")) - - link = m.group(1) - self.download(link) - - getInfo = create_getInfo(TwoSharedCom) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index d988b2ba5..104209a66 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -15,32 +15,31 @@ def convertDecimalPrefix(m): class UlozTo(SimpleHoster): __name__ = "UlozTo" __type__ = "hoster" - __version__ = "1.00" + __version__ = "1.04" - __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<id>\w+/[^/?]*)' + __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)' __description__ = """Uloz.to hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - INFO_PATTERN = r'<p>File <strong>(?P<N>[^<]+)</strong> is password protected</p>' - NAME_PATTERN = r'<title>(?P<N>[^<]+) \| Uloz\.to</title>' - SIZE_PATTERN = r'<span id="fileSize">.*?(?P<S>[\d.,]+\s[kMG]?B)</span>' + INFO_PATTERN = r'<p>File <strong>(?P<N>[^<]+)</strong> is password protected</p>' + NAME_PATTERN = r'<title>(?P<N>[^<]+) \| Uloz\.to</title>' + SIZE_PATTERN = r'<span id="fileSize">.*?(?P<S>[\d.,]+\s[kMG]?B)</span>' OFFLINE_PATTERN = r'<title>404 - Page not found</title>|<h1 class="h1">File (has been deleted|was banned)</h1>' + URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "www.ulozto.net")] SIZE_REPLACEMENTS = [('([\d.]+)\s([kMG])B', convertDecimalPrefix)] - URL_REPLACEMENTS = [(r"(?<=http://)([^/]+)", "www.ulozto.net")] - ADULT_PATTERN = r'<form action="(?P<link>[^\"]*)" method="post" id="frm-askAgeForm">' - PASSWD_PATTERN = r'<div class="passwordProtectedFile">' + ADULT_PATTERN = r'<form action="([^\"]*)" method="post" id="frm-askAgeForm">' + PASSWD_PATTERN = r'<div class="passwordProtectedFile">' VIPLINK_PATTERN = r'<a href="[^"]*\?disclaimer=1" class="linkVip">' - FREE_URL_PATTERN = r'<div class="freeDownloadForm"><form action="([^"]+)"' - PREMIUM_URL_PATTERN = r'<div class="downloadForm"><form action="([^"]+)"' - TOKEN_PATTERN = r'<input type="hidden" name="_token_" id="[^\"]*" value="(?P<token>.+?)"' + TOKEN_PATTERN = r'<input type="hidden" name="_token_" .*?value="(.+?)"' def setup(self): + self.chunkLimit = 16 if self.premium else 1 self.multiDL = self.premium self.resumeDownload = True @@ -57,33 +56,36 @@ class UlozTo(SimpleHoster): self.error(_("TOKEN_PATTERN not found")) token = m.group(1) - self.html = self.load(pyfile.url, get={"do": "askAgeForm-submit"}, + self.html = self.load(pyfile.url, get={'do': "askAgeForm-submit"}, post={"agree": "Confirm", "_token_": token}, cookies=True) - passwords = self.getPassword().splitlines() - while self.PASSWD_PATTERN in self.html: - if passwords: - password = passwords.pop(0) + if self.PASSWD_PATTERN in self.html: + password = self.getPassword() + + if password: self.logInfo(_("Password protected link, trying ") + password) - self.html = self.load(pyfile.url, get={"do": "passwordProtectedForm-submit"}, + self.html = self.load(pyfile.url, get={'do': "passwordProtectedForm-submit"}, post={"password": password, "password_send": 'Send'}, cookies=True) + + if self.PASSWD_PATTERN in self.html: + self.fail(_("Incorrect password")) else: - self.fail(_("No or incorrect password")) + self.fail(_("No password found")) if re.search(self.VIPLINK_PATTERN, self.html): - self.html = self.load(pyfile.url, get={"disclaimer": "1"}) + self.html = self.load(pyfile.url, get={'disclaimer': "1"}) self.getFileInfo() if self.premium and self.checkTrafficLeft(): - self.handlePremium() + self.handlePremium(pyfile) else: - self.handleFree() + self.handleFree(pyfile) self.doCheckDownload() - def handleFree(self): + def handleFree(self, pyfile): action, inputs = self.parseHtmlForm('id="frm-downloadDialog-freeDownloadForm"') if not action or not inputs: self.error(_("Free download form not found")) @@ -103,7 +105,7 @@ class UlozTo(SimpleHoster): # New version - better to get new parameters (like captcha reload) because of image url - since 6.12.2013 self.logDebug('Using "new" version') - xapca = self.load("http://www.ulozto.net/reloadXapca.php", get={"rnd": str(int(time.time()))}) + xapca = self.load("http://www.ulozto.net/reloadXapca.php", get={'rnd': str(int(time.time()))}) self.logDebug("xapca = " + str(xapca)) data = json_loads(xapca) @@ -118,29 +120,17 @@ class UlozTo(SimpleHoster): self.download("http://www.ulozto.net" + action, post=inputs, cookies=True, disposition=True) - def handlePremium(self): - self.download(self.pyfile.url + "?do=directDownload", disposition=True) - #parsed_url = self.findDownloadURL(premium=True) - #self.download(parsed_url, post={"download": "Download"}) - - - def findDownloadURL(self, premium=False): - msg = _("%s link" % ("Premium" if premium else "Free")) - m = re.search(self.PREMIUM_URL_PATTERN if premium else self.FREE_URL_PATTERN, self.html) - if m is None: - self.error(msg) - parsed_url = "http://www.ulozto.net" + m.group(1) - self.logDebug("%s: %s" % (msg, parsed_url)) - return parsed_url + def handlePremium(self, pyfile): + self.download(pyfile.url, get={'do': "directDownload"}, disposition=True) def doCheckDownload(self): check = self.checkDownload({ "wrong_captcha": re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'), - "offline": re.compile(self.OFFLINE_PATTERN), - "passwd": self.PASSWD_PATTERN, - "server_error": 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', # paralell dl, server overload etc. - "not_found": "<title>Ulož.to</title>" + "offline" : re.compile(self.OFFLINE_PATTERN), + "passwd" : self.PASSWD_PATTERN, + "server_error" : 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', # paralell dl, server overload etc. + "not_found" : "<title>Ulož.to</title>" }) if check == "wrong_captcha": @@ -148,15 +138,19 @@ class UlozTo(SimpleHoster): #self.delStorage("captcha_text") self.invalidCaptcha() self.retry(reason=_("Wrong captcha code")) + elif check == "offline": self.offline() + elif check == "passwd": self.fail(_("Wrong password")) + elif check == "server_error": self.logError(_("Server error, try downloading later")) self.multiDL = False self.wait(1 * 60 * 60, True) self.retry() + elif check == "not_found": self.fail(_("Server error - file not downloadable")) diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index 41bafdac6..862429af5 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -8,9 +8,9 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class UloziskoSk(SimpleHoster): __name__ = "UloziskoSk" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" - __pattern__ = r'http://(?:www\.)?ulozisko\.sk/.*' + __pattern__ = r'http://(?:www\.)?ulozisko\.sk/.+' __description__ = """Ulozisko.sk hoster plugin""" __license__ = "GPLv3" @@ -21,7 +21,7 @@ class UloziskoSk(SimpleHoster): 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>' - LINK_PATTERN = r'<form name = "formular" action = "([^"]+)" method = "post">' + LINK_FREE_PATTERN = r'<form name = "formular" action = "([^"]+)" method = "post">' ID_PATTERN = r'<input type = "hidden" name = "id" value = "([^"]+)" />' CAPTCHA_PATTERN = r'<img src="(/obrazky/obrazky\.php\?fid=[^"]+)" alt="" />' IMG_PATTERN = ur'<strong>PRE ZVÄČŠENIE KLIKNITE NA OBRÁZOK</strong><br /><a href = "([^"]+)">' @@ -36,13 +36,13 @@ class UloziskoSk(SimpleHoster): url = "http://ulozisko.sk" + m.group(1) self.download(url) else: - self.handleFree() + self.handleFree(pyfile) - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) + def handleFree(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) parsed_url = 'http://www.ulozisko.sk' + m.group(1) m = re.search(self.ID_PATTERN, self.html) @@ -61,12 +61,11 @@ class UloziskoSk(SimpleHoster): self.logDebug("CAPTCHA_URL:" + captcha_url + ' CAPTCHA:' + captcha) - self.download(parsed_url, post={ - "antispam": captcha, - "id": id, - "name": self.pyfile.name, - "but": "++++STIAHNI+S%DABOR++++" - }) + self.download(parsed_url, + post={"antispam": captcha, + "id" : id, + "name" : pyfile.name, + "but" : "++++STIAHNI+S%DABOR++++"}) getInfo = create_getInfo(UloziskoSk) diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 1ce1f5c47..dadbe2fec 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -10,7 +10,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class UnibytesCom(SimpleHoster): __name__ = "UnibytesCom" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" __pattern__ = r'https?://(?:www\.)?unibytes\.com/[\w .-]{11}B' @@ -24,13 +24,14 @@ class UnibytesCom(SimpleHoster): 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_PATTERN = r'<a href="([^"]+)">Download</a>' + LINK_FREE_PATTERN = r'<a href="([^"]+)">Download</a>' - def handleFree(self): - domain = "http://www.%s/" % self.HOSTER_DOMAIN + def handleFree(self, pyfile): + domain = "http://www.%s/" % self.HOSTER_DOMAIN action, post_data = self.parseHtmlForm('id="startForm"') + for _i in xrange(8): self.logDebug(action, post_data) self.html = self.load(urljoin(domain, action), post=post_data, follow_location=False) @@ -45,7 +46,7 @@ class UnibytesCom(SimpleHoster): self.retry() if post_data['step'] == 'last': - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m: url = m.group(1) self.correctCaptcha() @@ -58,9 +59,11 @@ class UnibytesCom(SimpleHoster): if last_step == 'timer': m = re.search(self.WAIT_PATTERN, self.html) - self.wait(int(m.group(1)) if m else 60, False) + self.wait(m.group(1) if m else 60, False) + elif last_step in ("captcha", "last"): post_data['captcha'] = self.decryptCaptcha(urljoin(domain, "/captcha.jpg")) + else: self.fail(_("No valid captcha code entered")) diff --git a/module/plugins/hoster/UnrestrictLi.py b/module/plugins/hoster/UnrestrictLi.py index 116d98e47..99fe01257 100644 --- a/module/plugins/hoster/UnrestrictLi.py +++ b/module/plugins/hoster/UnrestrictLi.py @@ -2,82 +2,73 @@ import re -from datetime import datetime, timedelta +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo +from module.plugins.internal.SimpleHoster import secondsToMidnight -from pyload.utils import json_loads -from pyload.plugin.Hoster import Hoster - -def secondsToMidnight(gmt=0): - now = datetime.utcnow() + timedelta(hours=gmt) - if now.hour is 0 and now.minute < 10: - midnight = now - else: - midnight = now + timedelta(days=1) - midnight = midnight.replace(hour=0, minute=10, second=0, microsecond=0) - return int((midnight - now).total_seconds()) - - -class UnrestrictLi(Hoster): +class UnrestrictLi(MultiHoster): __name__ = "UnrestrictLi" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.21" - __pattern__ = r'https?://(?:[^/]*\.)?(unrestrict|unr)\.li' + __pattern__ = r'https?://(?:www\.)?(unrestrict|unr)\.li/dl/[\w^_]+' - __description__ = """Unrestrict.li hoster plugin""" + __description__ = """Unrestrict.li multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] + LOGIN_ACCOUNT = False + + def setup(self): - self.chunkLimit = 16 + self.chunkLimit = 16 self.resumeDownload = True - def process(self, pyfile): - if re.match(self.__pattern__, pyfile.url): - new_url = pyfile.url - elif not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "Unrestrict.li") - self.fail(_("No Unrestrict.li account provided")) + def handleFree(self, pyfile): + for _i in xrange(5): + self.html = self.load('https://unrestrict.li/unrestrict.php', + post={'link': pyfile.url, 'domain': 'long'}) + + self.logDebug("JSON data: " + self.html) + + if self.html: + break else: - self.logDebug("Old URL: %s" % pyfile.url) - for _i in xrange(5): - page = self.load('https://unrestrict.li/unrestrict.php', - post={'link': pyfile.url, 'domain': 'long'}) - self.logDebug("JSON data: " + page) - if page != '': - break - else: - self.logInfo(_("Unable to get API data, waiting 1 minute and retry")) - self.retry(5, 60, "Unable to get API data") - - if 'Expired session' in page or ("You are not allowed to " - "download from this host" in page and self.premium): - self.account.relogin(self.user) - self.retry() - elif "File offline" in page: - self.offline() - elif "You are not allowed to download from this host" in page: - self.fail(_("You are not allowed to download from this host")) - elif "You have reached your daily limit for this host" in page: - self.logWarning(_("Reached daily limit for this host")) - self.retry(5, secondsToMidnight(gmt=2), "Daily limit for this host reached") - elif "ERROR_HOSTER_TEMPORARILY_UNAVAILABLE" in page: - self.logInfo(_("Hoster temporarily unavailable, waiting 1 minute and retry")) - self.retry(5, 60, "Hoster is temporarily unavailable") - page = json_loads(page) - new_url = page.keys()[0] - self.api_data = page[new_url] - - if new_url != pyfile.url: - self.logDebug("New URL: " + new_url) + self.logInfo(_("Unable to get API data, waiting 1 minute and retry")) + self.retry(5, 60, "Unable to get API data") + + if 'Expired session' in self.html \ + or ("You are not allowed to download from this host" in self.html and self.premium): + self.account.relogin(self.user) + self.retry() + + elif "File offline" in self.html: + self.offline() + + elif "You are not allowed to download from this host" in self.html: + self.fail(_("You are not allowed to download from this host")) + + elif "You have reached your daily limit for this host" in self.html: + self.logWarning(_("Reached daily limit for this host")) + self.retry(5, secondsToMidnight(gmt=2), "Daily limit for this host reached") + + elif "ERROR_HOSTER_TEMPORARILY_UNAVAILABLE" in self.html: + self.logInfo(_("Hoster temporarily unavailable, waiting 1 minute and retry")) + self.retry(5, 60, "Hoster is temporarily unavailable") + + self.html = json_loads(self.html) + self.link = self.html.keys()[0] + self.api_data = self.html[self.link] if hasattr(self, 'api_data'): self.setNameSize() - self.download(new_url, disposition=True) + + def checkFile(self): + super(UnrestrictLi, self).checkFile() if self.getConfig("history"): self.load("https://unrestrict.li/history/", get={'delete': "all"}) @@ -89,3 +80,6 @@ class UnrestrictLi(Hoster): self.pyfile.name = self.api_data['name'] if 'size' in self.api_data: self.pyfile.size = self.api_data['size'] + + +getInfo = create_getInfo(UnrestrictLi) diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index 3fed6c8cf..d14f2fdc5 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -10,7 +10,7 @@ from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class UpleaCom(XFSHoster): __name__ = "UpleaCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'https?://(?:www\.)?uplea\.com/dl/\w{15}' @@ -19,14 +19,13 @@ class UpleaCom(XFSHoster): __authors__ = [("Redleon", "")] - HOSTER_DOMAIN = "uplea.com" - NAME_PATTERN = r'class="agmd size18">(?P<N>.+?)<' SIZE_PATTERN = r'size14">(?P<S>[\d.,]+) (?P<U>[\w^_])</span>' OFFLINE_PATTERN = r'>You followed an invalid or expired link' LINK_PATTERN = r'"(http?://\w+\.uplea\.com/anonym/.*?)"' + WAIT_PATTERN = r'timeText:([\d.]+),' STEP_PATTERN = r'<a href="(/step/.+)">' @@ -37,24 +36,24 @@ class UpleaCom(XFSHoster): self.resumeDownload = True - def handleFree(self): + def handleFree(self, pyfile): m = re.search(self.STEP_PATTERN, self.html) if m is None: - self.error("STEP_PATTERN not found") + self.error(_("STEP_PATTERN not found")) self.html = self.load(urljoin("http://uplea.com/", m.group(1))) m = re.search(self.WAIT_PATTERN, self.html) if m: - self.wait(int(m.group(1)), True) + self.wait(m.group(1), True) self.retry() m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.error("LINK_PATTERN not found") + self.error(_("LINK_PATTERN not found")) + self.link = m.group(1) self.wait(15) - self.download(m.group(1), disposition=True) getInfo = create_getInfo(UpleaCom) diff --git a/module/plugins/hoster/UploadStationCom.py b/module/plugins/hoster/UploadStationCom.py index 9ece25cdb..daa7a9e81 100644 --- a/module/plugins/hoster/UploadStationCom.py +++ b/module/plugins/hoster/UploadStationCom.py @@ -8,7 +8,7 @@ class UploadStationCom(DeadHoster): __type__ = "hoster" __version__ = "0.52" - __pattern__ = r'http://(?:www\.)?uploadstation\.com/file/(?P<id>\w+)' + __pattern__ = r'http://(?:www\.)?uploadstation\.com/file/(?P<ID>\w+)' __description__ = """UploadStation.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index 07ab51601..bddd26f57 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -11,7 +11,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadableCh(SimpleHoster): __name__ = "UploadableCh" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.08" __pattern__ = r'http://(?:www\.)?uploadable\.ch/file/(?P<ID>\w+)' @@ -21,70 +21,59 @@ class UploadableCh(SimpleHoster): ("Walter Purcaro", "vuolter@gmail.com")] - FILE_INFO_PATTERN = r'div id=\"file_name\" title=.*>(?P<N>.+)<span class=\"filename_normal\">\((?P<S>[\d.]+) (?P<U>\w+)\)</span><' + URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://www.uploadable.ch/file/\g<ID>')] + + INFO_PATTERN = r'div id=\"file_name\" title=.*>(?P<N>.+)<span class=\"filename_normal\">\((?P<S>[\d.]+) (?P<U>\w+)\)</span><' OFFLINE_PATTERN = r'>(File not available|This file is no longer available)' TEMP_OFFLINE_PATTERN = r'<div class="icon_err">' - WAIT_PATTERN = r'data-time="(\d+)" data-format' - - FILE_URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://www.uploadable.ch/file/\g<ID>')] + WAIT_PATTERN = r'>Please wait.+?<' + RECAPTCHA_KEY = "6LdlJuwSAAAAAPJbPIoUhyqOJd7-yrah5Nhim5S3" - def setup(self): - self.multiDL = False - self.chunkLimit = 1 - - def handleFree(self): + def handleFree(self, pyfile): # Click the "free user" button and wait - a = self.load(self.pyfile.url, cookies=True, post={'downloadLink': "wait"}, decode=True) + a = self.load(pyfile.url, cookies=True, post={'downloadLink': "wait"}, decode=True) self.logDebug(a) - m = re.search(self.WAIT_PATTERN, a) - if m is not None: - self.wait(int(m.group(1))) #: Expected output: {"waitTime":30} - else: - self.error("WAIT_PATTERN") + self.wait(30) # Make the recaptcha appear and show it the pyload interface - b = self.load(self.pyfile.url, cookies=True, post={'checkDownload': "check"}, decode=True) + b = self.load(pyfile.url, cookies=True, post={'checkDownload': "check"}, decode=True) self.logDebug(b) #: Expected output: {"success":"showCaptcha"} recaptcha = ReCaptcha(self) - challenge, response = recaptcha.challenge(self.RECAPTCHA_KEY) + response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) # Submit the captcha solution self.load("http://www.uploadable.ch/checkReCaptcha.php", cookies=True, post={'recaptcha_challenge_field' : challenge, 'recaptcha_response_field' : response, - 'recaptcha_shortencode_field': self.info['ID']}, + 'recaptcha_shortencode_field': self.info['pattern']['ID']}, decode=True) self.wait(3) # Get ready for downloading - self.load(self.pyfile.url, cookies=True, post={'downloadLink': "show"}, decode=True) + self.load(pyfile.url, cookies=True, post={'downloadLink': "show"}, decode=True) self.wait(3) # Download the file - self.download(self.pyfile.url, cookies=True, post={'download': "normal"}, disposition=True) + self.download(pyfile.url, cookies=True, post={'download': "normal"}, disposition=True) def checkFile(self): - check = self.checkDownload({'wait_or_reconnect': re.compile("Please wait for"), - 'is_html' : re.compile("<head>")}) - - if check == "wait_or_reconnect": + if self.checkDownload({'wait': re.compile("Please wait for")}): self.logInfo("Downloadlimit reached, please wait or reconnect") self.wait(60 * 60, True) self.retry() - elif check == "is_html": - self.error("Downloaded file is an html file") + return super(UploadableCh, self).checkFile() getInfo = create_getInfo(UploadableCh) diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index eb52f9721..83a16c251 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -1,245 +1,120 @@ # -*- coding: utf-8 -*- -# -# Test links: -# http://ul.to/044yug9o -# http://ul.to/gzfhd0xs import re from time import sleep -from pyload.network.RequestFactory import getURL -from pyload.plugin.Hoster import Hoster -from pyload.plugin.Plugin import chunks -from pyload.plugin.internal.captcha import ReCaptcha -from pyload.utils import html_unescape, parseFileSize +from module.network.RequestFactory import getURL +from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -key = "bGhGMkllZXByd2VEZnU5Y2NXbHhYVlZ5cEE1bkEzRUw=".decode('base64') - - -def getID(url): - """ returns id from file url""" - m = re.match(UploadedTo.__pattern__, url) - return m.group('ID') - - -def getAPIData(urls): - post = {"apikey": key} - - idMap = {} - - for i, url in enumerate(urls): - id = getID(url) - post['id_%s' % i] = id - idMap[id] = url - - for _i in xrange(5): - api = unicode(getURL("http://uploaded.net/api/filemultiple", post=post, decode=False), 'iso-8859-1') - if api != "can't find request": - break - else: - sleep(3) - - result = {} - - if api: - for line in api.splitlines(): - data = line.split(",", 4) - if data[1] in idMap: - result[data[1]] = (data[0], data[2], data[4], data[3], idMap[data[1]]) - - return result - - -def parseFileInfo(self, url='', html=''): - if not html and hasattr(self, "html"): - html = self.html - - name = url - size = 0 - fileid = None - - if re.search(self.OFFLINE_PATTERN, html): - # File offline - status = 1 - else: - m = re.search(self.INFO_PATTERN, html) - if m: - name, fileid = html_unescape(m.group('N')), m.group('ID') - size = parseFileSize(m.group('S')) - status = 2 - else: - status = 3 - - return name, size, status, fileid - +class UploadedTo(SimpleHoster): + __name__ = "UploadedTo" + __type__ = "hoster" + __version__ = "0.84" -def getInfo(urls): - for chunk in chunks(urls, 80): - result = [] + __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' - api = getAPIData(chunk) + __description__ = """Uploaded.net hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - for data in api.itervalues(): - if data[0] == "online": - result.append((html_unescape(data[2]), data[1], 2, data[4])) - elif data[0] == "offline": - result.append((data[4], 0, 1, data[4])) + API_KEY = "lhF2IeeprweDfu9ccWlxXVVypA5nA3EL" - yield result + URL_REPLACEMENTS = [(__pattern__ + ".*", r'http://uploaded.net/file/\g<ID>')] + LINK_PREMIUM_PATTERN = r'<div class="tfree".*\s*<form method="post" action="(.+?)"' -class UploadedTo(Hoster): - __name__ = "UploadedTo" - __type__ = "hoster" - __version__ = "0.75" + WAIT_PATTERN = r'Current waiting period: <span>(\d+)' + DL_LIMIT_ERROR = r'You have reached the max. number of possible free downloads for this hour' - __pattern__ = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' - __description__ = """Uploaded.net hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("spoob", "spoob@pyload.org"), - ("mkaay", "mkaay@mkaay.de"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("netpok", "netpok@gmail.com"), - ("stickell", "l.stickell@yahoo.it")] + @classmethod + def apiInfo(cls, url="", get={}, post={}): + info = super(UploadedTo, cls).apiInfo(url) + for _i in xrange(5): + html = getURL("http://uploaded.net/api/filemultiple", + get={"apikey": cls.API_KEY, 'id_0': re.match(cls.__pattern__, url).group('ID')}, + decode=True) + + if html != "can't find request": + api = html.split(",", 4) + if api[0] == "online": + info.update({'name': api[4].strip(), 'size': api[2], 'status': 2}) + else: + info['status'] = 1 + break + else: + sleep(3) - INFO_PATTERN = r'<a href="file/(?P<ID>\w+)" id="filename">(?P<N>[^<]+)</a> \s*<small[^>]*>(?P<S>[^<]+)</small>' - OFFLINE_PATTERN = r'<small class="cL">Error: 404</small>' - DL_LIMIT_PATTERN = r'You have reached the max. number of possible free downloads for this hour' + return info def setup(self): self.multiDL = self.resumeDownload = self.premium self.chunkLimit = 1 # critical problems with more chunks - self.fileID = getID(self.pyfile.url) - self.pyfile.url = "http://uploaded.net/file/%s" % self.fileID - - def process(self, pyfile): - self.load("http://uploaded.net/language/en", just_header=True) + def checkErrors(self): + if 'var free_enabled = false;' in self.html: + self.logError(_("Free-download capacities exhausted")) + self.retry(24, 5 * 60) - api = getAPIData([pyfile.url]) + elif "limit-size" in self.html: + self.fail(_("File too big for free download")) - # TODO: fallback to parse from site, because api sometimes delivers wrong status codes + elif "limit-slot" in self.html: # Temporary restriction so just wait a bit + self.wait(30 * 60, True) + self.retry() - if not api: - self.logWarning(_("No response for API call")) + elif "limit-parallel" in self.html: + self.fail(_("Cannot download in parallel")) - self.html = unicode(self.load(pyfile.url, decode=False), 'iso-8859-1') - name, size, status, self.fileID = parseFileInfo(self) - self.logDebug(name, size, status, self.fileID) - if status == 1: - self.offline() - elif status == 2: - pyfile.name, pyfile.size = name, size - else: - self.error(_("file info")) + elif "limit-dl" in self.html or self.DL_LIMIT_ERROR in self.html: # limit-dl + self.wait(3 * 60 * 60, True) + self.retry() - elif api == 'Access denied': - self.fail(_("API key invalid")) + elif '"err":"captcha"' in self.html: + self.invalidCaptcha() else: - if self.fileID not in api: - self.offline() + m = re.search(self.WAIT_PATTERN, self.html) + if m: + self.wait(m.group(1)) - self.data = api[self.fileID] - if self.data[0] != "online": - self.offline() - pyfile.name = html_unescape(self.data[2]) - - # pyfile.name = self.get_file_name() + def handleFree(self, pyfile): + self.load("http://uploaded.net/language/en", just_header=True) - if self.premium: - self.handlePremium() - else: - self.handleFree() - - - def handlePremium(self): - info = self.account.getAccountInfo(self.user, True) - self.logDebug("%(name)s: Use Premium Account (%(left)sGB left)" % {"name": self.__name__, - "left": info['trafficleft'] / 1024 / 1024}) - if int(self.data[1]) / 1024 > info['trafficleft']: - self.logInfo(_("Not enough traffic left")) - self.account.empty(self.user) - self.resetAccount() - self.fail(_("Traffic exceeded")) - - header = self.load("http://uploaded.net/file/%s" % self.fileID, just_header=True) - if 'location' in header: - #Direct download - self.logDebug("Direct download link detected") - self.download(header['location']) - else: - #Indirect download - self.html = self.load("http://uploaded.net/file/%s" % self.fileID) - m = re.search(r'<div class="tfree".*\s*<form method="post" action="(.*?)"', self.html) - if m is None: - self.fail(_("Download URL not m. Try to enable direct downloads")) - url = m.group(1) - self.download(url, post={}) + self.html = self.load("http://uploaded.net/js/download.js", decode=True) + recaptcha = ReCaptcha(self) + response, challenge = recaptcha.challenge() - def handleFree(self): - self.html = self.load(self.pyfile.url, decode=True) + self.html = self.load("http://uploaded.net/io/ticket/captcha/%s" % self.info['pattern']['ID'], + post={'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) - if 'var free_enabled = false;' in self.html: - self.logError(_("Free-download capacities exhausted")) - self.retry(24, 5 * 60) + if "type:'download'" in self.html: + self.correctCaptcha() + try: + self.link = re.search("url:'([^']+)", self.html).group(1) - m = re.search(r"Current waiting period: <span>(\d+)</span> seconds", self.html) - if m is None: - self.fail(_("File not downloadable for free users")) - self.setWait(int(m.group(1))) + except Exception: + pass - self.html = self.load("http://uploaded.net/js/download.js", decode=True) + self.checkErrors() - url = "http://uploaded.net/io/ticket/captcha/%s" % self.fileID - downloadURL = "" - recaptcha = ReCaptcha(self) + def checkFile(self): + if self.checkDownload({'limit-dl': self.DL_LIMIT_ERROR}): + self.wait(3 * 60 * 60, True) + self.retry() - for _i in xrange(5): - challenge, response = recaptcha.challenge() - options = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response} - self.wait() - - result = self.load(url, post=options) - self.logDebug("Result: %s" % result) - - if "limit-size" in result: - self.fail(_("File too big for free download")) - elif "limit-slot" in result: # Temporary restriction so just wait a bit - self.setWait(30 * 60, True) - self.wait() - self.retry() - elif "limit-parallel" in result: - self.fail(_("Cannot download in parallel")) - elif "limit-dl" in result or self.DL_LIMIT_PATTERN in result: # limit-dl - self.setWait(3 * 60 * 60, True) - self.wait() - self.retry() - elif '"err":"captcha"' in result: - self.invalidCaptcha() - elif "type:'download'" in result: - self.correctCaptcha() - downloadURL = re.search("url:'([^']+)", result).group(1) - break - else: - self.error(_("Unknown error: %s") % result) + return super(UploadedTo, self).checkFile() - if not downloadURL: - self.fail(_("No Download url retrieved/all captcha attempts failed")) - self.download(downloadURL, disposition=True) - check = self.checkDownload({"limit-dl": self.DL_LIMIT_PATTERN}) - if check == "limit-dl": - self.setWait(3 * 60 * 60, True) - self.wait() - self.retry() +getInfo = create_getInfo(UploadedTo) diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py index f29832af2..a0a9cffcb 100644 --- a/module/plugins/hoster/UploadheroCom.py +++ b/module/plugins/hoster/UploadheroCom.py @@ -11,7 +11,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadheroCom(SimpleHoster): __name__ = "UploadheroCom" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" __pattern__ = r'http://(?:www\.)?uploadhero\.com?/dl/\w+' @@ -31,11 +31,12 @@ class UploadheroCom(SimpleHoster): IP_WAIT_PATTERN = r'<span id="minutes">(\d+)</span>.*\s*<span id="seconds">(\d+)</span>' CAPTCHA_PATTERN = r'"(/captchadl\.php\?\w+)"' - FREE_URL_PATTERN = r'var magicomfg = \'<a href="(http://[^<>"]*?)"|"(http://storage\d+\.uploadhero\.co/\?d=\w+/[^<>"/]+)"' - PREMIUM_URL_PATTERN = r'<a href="([^"]+)" id="downloadnow"' + LINK_FREE_PATTERN = r'var magicomfg = \'<a href="(http://[^<>"]*?)"|"(http://storage\d+\.uploadhero\.co/\?d=\w+/[^<>"/]+)"' + LINK_PREMIUM_PATTERN = r'<a href="([^"]+)" id="downloadnow"' - def handleFree(self): + + def handleFree(self, pyfile): self.checkErrors() m = re.search(self.CAPTCHA_PATTERN, self.html) @@ -45,8 +46,8 @@ class UploadheroCom(SimpleHoster): for _i in xrange(5): captcha = self.decryptCaptcha(captcha_url) - self.html = self.load(self.pyfile.url, get={"code": captcha}) - m = re.search(self.FREE_URL_PATTERN, self.html) + self.html = self.load(pyfile.url, get={"code": captcha}) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m: self.correctCaptcha() download_url = m.group(1) or m.group(2) @@ -59,12 +60,6 @@ class UploadheroCom(SimpleHoster): self.download(download_url) - def handlePremium(self): - self.logDebug("%s: Use Premium Account" % self.__name__) - link = re.search(self.PREMIUM_URL_PATTERN, self.html).group(1) - self.download(link) - - def checkErrors(self): m = re.search(self.IP_BLOCKED_PATTERN, self.html) if m: diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index 6a75a4fba..a315d3466 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -11,7 +11,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo, ti class UploadingCom(SimpleHoster): __name__ = "UploadingCom" __type__ = "hoster" - __version__ = "0.39" + __version__ = "0.40" __pattern__ = r'http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>\w+)' @@ -40,15 +40,15 @@ class UploadingCom(SimpleHoster): self.getFileInfo() if self.premium: - self.handlePremium() + self.handlePremium(pyfile) else: - self.handleFree() + self.handleFree(pyfile) - def handlePremium(self): + def handlePremium(self, pyfile): postData = {'action': 'get_link', - 'code': self.info['pattern']['ID'], - 'pass': 'undefined'} + 'code' : self.info['pattern']['ID'], + 'pass' : 'undefined'} self.html = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData) url = re.search(r'"link"\s*:\s*"(.*?)"', self.html) @@ -59,16 +59,16 @@ class UploadingCom(SimpleHoster): raise Exception("Plugin defect") - def handleFree(self): + def handleFree(self, pyfile): m = re.search('<h2>((Daily )?Download Limit)</h2>', self.html) if m: - self.pyfile.error = m.group(1) - self.logWarning(self.pyfile.error) - self.retry(6, (6 * 60 if m.group(2) else 15) * 60, self.pyfile.error) + pyfile.error = m.group(1) + self.logWarning(pyfile.error) + self.retry(6, (6 * 60 if m.group(2) else 15) * 60, pyfile.error) ajax_url = "http://uploading.com/files/get/?ajax" self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) - self.req.http.lastURL = self.pyfile.url + self.req.http.lastURL = pyfile.url res = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.info['pattern']['ID']})) @@ -95,10 +95,5 @@ class UploadingCom(SimpleHoster): self.download(url) - check = self.checkDownload({"html": re.compile("\A<!DOCTYPE html PUBLIC")}) - if check == "html": - self.logWarning(_("Redirected to a HTML page, wait 10 minutes and retry")) - self.wait(10 * 60, True) - getInfo = create_getInfo(UploadingCom) diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py index 9ed08d226..b1ceb7df1 100644 --- a/module/plugins/hoster/UpstoreNet.py +++ b/module/plugins/hoster/UpstoreNet.py @@ -9,7 +9,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class UpstoreNet(SimpleHoster): __name__ = "UpstoreNet" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?upstore\.net/' @@ -23,10 +23,10 @@ class UpstoreNet(SimpleHoster): WAIT_PATTERN = r'var sec = (\d+)' CHASH_PATTERN = r'<input type="hidden" name="hash" value="([^"]*)">' - LINK_PATTERN = r'<a href="(https?://.*?)" target="_blank"><b>' + LINK_FREE_PATTERN = r'<a href="(https?://.*?)" target="_blank"><b>' - def handleFree(self): + def handleFree(self, pyfile): # STAGE 1: get link to continue m = re.search(self.CHASH_PATTERN, self.html) if m is None: @@ -35,7 +35,7 @@ class UpstoreNet(SimpleHoster): self.logDebug("Read hash " + chash) # continue to stage2 post_data = {'hash': chash, 'free': 'Slow download'} - self.html = self.load(self.pyfile.url, post=post_data, decode=True) + self.html = self.load(pyfile.url, post=post_data, decode=True) # STAGE 2: solv captcha and wait # first get the infos we need: recaptcha key and wait time @@ -52,22 +52,21 @@ class UpstoreNet(SimpleHoster): self.wait(wait_time) # then, handle the captcha - challenge, response = recaptcha.challenge() + response, challenge = recaptcha.challenge() post_data.update({'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) - self.html = self.load(self.pyfile.url, post=post_data, decode=True) + self.html = self.load(pyfile.url, post=post_data, decode=True) # STAGE 3: get direct link - m = re.search(self.LINK_PATTERN, self.html, re.S) + m = re.search(self.LINK_FREE_PATTERN, self.html, re.S) if m: break if m is None: self.error(_("Download link not found")) - direct = m.group(1) - self.download(direct, disposition=True) + self.link = m.group(1) getInfo = create_getInfo(UpstoreNet) diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py index a7cc49f2a..3d3505f90 100644 --- a/module/plugins/hoster/UptoboxCom.py +++ b/module/plugins/hoster/UptoboxCom.py @@ -6,18 +6,16 @@ from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class UptoboxCom(XFSHoster): __name__ = "UptoboxCom" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" - __pattern__ = r'https?://(?:www\.)?uptobox\.com/\w{12}' + __pattern__ = r'https?://(?:www\.)?(uptobox|uptostream)\.com/\w{12}' __description__ = """Uptobox.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - HOSTER_DOMAIN = "uptobox.com" - - INFO_PATTERN = r'"para_title">(?P<N>.+) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)' + INFO_PATTERN = r'"para_title">(?P<N>.+) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)' OFFLINE_PATTERN = r'>(File not found|Access Denied|404 Not Found)' LINK_PATTERN = r'"(https?://\w+\.uptobox\.com/d/.*?)"' diff --git a/module/plugins/hoster/VeohCom.py b/module/plugins/hoster/VeohCom.py index 0f4f055bf..cb3e896d6 100644 --- a/module/plugins/hoster/VeohCom.py +++ b/module/plugins/hoster/VeohCom.py @@ -8,7 +8,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class VeohCom(SimpleHoster): __name__ = "VeohCom" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" __pattern__ = r'http://(?:www\.)?veoh\.com/(tv/)?(watch|videos)/(?P<ID>v\w+)' __config__ = [("quality", "Low;High;Auto", "Quality", "Auto")] @@ -32,15 +32,16 @@ class VeohCom(SimpleHoster): self.chunkLimit = -1 - def handleFree(self): + def handleFree(self, pyfile): quality = self.getConfig("quality") if quality == "Auto": quality = ("High", "Low") + for q in quality: pattern = r'"fullPreviewHash%sPath":"(.+?)"' % q m = re.search(pattern, self.html) if m: - self.pyfile.name += ".mp4" + pyfile.name += ".mp4" link = m.group(1).replace("\\", "") self.download(link) return diff --git a/module/plugins/hoster/VidPlayNet.py b/module/plugins/hoster/VidPlayNet.py index 657213c3a..5f979e856 100644 --- a/module/plugins/hoster/VidPlayNet.py +++ b/module/plugins/hoster/VidPlayNet.py @@ -18,8 +18,6 @@ class VidPlayNet(XFSHoster): __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] - HOSTER_DOMAIN = "vidplay.net" - NAME_PATTERN = r'<b>Password:</b></div>\s*<h[1-6]>(?P<N>[^<]+)</h[1-6]>' diff --git a/module/plugins/hoster/VimeoCom.py b/module/plugins/hoster/VimeoCom.py index 07abf31e3..7ca6c962b 100644 --- a/module/plugins/hoster/VimeoCom.py +++ b/module/plugins/hoster/VimeoCom.py @@ -8,7 +8,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class VimeoCom(SimpleHoster): __name__ = "VimeoCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'https?://(?:www\.)?(player\.)?vimeo\.com/(video/)?(?P<ID>\d+)' __config__ = [("quality", "Lowest;Mobile;SD;HD;Highest", "Quality", "Highest"), @@ -34,15 +34,14 @@ class VimeoCom(SimpleHoster): self.chunkLimit = -1 - def handleFree(self): + def handleFree(self, pyfile): password = self.getPassword() if self.js and 'class="btn iconify_down_b"' in self.html: - html = self.js.eval(self.load(self.pyfile.url, get={'action': "download", 'password': password}, decode=True)) + html = self.js.eval(self.load(pyfile.url, get={'action': "download", 'password': password}, decode=True)) pattern = r'href="(?P<URL>http://vimeo\.com.+?)".*?\>(?P<QL>.+?) ' else: - id = re.match(self.__pattern__, self.pyfile.url).group("ID") - html = self.load("https://player.vimeo.com/video/" + id, get={'password': password}) + html = self.load("https://player.vimeo.com/video/" + self.info['pattern']['ID'], get={'password': password}) pattern = r'"(?P<QL>\w+)":{"profile".*?"(?P<URL>http://pdl\.vimeocdn\.com.+?)"' link = dict((l.group('QL').lower(), l.group('URL')) for l in re.finditer(pattern, html)) diff --git a/module/plugins/hoster/Vipleech4UCom.py b/module/plugins/hoster/Vipleech4UCom.py index b56096d46..dec67e7a4 100644 --- a/module/plugins/hoster/Vipleech4UCom.py +++ b/module/plugins/hoster/Vipleech4UCom.py @@ -3,8 +3,8 @@ from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo -class Vipleech4uCom(DeadHoster): - __name__ = "Vipleech4uCom" +class Vipleech4UCom(DeadHoster): + __name__ = "Vipleech4UCom" __type__ = "hoster" __version__ = "0.20" @@ -15,4 +15,4 @@ class Vipleech4uCom(DeadHoster): __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] -getInfo = create_getInfo(Vipleech4uCom) +getInfo = create_getInfo(Vipleech4UCom) diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py index 946200b58..98187d46a 100644 --- a/module/plugins/hoster/WebshareCz.py +++ b/module/plugins/hoster/WebshareCz.py @@ -2,39 +2,50 @@ import re -from pyload.network.RequestFactory import getURL -from pyload.plugin.internal.SimpleHoster import SimpleHoster - - -def getInfo(urls): - for url in urls: - fid = re.search(WebshareCz.__pattern__, url).group('ID') - api_data = getURL("https://webshare.cz/api/file_info/", post={'ident': fid}) - - if 'File not found' in api_data: - file_info = (url, 0, 1, url) - else: - name = re.search('<name>(.+)</name>', api_data).group(1) - size = re.search('<size>(.+)</size>', api_data).group(1) - file_info = (name, size, 2, url) - - yield file_info +from module.network.RequestFactory import getURL +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class WebshareCz(SimpleHoster): __name__ = "WebshareCz" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.16" __pattern__ = r'https?://(?:www\.)?webshare\.cz/(?:#/)?file/(?P<ID>\w+)' __description__ = """WebShare.cz hoster plugin""" __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] + __authors__ = [("stickell", "l.stickell@yahoo.it"), + ("rush", "radek.senfeld@gmail.com")] + + + @classmethod + def getInfo(cls, url="", html=""): + info = super(WebshareCz, cls).getInfo(url, html) + + if url: + info['pattern'] = re.match(cls.__pattern__, url).groupdict() + api_data = getURL("https://webshare.cz/api/file_info/", + post={'ident': info['pattern']['ID']}, + decode=True) - def handleFree(self): - api_data = self.load('https://webshare.cz/api/file_link/', post={'ident': self.fid}) + if 'File not found' in api_data: + info['status'] = 1 + else: + info["status"] = 2 + info['name'] = re.search('<name>(.+)</name>', api_data).group(1) or info['name'] + info['size'] = re.search('<size>(.+)</size>', api_data).group(1) or info['size'] + + return info + + + def handleFree(self, pyfile): + wst = self.account.infos['wst'] if self.account and 'wst' in self.account.infos else "" + + api_data = getURL('https://webshare.cz/api/file_link/', + post={'ident': self.info['pattern']['ID'], 'wst': wst}, + decode=True) self.logDebug("API data: " + api_data) @@ -42,21 +53,11 @@ class WebshareCz(SimpleHoster): if m is None: self.error(_("Unable to detect direct link")) - self.download(m.group(1), disposition=True) - - - def getFileInfo(self): - self.logDebug("URL: %s" % self.pyfile.url) + self.link = m.group(1) - self.fid = re.match(self.__pattern__, self.pyfile.url).group('ID') - self.load(self.pyfile.url) - api_data = self.load('https://webshare.cz/api/file_info/', post={'ident': self.fid}) + def handlePremium(self, pyfile): + return self.handleFree(pyfile) - if 'File not found' in api_data: - self.offline() - else: - self.pyfile.name = re.search('<name>(.+)</name>', api_data).group(1) - self.pyfile.size = re.search('<size>(.+)</size>', api_data).group(1) - self.logDebug("FILE NAME: %s FILE SIZE: %s" % (self.pyfile.name, self.pyfile.size)) +getInfo = create_getInfo(WebshareCz) diff --git a/module/plugins/hoster/WrzucTo.py b/module/plugins/hoster/WrzucTo.py index 76ed73be6..631f9d3c6 100644 --- a/module/plugins/hoster/WrzucTo.py +++ b/module/plugins/hoster/WrzucTo.py @@ -10,7 +10,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class WrzucTo(SimpleHoster): __name__ = "WrzucTo" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?wrzuc\.to/(\w+(\.wt|\.html)|(\w+/?linki/\w+))' @@ -29,16 +29,16 @@ class WrzucTo(SimpleHoster): self.multiDL = True - def handleFree(self): + def handleFree(self, pyfile): data = dict(re.findall(r'(md5|file): "(.*?)"', self.html)) if len(data) != 2: self.error(_("No file ID")) self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) - self.req.http.lastURL = self.pyfile.url + self.req.http.lastURL = pyfile.url self.load("http://www.wrzuc.to/ajax/server/prepair", post={"md5": data['md5']}) - self.req.http.lastURL = self.pyfile.url + self.req.http.lastURL = pyfile.url self.html = self.load("http://www.wrzuc.to/ajax/server/download_link", post={"file": data['file']}) data.update(re.findall(r'"(download_link|server_id)":"(.*?)"', self.html)) diff --git a/module/plugins/hoster/WuploadCom.py b/module/plugins/hoster/WuploadCom.py index 8ad846ad8..a73ac92e0 100644 --- a/module/plugins/hoster/WuploadCom.py +++ b/module/plugins/hoster/WuploadCom.py @@ -8,7 +8,7 @@ class WuploadCom(DeadHoster): __type__ = "hoster" __version__ = "0.23" - __pattern__ = r'http://(?:www\.)?wupload\..*?/file/((\w+/)?\d+)(/.*)?' + __pattern__ = r'http://(?:www\.)?wupload\..+?/file/((\w+/)?\d+)(/.*)?' __description__ = """Wupload.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 54631baba..23af6e7fc 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -8,7 +8,7 @@ from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class XFileSharingPro(XFSHoster): __name__ = "XFileSharingPro" __type__ = "hoster" - __version__ = "0.43" + __version__ = "0.44" __pattern__ = r'^unmatchable$' @@ -21,7 +21,7 @@ class XFileSharingPro(XFSHoster): def _log(self, type, args): - msg = " | ".join([str(a).strip() for a in args if a]) + msg = " | ".join(str(a).strip() for a in args if a) logger = getattr(self.log, type) logger("%s: %s: %s" % (self.__name__, self.HOSTER_NAME, msg or _("%s MARK" % type.upper()))) @@ -31,27 +31,32 @@ class XFileSharingPro(XFSHoster): self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern'] - self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group(1).lower() - self.HOSTER_NAME = "".join([str.capitalize() for str in self.HOSTER_DOMAIN.split('.')]) + self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() + self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.') + + if self.HOSTER_NAME[0].isdigit(): + self.HOSTER_NAME = 'X' + self.HOSTER_NAME account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME) if account and account.canUse(): self.account = account + elif self.account: self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN + else: return self.user, data = self.account.selectAccount() - self.req = self.account.getAccountRequest(self.user) - self.premium = self.account.isPremium(self.user) + self.req = self.account.getAccountRequest(self.user) + self.premium = self.account.isPremium(self.user) def setup(self): - self.chunkLimit = 1 + self.chunkLimit = 1 self.resumeDownload = self.premium - self.multiDL = True + self.multiDL = True getInfo = create_getInfo(XFileSharingPro) diff --git a/module/plugins/hoster/XVideosCom.py b/module/plugins/hoster/XVideosCom.py index abc5c0f13..c5e2921cb 100644 --- a/module/plugins/hoster/XVideosCom.py +++ b/module/plugins/hoster/XVideosCom.py @@ -12,7 +12,7 @@ class XVideosCom(Hoster): __type__ = "hoster" __version__ = "0.10" - __pattern__ = r'http://(?:www\.)?xvideos\.com/video(\d+)/.*' + __pattern__ = r'http://(?:www\.)?xvideos\.com/video(\d+)' __description__ = """XVideos.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/XdadevelopersCom.py b/module/plugins/hoster/XdadevelopersCom.py new file mode 100644 index 000000000..7d50d4f57 --- /dev/null +++ b/module/plugins/hoster/XdadevelopersCom.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -* +# +# Test links: +# http://forum.xda-developers.com/devdb/project/dl/?id=10885 + +import re + +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + + +class XdadevelopersCom(SimpleHoster): + __name__ = "XdadevelopersCom" + __type__ = "hoster" + __version__ = "0.03" + + __pattern__ = r'https?://(?:www\.)?forum\.xda-developers\.com/devdb/project/dl/\?id=\d+' + + __description__ = """Xda-developers.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] + + + NAME_PATTERN = r'<label>Filename:</label>\s*<div>\s*(?P<N>.*?)\n' + SIZE_PATTERN = r'<label>Size:</label>\s*<div>\s*(?P<S>[\d.,]+)(?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'</i> Device Filter</h3>' + + + def setup(self): + self.multiDL = True + self.resumeDownload = True + self.chunkLimit = 1 + + + def handleFree(self, pyfile): + self.link = pyfile.url + "&task=get" #@TODO: Revert to `get={'task': "get"}` in 0.4.10 + + +getInfo = create_getInfo(XdadevelopersCom) diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index 91309b286..277b7ad0c 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -4,11 +4,11 @@ import re import socket import struct import sys -import time from os import makedirs from os.path import exists, join from select import select +from time import time from pyload.plugin.Hoster import Hoster from pyload.utils import safe_join @@ -84,15 +84,18 @@ class Xdcc(Hoster): ####################### # CONNECT TO IRC AND IDLE FOR REAL LINK - dl_time = time.time() + dl_time = time() sock = socket.socket() sock.connect((host, int(port))) if nick == "pyload": - nick = "pyload-%d" % (time.time() % 1000) # last 3 digits + nick = "pyload-%d" % (time() % 1000) # last 3 digits sock.send("NICK %s\r\n" % nick) sock.send("USER %s %s bla :%s\r\n" % (ident, host, real)) - time.sleep(3) + + self.setWait(3) + self.wait() + sock.send("JOIN #%s\r\n" % chan) sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack)) @@ -108,13 +111,13 @@ class Xdcc(Hoster): break if retry: - if time.time() > retry: + if time() > retry: retry = None - dl_time = time.time() + dl_time = time() sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack)) else: - if (dl_time + self.timeout) < time.time(): # todo: add in config + if (dl_time + self.timeout) < time(): # todo: add in config sock.send("QUIT :byebye\r\n") sock.close() self.fail(_("XDCC Bot did not answer")) @@ -156,7 +159,7 @@ class Xdcc(Hoster): sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface")) elif msg['text'] == "\x01TIME\x01": self.logDebug("Sending CTCP TIME") - sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time())) + sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time())) elif msg['text'] == "\x01LAG\x01": pass # don't know how to answer @@ -169,7 +172,7 @@ class Xdcc(Hoster): print "%s: %s" % (msg['origin'], msg['text']) if "You already requested that pack" in msg['text']: - retry = time.time() + 300 + retry = time() + 300 if "you must be on a known channel to request a pack" in msg['text']: self.fail(_("Wrong channel")) diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index f7640390f..6da5cff33 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -9,7 +9,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class YibaishiwuCom(SimpleHoster): __name__ = "YibaishiwuCom" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" __pattern__ = r'http://(?:www\.)?(?:u\.)?115\.com/file/(?P<ID>\w+)' @@ -22,21 +22,25 @@ class YibaishiwuCom(SimpleHoster): SIZE_PATTERN = r'file_size: \'(?P<S>.+?)\'' OFFLINE_PATTERN = ur'<h3><i style="color:red;">哎呀!提取码不存在!不妨搜搜看吧!</i></h3>' - LINK_PATTERN = r'(/\?ct=(pickcode|download)[^"\']+)' + LINK_FREE_PATTERN = r'(/\?ct=(pickcode|download)[^"\']+)' - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) + def handleFree(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) + url = m.group(1) + self.logDebug(('FREEUSER' if m.group(2) == 'download' else 'GUEST') + ' URL', url) res = json_loads(self.load("http://115.com" + url, decode=False)) if "urls" in res: mirrors = res['urls'] + elif "data" in res: mirrors = res['data'] + else: mirrors = None diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py index 5f84d6bef..a600d822f 100644 --- a/module/plugins/hoster/YourfilesTo.py +++ b/module/plugins/hoster/YourfilesTo.py @@ -10,9 +10,9 @@ from pyload.plugin.Hoster import Hoster class YourfilesTo(Hoster): __name__ = "YourfilesTo" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" - __pattern__ = r'(http://)?(?:www\.)?yourfiles\.(to|biz)/\?d=\w+' + __pattern__ = r'http://(?:www\.)?yourfiles\.(to|biz)/\?d=\w+' __description__ = """Youfiles.to hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index c7e7a6c85..bf8785022 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -13,40 +13,36 @@ from pyload.utils import html_unescape def which(program): """Works exactly like the unix command which - Courtesy of http://stackoverflow.com/a/377028/675646""" - def is_exe(fpath): - return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + isExe = lambda x: os.path.isfile(x) and os.access(x, os.X_OK) fpath, fname = os.path.split(program) if fpath: - if is_exe(program): + if isExe(program): return program else: for path in os.environ['PATH'].split(os.pathsep): path = path.strip('"') exe_file = os.path.join(path, program) - if is_exe(exe_file): + if isExe(exe_file): return exe_file - return None - class YoutubeCom(Hoster): __name__ = "YoutubeCom" __type__ = "hoster" - __version__ = "0.40" + __version__ = "0.41" - __pattern__ = r'https?://(?:[^/]*\.)?(?:youtube\.com|youtu\.be)/watch.*?[?&]v=.*' - __config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting", "hd"), - ("fmt", "int", "FMT/ITAG Number (5-102, 0 for auto)", 0), - (".mp4", "bool", "Allow .mp4", True), - (".flv", "bool", "Allow .flv", True), - (".webm", "bool", "Allow .webm", False), - (".3gp", "bool", "Allow .3gp", False), - ("3d", "bool", "Prefer 3D", False)] + __pattern__ = r'https?://(?:[^/]*\.)?(youtube\.com|youtu\.be)/watch\?(?:.*&)?v=.+' + __config__ = [("quality", "sd;hd;fullhd;240p;360p;480p;720p;1080p;3072p", "Quality Setting" , "hd" ), + ("fmt" , "int" , "FMT/ITAG Number (0 for auto)", 0 ), + (".mp4" , "bool" , "Allow .mp4" , True ), + (".flv" , "bool" , "Allow .flv" , True ), + (".webm" , "bool" , "Allow .webm" , False), + (".3gp" , "bool" , "Allow .3gp" , False), + ("3d" , "bool" , "Prefer 3D" , False)] __description__ = """Youtube.com hoster plugin""" __license__ = "GPLv3" @@ -90,7 +86,7 @@ class YoutubeCom(Hoster): def process(self, pyfile): pyfile.url = replace_patterns(pyfile.url, self.URL_REPLACEMENTS) - html = self.load(pyfile.url, decode=True) + html = self.load(pyfile.url, decode=True) if re.search(r'<div id="player-unavailable" class="\s*player-width player-height\s*">', html): self.offline() @@ -100,32 +96,40 @@ class YoutubeCom(Hoster): #get config use3d = self.getConfig("3d") + if use3d: quality = {"sd": 82, "hd": 84, "fullhd": 85, "240p": 83, "360p": 82, "480p": 82, "720p": 84, "1080p": 85, "3072p": 85} else: quality = {"sd": 18, "hd": 22, "fullhd": 37, "240p": 5, "360p": 18, "480p": 35, "720p": 22, "1080p": 37, "3072p": 38} + desired_fmt = self.getConfig("fmt") - if desired_fmt and desired_fmt not in self.formats: - self.logWarning(_("FMT %d unknown, using default") % desired_fmt) - desired_fmt = 0 + if not desired_fmt: desired_fmt = quality.get(self.getConfig("quality"), 18) + elif desired_fmt not in self.formats: + self.logWarning(_("FMT %d unknown, using default") % desired_fmt) + desired_fmt = 0 + #parse available streams - streams = re.search(r'"url_encoded_fmt_stream_map": "(.*?)",', html).group(1) + streams = re.search(r'"url_encoded_fmt_stream_map":"(.+?)",', html).group(1) streams = [x.split('\u0026') for x in streams.split(',')] streams = [dict((y.split('=', 1)) for y in x) for x in streams] streams = [(int(x['itag']), unquote(x['url'])) for x in streams] - #self.logDebug("Found links: %s" % streams) + + # self.logDebug("Found links: %s" % streams) + self.logDebug("AVAILABLE STREAMS: %s" % [x[0] for x in streams]) #build dictionary of supported itags (3D/2D) allowed = lambda x: self.getConfig(self.formats[x][0]) streams = [x for x in streams if x[0] in self.formats and allowed(x[0])] + if not streams: self.fail(_("No available stream meets your preferences")) + fmt_dict = dict([x for x in streams if self.formats[x[0]][4] == use3d] or streams) self.logDebug("DESIRED STREAM: ITAG:%d (%s) %sfound, %sallowed" % @@ -136,15 +140,18 @@ class YoutubeCom(Hoster): if desired_fmt in fmt_dict and allowed(desired_fmt): fmt = desired_fmt else: - sel = lambda x: self.formats[x][3] # select quality index + sel = lambda x: self.formats[x][3] # select quality index comp = lambda x, y: abs(sel(x) - sel(y)) self.logDebug("Choosing nearest fmt: %s" % [(x, allowed(x), comp(x, desired_fmt)) for x in fmt_dict.keys()]) + fmt = reduce(lambda x, y: x if comp(x, desired_fmt) <= comp(y, desired_fmt) and sel(x) > sel(y) else y, fmt_dict.keys()) self.logDebug("Chosen fmt: %s" % fmt) + url = fmt_dict[fmt] + self.logDebug("URL: %s" % url) #set file name @@ -167,9 +174,9 @@ class YoutubeCom(Hoster): m = "0" pyfile.name += " (starting at %s:%s)" % (m, s) - pyfile.name += file_suffix - filename = self.download(url) + pyfile.name += file_suffix + filename = self.download(url) if ffmpeg and time: inputfile = filename + "_" @@ -182,4 +189,5 @@ class YoutubeCom(Hoster): "-vcodec", "copy", "-acodec", "copy", filename]) + os.remove(inputfile) diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py index 93959637c..665b64789 100644 --- a/module/plugins/hoster/ZeveraCom.py +++ b/module/plugins/hoster/ZeveraCom.py @@ -1,42 +1,34 @@ # -*- coding: utf-8 -*- -from pyload.plugin.Hoster import Hoster +import re +from urlparse import urljoin -class ZeveraCom(Hoster): +from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo + + +class ZeveraCom(MultiHoster): __name__ = "ZeveraCom" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.28" - __pattern__ = r'http://(?:www\.)?zevera\.com/.*' + __pattern__ = r'https?://(?:www\.)zevera\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' - __description__ = """Zevera.com hoster plugin""" + __description__ = """Zevera.com multi-hoster plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - def setup(self): - self.resumeDownload = True - self.multiDL = True - self.chunkLimit = 1 + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] - def process(self, pyfile): - if not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "zevera.com") - self.fail(_("No zevera.com account provided")) + def handlePremium(self, pyfile): + self.link = "https://%s/getFiles.ashx?ourl=%s" % (self.account.HOSTER_DOMAIN, pyfile.url) - self.logDebug("Old URL: %s" % pyfile.url) - if self.account.getAPIData(self.req, cmd="checklink", olink=pyfile.url) != "Alive": - self.fail(_("Offline or not downloadable - contact Zevera support")) + def checkFile(self): + if self.checkDownload({"error": 'action="ErrorDownload.aspx'}): + self.fail(_("Error response received")) - header = self.account.getAPIData(self.req, just_header=True, cmd="generatedownloaddirect", olink=pyfile.url) - if not "location" in header: - self.fail(_("Unable to initialize download")) + return super(ZeveraCom, self).checkFile() - self.download(header['location'], disposition=True) - check = self.checkDownload({"error": 'action="ErrorDownload.aspx'}) - if check == "error": - self.fail(_("Error response received - contact Zevera support")) +getInfo = create_getInfo(ZeveraCom) diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index fa08cf18f..f08fb7dae 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -2,64 +2,64 @@ import re -from os.path import join -from urlparse import urljoin - +from module.plugins.internal.CaptchaService import ReCaptcha from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.62" + __version__ = "0.72" - __pattern__ = r'(?P<HOST>http://www\d{0,2}\.zippyshare\.com)/v(?:/|iew\.jsp.*key=)(?P<KEY>\d+)' + __pattern__ = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)' __description__ = """Zippyshare.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - NAME_PATTERN = r'("\d{6,}/"[ ]*\+.+?"/|<title>Zippyshare.com - )(?P<N>.+?)("|</title>)' - SIZE_PATTERN = r'>Size:.+?">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + COOKIES = [("zippyshare.com", "ziplocale", "en")] - OFFLINE_PATTERN = r'>File does not exist on this server<' + NAME_PATTERN = r'("\d{6,}/"[ ]*\+.+?"/|<title>Zippyshare.com - )(?P<N>.+?)("|</title>)' + SIZE_PATTERN = r'>Size:.+?">(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + OFFLINE_PATTERN = r'>File does not exist on this server' - COOKIES = [("zippyshare.com", "ziplocale", "en")] + LINK_PREMIUM_PATTERN = r'document.location = \'(.+?)\'' def setup(self): - self.multiDL = True - self.chunkLimit = -1 + self.chunkLimit = -1 + self.multiDL = True self.resumeDownload = True - def handleFree(self): - url = self.get_link() - self.download(url) + def handleFree(self, pyfile): + recaptcha = ReCaptcha(self) + captcha_key = recaptcha.detect_key() + + if captcha_key: + try: + self.link = re.search(self.LINK_PREMIUM_PATTERN, self.html) + recaptcha.challenge() + + except Exception, e: + self.error(e) + + else: + self.link = '/'.join(("d", self.info['pattern']['KEY'], str(self.get_checksum()), self.pyfile.name)) def get_checksum(self): try: - m = re.search(r'\+[ ]*\((\d+)[ ]*\%[ ]*(\d+)[ ]*\+[ ]*(\d+)[ ]*\%[ ]*(\d+)\)[ ]*\+', self.html) - if m: - a1, a2, c1, c2 = map(int, m.groups()) - else: - a1, a2 = map(int, re.search(r'\(\'downloadB\'\).omg = (\d+)%(\d+)', self.html).groups()) - c1, c2 = map(int, re.search(r'\(\'downloadB\'\).omg\) \* \((\d+)%(\d+)', self.html).groups()) - - b = (a1 % a2) * (c1 % c2) + n = 2 + b = int(re.search(r'var b = (\d+)', self.html).group(1)) + checksum = int("%d3" % (n + n * 2 + b)) + except Exception: self.error(_("Unable to calculate checksum")) - else: - return b + 18 - - def get_link(self): - checksum = self.get_checksum() - p_url = join("d", self.info['pattern']['KEY'], str(checksum), self.pyfile.name) - dl_link = urljoin(self.info['pattern']['HOST'], p_url) - return dl_link + else: + return checksum getInfo = create_getInfo(ZippyshareCom) |