summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Frederik Möllers <frederikmoellers@posteo.de> 2015-06-23 00:33:49 +0200
committerGravatar Frederik Möllers <frederikmoellers@posteo.de> 2015-06-23 00:33:49 +0200
commit74070e8194cd84e16fb33afbed23758469d211c8 (patch)
tree709297520dcf476a9ee63ab2ac28bf6ac7270a73 /module/plugins
parentMerge pull request #1529 from GammaC0de/patch-1 (diff)
downloadpyload-74070e8194cd84e16fb33afbed23758469d211c8.tar.xz
Update ShSt crypter plugin
The plugin doesn't rely on a third party website anymore for the actual decrypting. Instead it uses a different user agent which makes sh.st serve an HTTP redirect. This speeds up the decrypting process and fixes errors related to the third party web site (in particular the latest outage and API change). Also, self.urls is now used instead of self.packages for the decrypted URL.
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/crypter/ShSt.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/module/plugins/crypter/ShSt.py b/module/plugins/crypter/ShSt.py
index c50a437db..f8733ac2b 100644
--- a/module/plugins/crypter/ShSt.py
+++ b/module/plugins/crypter/ShSt.py
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
-from module.plugins.internal.Crypter import Crypter
+from module.plugins.internal.SimpleCrypter import SimpleCrypter
+import pycurl
import re
-class ShSt(Crypter):
+class ShSt(SimpleCrypter):
__name__ = "ShSt"
__type__ = "crypter"
- __version__ = "0.01"
+ __version__ = "0.02"
__pattern__ = r'http://sh\.st/\w+'
@@ -21,8 +22,9 @@ class ShSt(Crypter):
def decrypt(self, pyfile):
- package = pyfile.package()
- package_name = package.name
- package_folder = package.folder
- html = self.load("http://deadlockers.com/submit.php", post = { "deadlock" : self.pyfile.url }, decode = True)
- self.packages.append((package_name, [html], package_folder))
+ # if we use curl as a user agent, we will get a straight redirect (no waiting!)
+ self.req.http.c.setopt(pycurl.USERAGENT, "curl/7.42.1")
+ # fetch the target URL
+ header = self.load(self.pyfile.url, just_header = True, decode = False)
+ target_url = header["location"]
+ self.urls.append(target_url)