forked from pyload/pyload
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlyFilesNet.py
More file actions
48 lines (35 loc) · 1.58 KB
/
FlyFilesNet.py
File metadata and controls
48 lines (35 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# -*- coding: utf-8 -*-
import re
import urllib
from ..internal.SimpleHoster import SimpleHoster
class FlyFilesNet(SimpleHoster):
__name__ = "FlyFilesNet"
__type__ = "hoster"
__version__ = "0.15"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?flyfiles\.net/.+'
__config__ = [("activated", "bool", "Activated", True),
("use_premium", "bool", "Use premium account if available", True),
("fallback", "bool",
"Fallback to free download if premium fails", True),
("chk_filesize", "bool", "Check file size", True),
("max_wait", "int", "Reconnect if waiting time is greater than minutes", 10)]
__description__ = """FlyFiles.net hoster plugin"""
__license__ = "GPLv3"
__authors__ = []
SESSION_PATTERN = r'flyfiles\.net/(.*)/.*'
NAME_PATTERN = r'flyfiles\.net/.*/(.*)'
def process(self, pyfile):
name = re.search(self.NAME_PATTERN, pyfile.url).group(1)
pyfile.name = urllib.unquote_plus(name)
session = re.search(self.SESSION_PATTERN, pyfile.url).group(1)
url = "http://flyfiles.net"
#: Get download URL
parsed_url = self.load(url, post={'getDownLink': session})
self.log_debug("Parsed URL: %s" % parsed_url)
if parsed_url == "#downlink|" or parsed_url == "#downlink|#":
self.log_warning(
_("Could not get the download URL. Please wait 10 minutes"))
self.wait(10 * 60, True)
self.retry()
self.link = parsed_url.replace('#downlink|', '')