summaryrefslogtreecommitdiffstats
path: root/module/plugins/crypter/EmbeduploadCom.py
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2011-11-29 21:45:27 +0100
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2011-11-29 21:45:27 +0100
commit8d3d5625aa14614f5799621137a27f07d08e3dca (patch)
tree46ba08101a8f225805ca2f77e8db0869edb58b45 /module/plugins/crypter/EmbeduploadCom.py
parentMerged in nick_de/pyload (pull request #6) (diff)
downloadpyload-8d3d5625aa14614f5799621137a27f07d08e3dca.tar.xz
update hellspy.cz, add bayfiles.com
Diffstat (limited to 'module/plugins/crypter/EmbeduploadCom.py')
-rw-r--r--module/plugins/crypter/EmbeduploadCom.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/module/plugins/crypter/EmbeduploadCom.py b/module/plugins/crypter/EmbeduploadCom.py
new file mode 100644
index 000000000..e84a06cc1
--- /dev/null
+++ b/module/plugins/crypter/EmbeduploadCom.py
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+
+import re
+from module.plugins.Crypter import Crypter
+
+class EmbeduploadCom(Crypter):
+ __name__ = "EmbeduploadCom"
+ __type__ = "crypter"
+ __pattern__ = r"http://(www\.)?embedupload.com/\?d=.*"
+ __version__ = "0.01"
+ __description__ = """EmbedUpload.com crypter"""
+ __config__ = [("preferedHoster", "str", "Prefered hoster list (bar-separated) ", "embedupload"),
+ ("ignoredHoster", "str", "Ignored hoster list (bar-separated) ", "")]
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ LINK_PATTERN = r'<div id="([^"]+)"[^>]*>\s*<a href="([^"]+)" target="_blank" (?:class="DownloadNow"|style="color:red")>'
+
+ def decrypt(self, pyfile):
+ self.html = self.load(self.pyfile.url, decode=True)
+ tmp_links = new_links = []
+
+ found = re.findall(self.LINK_PATTERN, self.html)
+ if found:
+ prefered_set = set(self.getConfig("preferedHoster").split('|'))
+ prefered_set = map(lambda s: s.lower().split('.')[0], prefered_set)
+ print "PF", prefered_set
+ tmp_links.extend([x[1] for x in found if x[0] in prefered_set])
+ self.getLocation(tmp_links, new_links)
+
+ if not new_links:
+ ignored_set = set(self.getConfig("ignoredHoster").split('|'))
+ ignored_set = map(lambda s: s.lower().split('.')[0], ignored_set)
+ print "IG", ignored_set
+ tmp_links.extend([x[1] for x in found if x[0] in ignored_set])
+ self.getLocation(tmp_links, new_links)
+
+ if new_links:
+ self.core.files.addLinks(new_links, self.pyfile.package().id)
+ else:
+ self.fail('Could not extract any links')
+
+ def getLocation(self, tmp_links, new_links):
+ for link in tmp_links:
+ header = self.load(link, just_header = True)
+ if "location" in header:
+ new_links.append(header['location'])
+
+ \ No newline at end of file