summaryrefslogtreecommitdiffstats
path: root/pyload/plugin/hoster/FastixRu.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/plugin/hoster/FastixRu.py')
-rw-r--r--pyload/plugin/hoster/FastixRu.py63
1 files changed, 63 insertions, 0 deletions
diff --git a/pyload/plugin/hoster/FastixRu.py b/pyload/plugin/hoster/FastixRu.py
new file mode 100644
index 000000000..d8fd7d808
--- /dev/null
+++ b/pyload/plugin/hoster/FastixRu.py
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from random import randrange
+from urllib import unquote
+
+from pyload.utils import json_loads
+from pyload.plugin.internal.MultiHoster import MultiHoster
+
+
+class FastixRu(MultiHoster):
+ __name = "FastixRu"
+ __type = "hoster"
+ __version = "0.09"
+
+ __pattern = r'http://(?:www\.)?fastix\.(ru|it)/file/\w{24}'
+
+ __description = """Fastix multi-hoster plugin"""
+ __license = "GPLv3"
+ __authors = [("Massimo Rosamilia", "max@spiritix.eu")]
+
+
+ def getFilename(self, url):
+ try:
+ name = unquote(url.rsplit("/", 1)[1])
+ except IndexError:
+ name = "Unknown_Filename..."
+ if name.endswith("..."): # incomplete filename, append random stuff
+ name += "%s.tmp" % randrange(100, 999)
+ return name
+
+
+ def setup(self):
+ self.chunkLimit = 3
+
+
+ def handlePremium(self, pyfile):
+ api_key = self.account.getAccountData(self.user)
+ api_key = api_key['api']
+
+ self.html = self.load("http://fastix.ru/api_v2/",
+ get={'apikey': api_key, 'sub': "getdirectlink", 'link': pyfile.url})
+
+ data = json_loads(self.html)
+
+ self.logDebug("Json data", data)
+
+ if "error\":true" in self.html:
+ self.offline()
+ else:
+ self.link = data['downloadlink']
+
+ if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"):
+ #only use when name wasnt already set
+ pyfile.name = self.getFilename(self.link)
+
+
+ def checkFile(self):
+ if self.checkDownload({"error": "<title>An error occurred while processing your request</title>"}):
+ self.retry(wait_time=60, reason=_("An error occurred while generating link"))
+
+ return super(FastixRu, self).checkFile()