summaryrefslogtreecommitdiffstats
path: root/module/plugins/crypter/GooGl.py
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-04-06 00:07:25 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2013-04-06 00:07:25 +0200
commit7379731d2f26e0a45e19b8f1cc6342115a0f559c (patch)
tree701f5e4c5103d047b702237a8d84a66edd7e054e /module/plugins/crypter/GooGl.py
parentparseFileSize fix (diff)
parentEgoFilesCom: fixed bug in premium downloads. (diff)
downloadpyload-7379731d2f26e0a45e19b8f1cc6342115a0f559c.tar.xz
Merge plugins from stable.
Conflicts: module/plugins/internal/UnRar.py
Diffstat (limited to 'module/plugins/crypter/GooGl.py')
-rw-r--r--module/plugins/crypter/GooGl.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/module/plugins/crypter/GooGl.py b/module/plugins/crypter/GooGl.py
new file mode 100644
index 000000000..07de5e008
--- /dev/null
+++ b/module/plugins/crypter/GooGl.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+
+from module.plugins.Crypter import Crypter
+from module.common.json_layer import json_loads
+
+
+class GooGl(Crypter):
+ __name__ = "GooGl"
+ __type__ = "crypter"
+ __pattern__ = r"https?://(www\.)?goo\.gl/\w+"
+ __version__ = "0.01"
+ __description__ = """Goo.gl Crypter Plugin"""
+ __author_name__ = ("stickell")
+ __author_mail__ = ("l.stickell@yahoo.it")
+
+ API_URL = 'https://www.googleapis.com/urlshortener/v1/url'
+
+ def decrypt(self, pyfile):
+ rep = self.load(self.API_URL, get={'shortUrl': pyfile.url})
+ self.logDebug('JSON data: ' + rep)
+ rep = json_loads(rep)
+
+ if 'longUrl' in rep:
+ self.core.files.addLinks([rep['longUrl']], self.pyfile.package().id)
+ else:
+ self.fail('Unable to expand shortened link')