diff options
20 files changed, 47 insertions, 68 deletions
diff --git a/module/plugins/crypter/BitshareComFolder.py b/module/plugins/crypter/BitshareComFolder.py index e77870d26..e4038aebf 100644 --- a/module/plugins/crypter/BitshareComFolder.py +++ b/module/plugins/crypter/BitshareComFolder.py @@ -18,4 +18,4 @@ class BitshareComFolder(SimpleCrypter): LINK_PATTERN = r'<a href="(http://bitshare\.com/files/.+)">.+</a></td>' - NAME_PATTERN = r'View public folder "(.+)"</h1>' + NAME_PATTERN = r'View public folder "(?P<N>.+)"</h1>' diff --git a/module/plugins/crypter/DataHuFolder.py b/module/plugins/crypter/DataHuFolder.py index 39523c05d..0399e686d 100644 --- a/module/plugins/crypter/DataHuFolder.py +++ b/module/plugins/crypter/DataHuFolder.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter class DataHuFolder(SimpleCrypter): __name__ = "DataHuFolder" __type__ = "crypter" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'http://(?:www\.)?data\.hu/dir/\w+' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), @@ -21,25 +21,20 @@ class DataHuFolder(SimpleCrypter): LINK_PATTERN = r'<a href=\'(http://data\.hu/get/.+)\' target=\'_blank\'>\1</a>' - NAME_PATTERN = ur'<title>(.+) Let\xf6lt\xe9se</title>' + NAME_PATTERN = ur'<title>(?P<N>.+) Let\xf6lt\xe9se</title>' - def decrypt(self, pyfile): - self.html = self.load(pyfile.url, decode=True) + def prepare(self): + super(DataHuFolder, self).prepare() if u'K\xe9rlek add meg a jelsz\xf3t' in self.html: # Password protected password = self.getPassword() - if password is '': - self.fail(_("No password specified, please set right password on Add package form and retry")) - self.logDebug("The folder is password protected', 'Using password: " + password) - self.html = self.load(pyfile.url, post={'mappa_pass': password}, decode=True) - if u'Hib\xe1s jelsz\xf3' in self.html: # Wrong password - self.fail(_("Incorrect password, please set right password on Add package form and retry")) + if not password: + self.fail(_("Password required")) - package_name, folder_name = self.getPackageNameAndFolder() + self.logDebug("The folder is password protected', 'Using password: " + password) - package_links = re.findall(self.LINK_PATTERN, self.html) - self.logDebug("Package has %d links" % len(package_links)) + self.html = self.load(self.pyfile.url, post={'mappa_pass': password}, decode=True) - if package_links: - self.packages = [(package_name, package_links, folder_name)] + if u'Hib\xe1s jelsz\xf3' in self.html: # Wrong password + self.fail(_("Wrong password")) diff --git a/module/plugins/crypter/DevhostStFolder.py b/module/plugins/crypter/DevhostStFolder.py index 397a72ac4..16931984b 100644 --- a/module/plugins/crypter/DevhostStFolder.py +++ b/module/plugins/crypter/DevhostStFolder.py @@ -13,7 +13,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter class DevhostStFolder(SimpleCrypter): __name__ = "DevhostStFolder" __type__ = "crypter" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?d-h\.st/users/(?P<USER>\w+)(/\?fld_id=(?P<ID>\d+))?' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), @@ -29,7 +29,10 @@ class DevhostStFolder(SimpleCrypter): OFFLINE_PATTERN = r'"/cHP">test\.png<' - def getPackageNameAndFolder(self): + def getFileInfo(self): + if re.search(self.OFFLINE_PATTERN, self.html): + self.offline() + try: id = re.match(self.__pattern__, self.pyfile.url).group('ID') if id == "0": @@ -48,7 +51,7 @@ class DevhostStFolder(SimpleCrypter): self.logDebug(str(e)) name = folder = re.match(self.__pattern__, self.pyfile.url).group('USER') - return name, folder + return {'name': name, 'folder': folder} def getLinks(self): diff --git a/module/plugins/crypter/FilecloudIoFolder.py b/module/plugins/crypter/FilecloudIoFolder.py index cc5c2a160..5640ab5c9 100644 --- a/module/plugins/crypter/FilecloudIoFolder.py +++ b/module/plugins/crypter/FilecloudIoFolder.py @@ -18,4 +18,4 @@ class FilecloudIoFolder(SimpleCrypter): LINK_PATTERN = r'href="(http://filecloud\.io/\w+)" title' - NAME_PATTERN = r'>(.+?) - filecloud\.io<' + NAME_PATTERN = r'>(?P<N>.+?) - filecloud\.io<' diff --git a/module/plugins/crypter/FilefactoryComFolder.py b/module/plugins/crypter/FilefactoryComFolder.py index 4975ba506..ab4e76092 100644 --- a/module/plugins/crypter/FilefactoryComFolder.py +++ b/module/plugins/crypter/FilefactoryComFolder.py @@ -18,7 +18,7 @@ class FilefactoryComFolder(SimpleCrypter): LINK_PATTERN = r'<td><a href="([^"]+)">' - NAME_PATTERN = r'<h1>Files in <span>(.+)</span></h1>' + NAME_PATTERN = r'<h1>Files in <span>(?P<N>.+)</span></h1>' PAGES_PATTERN = r'data-paginator-totalPages="(\d+)"' COOKIES = [('.filefactory.com', 'locale', 'en_US.utf8')] diff --git a/module/plugins/crypter/FilerNetFolder.py b/module/plugins/crypter/FilerNetFolder.py index 37c958e87..a2daba136 100644 --- a/module/plugins/crypter/FilerNetFolder.py +++ b/module/plugins/crypter/FilerNetFolder.py @@ -19,7 +19,7 @@ class FilerNetFolder(SimpleCrypter): LINK_PATTERN = r'href="(/get/\w{16})">(?!<)' - NAME_PATTERN = r'<h3>(.+?) - <small' + NAME_PATTERN = r'<h3>(?P<N>.+?) - <small' def getLinks(self): diff --git a/module/plugins/crypter/FilestubeCom.py b/module/plugins/crypter/FilestubeCom.py index ecd6b9fc7..29de108e5 100644 --- a/module/plugins/crypter/FilestubeCom.py +++ b/module/plugins/crypter/FilestubeCom.py @@ -18,4 +18,4 @@ class FilestubeCom(SimpleCrypter): LINK_PATTERN = r'<a class=\"file-link-main(?: noref)?\" [^>]* href=\"(http://[^\"]+)' - NAME_PATTERN = r'<h1\s*> (.+) download\s*</h1>' + NAME_PATTERN = r'<h1\s*> (?P<N>.+) download\s*</h1>' diff --git a/module/plugins/crypter/FiletramCom.py b/module/plugins/crypter/FiletramCom.py index 50233e903..e4c8b6360 100644 --- a/module/plugins/crypter/FiletramCom.py +++ b/module/plugins/crypter/FiletramCom.py @@ -19,4 +19,4 @@ class FiletramCom(SimpleCrypter): LINK_PATTERN = r'\s+(http://.+)' - NAME_PATTERN = r'<title>(.+?) - Free Download' + NAME_PATTERN = r'<title>(?P<N>.+?) - Free Download' diff --git a/module/plugins/crypter/FreakhareComFolder.py b/module/plugins/crypter/FreakhareComFolder.py index 4d9ffca1d..d4d3c6d3c 100644 --- a/module/plugins/crypter/FreakhareComFolder.py +++ b/module/plugins/crypter/FreakhareComFolder.py @@ -20,7 +20,7 @@ class FreakhareComFolder(SimpleCrypter): LINK_PATTERN = r'<a href="(http://freakshare\.com/files/[^"]+)" target="_blank">' - NAME_PATTERN = r'Folder:</b> (.+)' + NAME_PATTERN = r'Folder:</b> (?P<N>.+)' PAGES_PATTERN = r'Pages: +(\d+)' diff --git a/module/plugins/crypter/ImgurComAlbum.py b/module/plugins/crypter/ImgurComAlbum.py index 5402ed43f..f8f226a1b 100644 --- a/module/plugins/crypter/ImgurComAlbum.py +++ b/module/plugins/crypter/ImgurComAlbum.py @@ -18,7 +18,7 @@ class ImgurComAlbum(SimpleCrypter): __authors__ = [("nath_schwarz", "nathan.notwhite@gmail.com")] - NAME_PATTERN = r'(.+?) - Imgur' + NAME_PATTERN = r'(?P<N>.+?) - Imgur' LINK_PATTERN = r'i\.imgur\.com/\w{7}s?\.(?:jpeg|jpg|png|gif|apng)' diff --git a/module/plugins/crypter/MultiUpOrg.py b/module/plugins/crypter/MultiUpOrg.py index 717b209ec..5f3fc8b17 100644 --- a/module/plugins/crypter/MultiUpOrg.py +++ b/module/plugins/crypter/MultiUpOrg.py @@ -20,7 +20,7 @@ class MultiUpOrg(SimpleCrypter): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - NAME_PATTERN = r'<title>.*(?:Project|Projet|ownload|élécharger) (.+?) (?:\(|- )' + NAME_PATTERN = r'<title>.*(?:Project|Projet|ownload|élécharger) (?P<N>.+?) (\(|- )' def getLinks(self): diff --git a/module/plugins/crypter/NetfolderIn.py b/module/plugins/crypter/NetfolderIn.py index d94b88af1..a47bd0503 100644 --- a/module/plugins/crypter/NetfolderIn.py +++ b/module/plugins/crypter/NetfolderIn.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter class NetfolderIn(SimpleCrypter): __name__ = "NetfolderIn" __type__ = "crypter" - __version__ = "0.71" + __version__ = "0.72" __pattern__ = r'http://(?:www\.)?netfolder\.in/((?P<id1>\w+)/\w+|folder\.php\?folder_id=(?P<id2>\w+))' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), @@ -20,12 +20,11 @@ class NetfolderIn(SimpleCrypter): ("fragonib", "fragonib[AT]yahoo[DOT]es")] - NAME_PATTERN = r'<div class="Text">Inhalt des Ordners <span.*>(.+)</span></div>' + NAME_PATTERN = r'<div class="Text">Inhalt des Ordners <span.*>(?P<N>.+)</span></div>' - def decrypt(self, pyfile): - # Request package - self.html = self.load(pyfile.url) + def prepare(self): + super(NetfolderIn, self).prepare() # Check for password protection if self.isPasswordProtected(): @@ -33,15 +32,6 @@ class NetfolderIn(SimpleCrypter): if not self.html: self.fail(_("Incorrect password, please set right password on Add package form and retry")) - # Get package name and folder - (package_name, folder_name) = self.getPackageNameAndFolder() - - # Get package links - package_links = self.getLinks() - - # Set package - self.packages = [(package_name, package_links, folder_name)] - def isPasswordProtected(self): if '<input type="password" name="password"' in self.html: diff --git a/module/plugins/crypter/NosvideoCom.py b/module/plugins/crypter/NosvideoCom.py index bc908279f..3abefdadb 100644 --- a/module/plugins/crypter/NosvideoCom.py +++ b/module/plugins/crypter/NosvideoCom.py @@ -18,4 +18,4 @@ class NosvideoCom(SimpleCrypter): LINK_PATTERN = r'href="(http://(?:w{3}\.)?nosupload\.com/\?d=\w+)"' - NAME_PATTERN = r'<[tT]itle>Watch (.+?)<' + NAME_PATTERN = r'<[tT]itle>Watch (?P<N>.+?)<' diff --git a/module/plugins/crypter/PastebinCom.py b/module/plugins/crypter/PastebinCom.py index e0dfa4fd8..1dae39bb8 100644 --- a/module/plugins/crypter/PastebinCom.py +++ b/module/plugins/crypter/PastebinCom.py @@ -18,4 +18,4 @@ class PastebinCom(SimpleCrypter): LINK_PATTERN = r'<div class="de\d+">(https?://[^ <]+)(?:[^<]*)</div>' - NAME_PATTERN = r'<div class="paste_box_line1" title="([^"]+)">' + NAME_PATTERN = r'<div class="paste_box_line1" title="(?P<N>[^"]+)">' diff --git a/module/plugins/crypter/SexuriaCom.py b/module/plugins/crypter/SexuriaCom.py index 6166c2023..3c952fd6b 100644 --- a/module/plugins/crypter/SexuriaCom.py +++ b/module/plugins/crypter/SexuriaCom.py @@ -34,10 +34,8 @@ class SexuriaCom(Crypter): self.package = pyfile.package() # Get package links - (package_name, package_links, folder_name, package_pwd) = self.decryptLinks(self.pyfile.url) - if package_pwd: - self.pyfile.package().password = package_pwd - self.packages.append((package_name, package_links, folder_name)) + package_name, self.links, folder_name, package_pwd = self.decryptLinks(self.pyfile.url) + self.packages = [(package_name, self.links, folder_name)] def decryptLinks(self, url): diff --git a/module/plugins/crypter/TnyCz.py b/module/plugins/crypter/TnyCz.py index 4e29d1032..6dde729f5 100644 --- a/module/plugins/crypter/TnyCz.py +++ b/module/plugins/crypter/TnyCz.py @@ -19,7 +19,7 @@ class TnyCz(SimpleCrypter): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - NAME_PATTERN = r'<title>(.+) - .+</title>' + NAME_PATTERN = r'<title>(?P<N>.+) - .+</title>' def getLinks(self): diff --git a/module/plugins/crypter/TurbobitNetFolder.py b/module/plugins/crypter/TurbobitNetFolder.py index 79fd7d7e0..4e07564af 100644 --- a/module/plugins/crypter/TurbobitNetFolder.py +++ b/module/plugins/crypter/TurbobitNetFolder.py @@ -21,7 +21,7 @@ class TurbobitNetFolder(SimpleCrypter): ("Walter Purcaro", "vuolter@gmail.com")] - NAME_PATTERN = r'src=\'/js/lib/grid/icon/folder.png\'> <span>(.+?)</span>' + NAME_PATTERN = r'src=\'/js/lib/grid/icon/folder.png\'> <span>(?P<N>.+?)</span>' def _getLinks(self, id, page=1): diff --git a/module/plugins/crypter/TusfilesNetFolder.py b/module/plugins/crypter/TusfilesNetFolder.py index 7c1375f93..e8da59736 100644 --- a/module/plugins/crypter/TusfilesNetFolder.py +++ b/module/plugins/crypter/TusfilesNetFolder.py @@ -10,7 +10,7 @@ from module.plugins.internal.XFSCrypter import XFSCrypter class TusfilesNetFolder(XFSCrypter): __name__ = "TusfilesNetFolder" __type__ = "crypter" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'https?://(?:www\.)?tusfiles\.net/go/(?P<ID>\w+)' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), @@ -42,4 +42,4 @@ class TusfilesNetFolder(XFSCrypter): for p in xrange(2, pages + 1): self.html = self.loadPage(p) - self.package_links += self.getLinks() + self.links += self.getLinks() diff --git a/module/plugins/crypter/UploadableChFolder.py b/module/plugins/crypter/UploadableChFolder.py index 9653d8891..070753ac0 100644 --- a/module/plugins/crypter/UploadableChFolder.py +++ b/module/plugins/crypter/UploadableChFolder.py @@ -19,6 +19,6 @@ class UploadableChFolder(SimpleCrypter): LINK_PATTERN = r'"(.+?)" class="icon_zipfile">' - NAME_PATTERN = r'<div class="folder"><span> </span>(.+?)</div>' + NAME_PATTERN = r'<div class="folder"><span> </span>(?P<N>.+?)</div>' OFFLINE_PATTERN = r'We are sorry... The URL you entered cannot be found on the server.' TEMP_OFFLINE_PATTERN = r'<div class="icon_err">' diff --git a/module/plugins/crypter/UploadedToFolder.py b/module/plugins/crypter/UploadedToFolder.py index 23e803979..359ba92d0 100644 --- a/module/plugins/crypter/UploadedToFolder.py +++ b/module/plugins/crypter/UploadedToFolder.py @@ -2,13 +2,15 @@ import re +from urlparse import urljoin + from module.plugins.internal.SimpleCrypter import SimpleCrypter class UploadedToFolder(SimpleCrypter): __name__ = "UploadedToFolder" __type__ = "crypter" - __version__ = "0.41" + __version__ = "0.42" __pattern__ = r'http://(?:www\.)?(uploaded|ul)\.(to|net)/(f|folder|list)/(?P<id>\w+)' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), @@ -20,22 +22,13 @@ class UploadedToFolder(SimpleCrypter): PLAIN_PATTERN = r'<small class="date"><a href="(?P<plain>[\w/]+)" onclick=' - NAME_PATTERN = r'<title>(.+?)<' - + NAME_PATTERN = r'<title>(?P<N>.+?)<' - def decrypt(self, pyfile): - self.html = self.load(pyfile.url) - - package_name, folder_name = self.getPackageNameAndFolder() + def getLinks(self): m = re.search(self.PLAIN_PATTERN, self.html) - if m: - plain_link = 'http://uploaded.net/' + m.group('plain') - else: - self.error(_("Unable to find plain url list")) - - self.html = self.load(plain_link) - package_links = self.html.split('\n')[:-1] - self.logDebug("Package has %d links" % len(package_links)) + if m is None: + self.error(_("PLAIN_PATTERN not found")) - self.packages = [(package_name, package_links, folder_name)] + plain_link = urljoin("http://uploaded.net/", m.group('plain')) + return self.load(plain_link).split('\n')[:-1] |