Repository navigation
Expand file tree
/
Copy pathTenluaVnFolder.py
More file actions
42 lines (30 loc) · 1.56 KB
/
Copy pathTenluaVnFolder.py
File metadata and controls
42 lines (30 loc) · 1.56 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
# -*- coding: utf-8 -*-
from module.network.RequestFactory import getURL as get_url
from ..internal.SimpleCrypter import SimpleCrypter
from ..internal.misc import json
class TenluaVnFolder(SimpleCrypter):
__name__ = "TenluaVnFolder"
__type__ = "crypter"
__version__ = "0.02"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?tenlua\.vn/folder/.+?/(?P<ID>[0-9a-f]+)/'
__config__ = [("activated", "bool", "Activated", True),
("use_premium", "bool", "Use premium account if available", True),
("folder_per_package", "Default;Yes;No", "Create folder for each package", "Default"),
("max_wait", "int", "Reconnect if waiting time is greater than minutes", 10)]
__description__ = """Tenlua.vn decrypter plugin"""
__license__ = "GPLv3"
__authors__ = [("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")]
API_URL = "https://api2.tenlua.vn/"
@classmethod
def api_response(cls, method, **kwargs):
kwargs['a'] = method
return json.loads(get_url(cls.API_URL, post=json.dumps([kwargs])))
def decrypt(self, pyfile):
folder_info = self.api_response("filemanager_gettree", p=self.info['pattern']['ID'], download=1)
pack_links = ["https://www.tenlua.vn/download/%s/%s" % (x['h'], x['ns'])
for x in folder_info[0]['f']
if 'h' in x and 'ns' in x]
pack_name = folder_info[0]['f'][0].get('n') or self.pyfile.package().name
if pack_links:
self.packages.append((pack_name, pack_links, pack_name))