summaryrefslogtreecommitdiffstats
path: root/pyload/plugin/hoster/LinksnappyCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/plugin/hoster/LinksnappyCom.py')
-rw-r--r--pyload/plugin/hoster/LinksnappyCom.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/pyload/plugin/hoster/LinksnappyCom.py b/pyload/plugin/hoster/LinksnappyCom.py
new file mode 100644
index 000000000..a898b21b9
--- /dev/null
+++ b/pyload/plugin/hoster/LinksnappyCom.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from urlparse import urlsplit
+
+from pyload.utils import json_loads, json_dumps
+from pyload.plugin.internal.MultiHoster import MultiHoster
+
+
+class LinksnappyCom(MultiHoster):
+ __name__ = "LinksnappyCom"
+ __type__ = "hoster"
+ __version__ = "0.08"
+
+ __pattern__ = r'https?://(?:[^/]+\.)?linksnappy\.com'
+ __config__ = [("use_premium", "bool", "Use premium account if available", True)]
+
+ __description__ = """Linksnappy.com multi-hoster plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("stickell", "l.stickell@yahoo.it")]
+
+
+ SINGLE_CHUNK_HOSTERS = ["easybytez.com"]
+
+
+ def handlePremium(self, pyfile):
+ host = self._get_host(pyfile.url)
+ json_params = json_dumps({'link' : pyfile.url,
+ 'type' : host,
+ 'username': self.user,
+ 'password': self.account.getAccountData(self.user)['password']})
+
+ r = self.load("http://gen.linksnappy.com/genAPI.php",
+ post={'genLinks': json_params})
+
+ self.logDebug("JSON data: " + r)
+
+ j = json_loads(r)['links'][0]
+
+ if j['error']:
+ self.error(_("Error converting the link"))
+
+ pyfile.name = j['filename']
+ self.link = j['generated']
+
+ if host in self.SINGLE_CHUNK_HOSTERS:
+ self.chunkLimit = 1
+ else:
+ self.setup()
+
+
+ @staticmethod
+ def _get_host(url):
+ host = urlsplit(url).netloc
+ return re.search(r'[\w-]+\.\w+$', host).group(0)