diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-12-13 15:56:57 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-12-13 15:56:57 +0100 |
commit | acc46fc3497a66a427b795b4a22c6e71d69185a1 (patch) | |
tree | 2d315b838a76435fc456b972c99c28d1732b2f70 /pyload/plugins/hoster/LinksnappyCom.py | |
parent | Code fixes (diff) | |
download | pyload-acc46fc3497a66a427b795b4a22c6e71d69185a1.tar.xz |
Update
Diffstat (limited to 'pyload/plugins/hoster/LinksnappyCom.py')
-rw-r--r-- | pyload/plugins/hoster/LinksnappyCom.py | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/pyload/plugins/hoster/LinksnappyCom.py b/pyload/plugins/hoster/LinksnappyCom.py deleted file mode 100644 index f45eba428..000000000 --- a/pyload/plugins/hoster/LinksnappyCom.py +++ /dev/null @@ -1,76 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from urlparse import urlsplit - -from pyload.utils import json_loads, json_dumps -from pyload.plugins.Hoster import Hoster - - -class LinksnappyCom(Hoster): - __name = "LinksnappyCom" - __type = "hoster" - __version = "0.02" - - __pattern = r'https?://(?:[^/]*\.)?linksnappy\.com' - - __description = """Linksnappy.com hoster plugin""" - __license = "GPLv3" - __authors = [("stickell", "l.stickell@yahoo.it")] - - - SINGLE_CHUNK_HOSTERS = ('easybytez.com') - - - def setup(self): - self.chunkLimit = -1 - self.resumeDownload = True - - - def process(self, pyfile): - if re.match(self.__pattern, pyfile.url): - new_url = pyfile.url - elif not self.account: - self.logError(_("Please enter your %s account or deactivate this plugin") % "Linksnappy.com") - self.fail(_("No Linksnappy.com account provided")) - else: - self.logDebug("Old URL: %s" % pyfile.url) - 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']: - msg = _("Error converting the link") - self.logError(msg, j['error']) - self.fail(msg) - - pyfile.name = j['filename'] - new_url = j['generated'] - - if host in self.SINGLE_CHUNK_HOSTERS: - self.chunkLimit = 1 - else: - self.setup() - - if new_url != pyfile.url: - self.logDebug("New URL: " + new_url) - - self.download(new_url, disposition=True) - - check = self.checkDownload({"html302": "<title>302 Found</title>"}) - if check == "html302": - self.retry(wait_time=5, reason=_("Linksnappy returns only HTML data")) - - - @staticmethod - def _get_host(url): - host = urlsplit(url).netloc - return re.search(r'[\w-]+\.\w+$', host).group(0) |