MCPcopy Index your code
hub / github.com/pyload/pyload / enum_folder

Method enum_folder

module/plugins/crypter/FshareVnFolder.py:34–70  ·  view source on GitHub ↗
(self, folder_id)

Source from the content-addressed store, hash-verified

32 URL_REPLACEMENTS = [("http://", "https://")]
33
34 def enum_folder(self, folder_id):
35 links = []
36
37 self.req.http.c.setopt(pycurl.HTTPHEADER, ["Accept: application/json, text/plain, */*"])
38 self.data = self.load("https://www.fshare.vn/api/v3/files/folder",
39 get={'linkcode': folder_id})
40 json_data = json.loads(self.data)
41
42 current_page = 1
43 last_page = int(re.search(r'&page=(\d+)', json_data['_links'].get('last', "&page=1")).group(1))
44
45 while True:
46 folder_items = json_data['items']
47 for item in folder_items:
48 if item['type'] == 1:
49 links.append("https://www.fshare.vn/file/" + item['linkcode'])
50
51 else:
52 if self.config.get('dl_subfolders'):
53 if self.config.get('package_subfolder'):
54 links.append("https://www.fshare.vn/folder/" + item['linkcode'])
55
56 else:
57 links.extend(self.enum_folder(item['linkcode']))
58
59 current_page += 1
60 if current_page > last_page:
61 break
62
63 self.req.http.c.setopt(pycurl.HTTPHEADER, ["Accept: application/json, text/plain, */*"])
64 self.data = self.load("https://www.fshare.vn/api/v3/files/folder",
65 get={'linkcode': folder_id,
66 'page': current_page})
67 json_data = json.loads(self.data)
68
69
70 return links
71
72
73 def decrypt(self, pyfile):

Callers 1

decryptMethod · 0.95

Calls 5

extendMethod · 0.80
loadMethod · 0.45
searchMethod · 0.45
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected