summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-01-07 23:15:49 +0100
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-01-07 23:15:49 +0100
commit03ec7f017c882c304be1d0759a348d5305f27d42 (patch)
treeaae22019e7778148e92d0b983f61de1a3747815b /module
parentshow empty packages (diff)
downloadpyload-03ec7f017c882c304be1d0759a348d5305f27d42.tar.xz
xfilesharengprofolder using new crypter api, allow slash in package name
Diffstat (limited to 'module')
-rw-r--r--module/Api.py2
-rw-r--r--module/plugins/Crypter.py2
-rw-r--r--module/plugins/crypter/XfilesharingProFolder.py34
3 files changed, 36 insertions, 2 deletions
diff --git a/module/Api.py b/module/Api.py
index 769fcdf0d..d707b18fc 100644
--- a/module/Api.py
+++ b/module/Api.py
@@ -301,7 +301,7 @@ class Api(Iface):
else:
folder = ""
- folder = folder.replace("http://", "").replace(":", "").replace("/", "_").replace("\\", "_")
+ folder = folder.replace("http://", "").replace(":", "").replace("\\", "_") #.replace("/", "_")
self.core.log.info(_("Added package %(name)s containing %(count)d links") % {"name": name, "count": len(links)})
pid = self.core.files.addPackage(name, folder, dest, password)
diff --git a/module/plugins/Crypter.py b/module/plugins/Crypter.py
index 3e423881e..6079ae8f6 100644
--- a/module/plugins/Crypter.py
+++ b/module/plugins/Crypter.py
@@ -12,7 +12,7 @@ from Base import Base, Retry
class Package:
""" Container that indicates new package should be created """
def __init__(self, name, urls=None, dest=Destination.Queue):
- self.name = name,
+ self.name = name
self.urls = urls if urls else []
self.dest = dest
diff --git a/module/plugins/crypter/XfilesharingProFolder.py b/module/plugins/crypter/XfilesharingProFolder.py
new file mode 100644
index 000000000..8e58c207d
--- /dev/null
+++ b/module/plugins/crypter/XfilesharingProFolder.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.Crypter import Crypter, Package
+import re
+
+class XfilesharingProFolder(Crypter):
+ __name__ = "XfilesharingProFolder"
+ __type__ = "crypter"
+ __pattern__ = r"http://(?:www\.)?((easybytez|turboupload|uploadville|file4safe|fileband|filebeep|grupload|247upload)\.com|(muchshare|annonhost).net|bzlink.us)/users/.*"
+ __version__ = "0.01"
+ __description__ = """Generic XfilesharingPro Folder Plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ LINK_PATTERN = r'<div class="link"><a href="([^"]+)" target="_blank">[^<]*</a></div>'
+ SUBFOLDER_PATTERN = r'<TD width="1%"><img src="[^"]*/images/folder2.gif"></TD><TD><a href="([^"]+)"><b>(?!\. \.<)([^<]+)</b></a></TD>'
+
+ def decryptURL(self, url):
+ return self.decryptFile(self.load(url, decode = True))
+
+ def decryptFile(self, html):
+ new_links = []
+
+ new_links.extend(re.findall(self.LINK_PATTERN, html))
+
+ subfolders = re.findall(self.SUBFOLDER_PATTERN, html)
+ #self.logDebug(subfolders)
+ for (url, name) in subfolders:
+ if self.package: name = "%s/%s" % (self.package.name, name)
+ new_links.append(Package(name, [url]))
+
+ if not new_links: self.fail('Could not extract any links')
+
+ return new_links \ No newline at end of file