Repository navigation
Expand file tree
/
Copy pathFreeWayMe.py
More file actions
56 lines (42 loc) · 1.93 KB
/
Copy pathFreeWayMe.py
File metadata and controls
56 lines (42 loc) · 1.93 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
49
50
51
52
53
54
55
56
# -*- coding: utf-8 -*-
from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo
class FreeWayMe(MultiHoster):
__name__ = "FreeWayMe"
__type__ = "hoster"
__version__ = "0.19"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?free-way\.(bz|me)/.+'
__config__ = [("use_premium" , "bool", "Use premium account if available" , True),
("revertfailed", "bool", "Revert to standard download if fails", True)]
__description__ = """FreeWayMe multi-hoster plugin"""
__license__ = "GPLv3"
__authors__ = [("Nicolas Giese", "james@free-way.me")]
def setup(self):
self.resume_download = False
self.multiDL = self.premium
self.chunk_limit = 1
def handle_premium(self, pyfile):
user, data = self.account.select()
for _i in xrange(5):
#: Try it five times
header = self.load("http://www.free-way.bz/load.php", #@TODO: Revert to `https` in 0.4.10
get={'multiget': 7,
'url' : pyfile.url,
'user' : user,
'pw' : self.account.get_info(self.user)['login']['password'],
'json' : ""},
just_header=True)
if 'location' in header:
headers = self.load(header['location'], just_header=True)
if headers['code'] == 500:
#: Error on 2nd stage
self.log_error(_("Error [stage2]"))
else:
#: Seems to work..
self.download(header['location'])
break
else:
#: Error page first stage
self.log_error(_("Error [stage1]"))
#@TODO: handle errors
getInfo = create_getInfo(FreeWayMe)