summaryrefslogtreecommitdiffstats
path: root/module/plugins/crypter/UploadedToFolder.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/crypter/UploadedToFolder.py')
-rw-r--r--module/plugins/crypter/UploadedToFolder.py55
1 files changed, 20 insertions, 35 deletions
diff --git a/module/plugins/crypter/UploadedToFolder.py b/module/plugins/crypter/UploadedToFolder.py
index 36dd9714a..0a71add70 100644
--- a/module/plugins/crypter/UploadedToFolder.py
+++ b/module/plugins/crypter/UploadedToFolder.py
@@ -1,52 +1,37 @@
# -*- coding: utf-8 -*-
-############################################################################
-# This program is free software: you can redistribute it and/or modify #
-# it under the terms of the GNU Affero General Public License as #
-# published by the Free Software Foundation, either version 3 of the #
-# License, or (at your option) any later version. #
-# #
-# This program is distributed in the hope that it will be useful, #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
-# GNU Affero General Public License for more details. #
-# #
-# You should have received a copy of the GNU Affero General Public License #
-# along with this program. If not, see <http://www.gnu.org/licenses/>. #
-############################################################################
import re
-from module.plugins.internal.SimpleCrypter import SimpleCrypter
+from urlparse import urljoin
+
+from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
class UploadedToFolder(SimpleCrypter):
- __name__ = "UploadedToFolder"
- __version__ = "0.3"
- __type__ = "crypter"
+ __name__ = "UploadedToFolder"
+ __type__ = "crypter"
+ __version__ = "0.42"
- __pattern__ = r'http://(?:www\.)?(uploaded|ul)\.(to|net)/(f|folder|list)/(?P<id>\w+)'
+ __pattern__ = r'http://(?:www\.)?(uploaded|ul)\.(to|net)/(f|folder|list)/(?P<ID>\w+)'
+ __config__ = [("use_subfolder", "bool", "Save package to subfolder", True),
+ ("subfolder_per_package", "bool", "Create a subfolder for each package", True)]
__description__ = """UploadedTo decrypter plugin"""
- __author_name__ = "stickell"
- __author_mail__ = "l.stickell@yahoo.it"
-
- PLAIN_PATTERN = r'<small class="date"><a href="(?P<plain>[\w/]+)" onclick='
- TITLE_PATTERN = r'<title>(?P<title>[^<]+)</title>'
+ __license__ = "GPLv3"
+ __authors__ = [("stickell", "l.stickell@yahoo.it")]
- def decrypt(self, pyfile):
- self.html = self.load(pyfile.url)
+ PLAIN_PATTERN = r'<small class="date"><a href="([\w/]+)" onclick='
+ NAME_PATTERN = r'<title>(?P<N>.+?)<'
- 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.fail('Parse error - Unable to find plain url list')
+ if m is None:
+ self.error(_("PLAIN_PATTERN not found"))
+
+ plain_link = urljoin("http://uploaded.net/", m.group(1))
+ return self.load(plain_link).split('\n')[:-1]
- self.html = self.load(plain_link)
- package_links = self.html.split('\n')[:-1]
- self.logDebug('Package has %d links' % len(package_links))
- self.packages = [(package_name, package_links, folder_name)]
+getInfo = create_getInfo(UploadedToFolder)