From 8e47b0de30a25d0fd5dfb518bfe4e1e7beff93fd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 15 Jul 2014 16:27:44 +0200 Subject: Key attributes cleanup for account, container and crypter plugins --- module/plugins/crypter/EmbeduploadCom.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'module/plugins/crypter/EmbeduploadCom.py') diff --git a/module/plugins/crypter/EmbeduploadCom.py b/module/plugins/crypter/EmbeduploadCom.py index fbccf71aa..6126527a9 100644 --- a/module/plugins/crypter/EmbeduploadCom.py +++ b/module/plugins/crypter/EmbeduploadCom.py @@ -7,17 +7,20 @@ from module.network.HTTPRequest import BadHeader class EmbeduploadCom(Crypter): __name__ = "EmbeduploadCom" + __version__ = "0.02" __type__ = "crypter" + __pattern__ = r'http://(?:www\.)?embedupload.com/\?d=.*' - __version__ = "0.02" - __description__ = """EmbedUpload.com decrypter plugin""" __config__ = [("preferedHoster", "str", "Prefered hoster list (bar-separated) ", "embedupload"), ("ignoredHoster", "str", "Ignored hoster list (bar-separated) ", "")] + + __description__ = """EmbedUpload.com decrypter plugin""" __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" LINK_PATTERN = r'
]*>\s*' + def decrypt(self, pyfile): self.html = self.load(pyfile.url, decode=True) tmp_links = [] -- cgit v1.2.3 From a1e78f33dc2b0b6777fdcbc415673f3965b25542 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 16 Jul 2014 00:46:26 +0200 Subject: Prefer self.urls and self.packages for adding links --- module/plugins/crypter/EmbeduploadCom.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'module/plugins/crypter/EmbeduploadCom.py') diff --git a/module/plugins/crypter/EmbeduploadCom.py b/module/plugins/crypter/EmbeduploadCom.py index 6126527a9..823e3f25f 100644 --- a/module/plugins/crypter/EmbeduploadCom.py +++ b/module/plugins/crypter/EmbeduploadCom.py @@ -24,7 +24,6 @@ class EmbeduploadCom(Crypter): def decrypt(self, pyfile): self.html = self.load(pyfile.url, decode=True) tmp_links = [] - new_links = [] found = re.findall(self.LINK_PATTERN, self.html) if found: @@ -32,21 +31,20 @@ class EmbeduploadCom(Crypter): 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) + self.urls = self.getLocation(tmp_links) - if not new_links: + if not self.urls: 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] not in ignored_set]) - self.getLocation(tmp_links, new_links) + self.urls = self.getLocation(tmp_links) - if new_links: - self.core.files.addLinks(new_links, pyfile.package().id) - else: + if not self.urls: self.fail('Could not extract any links') - def getLocation(self, tmp_links, new_links): + def getLocation(self, tmp_links): + new_links = [] for link in tmp_links: try: header = self.load(link, just_header=True) @@ -54,3 +52,4 @@ class EmbeduploadCom(Crypter): new_links.append(header['location']) except BadHeader: pass + return new_links -- cgit v1.2.3 From 9395182da7afed55a29bde1c7cbefe4204e783f0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:02:09 +0200 Subject: Store all re.search/match object as "m" instead "found" --- module/plugins/crypter/EmbeduploadCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/crypter/EmbeduploadCom.py') diff --git a/module/plugins/crypter/EmbeduploadCom.py b/module/plugins/crypter/EmbeduploadCom.py index 823e3f25f..052f5ca84 100644 --- a/module/plugins/crypter/EmbeduploadCom.py +++ b/module/plugins/crypter/EmbeduploadCom.py @@ -25,19 +25,19 @@ class EmbeduploadCom(Crypter): self.html = self.load(pyfile.url, decode=True) tmp_links = [] - found = re.findall(self.LINK_PATTERN, self.html) - if found: + m = re.findall(self.LINK_PATTERN, self.html) + if m: 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]) + tmp_links.extend([x[1] for x in m if x[0] in prefered_set]) self.urls = self.getLocation(tmp_links) if not self.urls: 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] not in ignored_set]) + tmp_links.extend([x[1] for x in m if x[0] not in ignored_set]) self.urls = self.getLocation(tmp_links) if not self.urls: -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/crypter/EmbeduploadCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/crypter/EmbeduploadCom.py') diff --git a/module/plugins/crypter/EmbeduploadCom.py b/module/plugins/crypter/EmbeduploadCom.py index 052f5ca84..6b876ed7f 100644 --- a/module/plugins/crypter/EmbeduploadCom.py +++ b/module/plugins/crypter/EmbeduploadCom.py @@ -7,8 +7,8 @@ from module.network.HTTPRequest import BadHeader class EmbeduploadCom(Crypter): __name__ = "EmbeduploadCom" - __version__ = "0.02" __type__ = "crypter" + __version__ = "0.02" __pattern__ = r'http://(?:www\.)?embedupload.com/\?d=.*' __config__ = [("preferedHoster", "str", "Prefered hoster list (bar-separated) ", "embedupload"), -- cgit v1.2.3