summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Frederik Möllers <frederikmoellers@posteo.de> 2015-06-09 01:06:53 +0200
committerGravatar Frederik Möllers <frederikmoellers@posteo.de> 2015-06-09 01:06:53 +0200
commite706acebd1b8ae5152987ea6cba447f19e75da93 (patch)
treecd568692e13ec2ded9c290acfebc69c38b0855c3
parentNew Crypter plugin: sh.st (diff)
downloadpyload-e706acebd1b8ae5152987ea6cba447f19e75da93.tar.xz
New Crypter plugin: pasted.co
Pasted.co is a pastebin service. It can be used to host a list of download links which pyLoad could use. The plugin bypasses the (ineffective) captcha request and fetches the contents of the paste. It keeps the original package's name and folder and just inserts the links from the paste.
-rw-r--r--module/plugins/crypter/PastedCo.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/module/plugins/crypter/PastedCo.py b/module/plugins/crypter/PastedCo.py
new file mode 100644
index 000000000..8236345cc
--- /dev/null
+++ b/module/plugins/crypter/PastedCo.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.internal.Crypter import Crypter
+
+import re
+
+
+class PastedCo(Crypter):
+ __name__ = "PastedCo"
+ __type__ = "crypter"
+ __version__ = "0.01"
+
+ __pattern__ = r'http://pasted\.co/\w+'
+
+ __description__ = """Pasted.co decrypter plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("Frederik Möllers", "fred-public@posteo.de")]
+
+
+ NAME_PATTERN = r'<title>(?P<N>.+?) - .+</title>'
+ NAME_PATTERN = r"'save_paste' href=\"(http://pasted.co/[0-9a-f]+)/info"
+
+ FS_URL_PREFIX = '<pre id=\'thepaste\' class="prettyprint">'
+ FS_URL_SUFFIX = '</pre>'
+
+ def decrypt(self, pyfile):
+ package = pyfile.package()
+ package_name = package.name
+ package_folder = package.folder
+ html = self.load(pyfile.url, decode = True).splitlines()
+ fs_url = None
+ FS_URL_RE = re.compile('%s/fullscreen\.php\?hash=[0-9a-f]*' % pyfile.url)
+ for line in html:
+ match = FS_URL_RE.search(line)
+ if match:
+ fs_url = match.group()
+ break
+ if not fs_url:
+ raise Exception("Could not find pasted.co fullscreen URL!")
+ urls = self.load(fs_url, decode = True)
+ urls = urls[urls.find(PastedCo.FS_URL_PREFIX) + len(PastedCo.FS_URL_PREFIX):]
+ urls = urls[:urls.find(PastedCo.FS_URL_SUFFIX)].splitlines()
+ self.packages.append((package_name, urls, package_folder))