-
Notifications
You must be signed in to change notification settings - Fork 1
/
gofile_dl.py
65 lines (54 loc) · 1.57 KB
/
gofile_dl.py
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
57
58
59
60
61
62
63
64
65
import requests
import hashlib
# gofile url
url = ''
# optional
password = ''
# =================================
def gofile_dl(url):
api_uri = 'https://api.gofile.io'
client = requests.Session()
res = client.get(api_uri+'/createAccount').json()
data = {
'contentId': url.split('/')[-1],
'token': res['data']['token'],
'websiteToken': '12345',
'cache': 'true',
'password': hashlib.sha256(password.encode('utf-8')).hexdigest()
}
res = client.get(api_uri+'/getContent', params=data).json()
content = []
for item in res['data']['contents'].values():
content.append(item)
return {
'accountToken': data['token'],
'files': content
}
# =================================
print(gofile_dl(url))
# =================================
'''
SAMPLE OUTPUT:
{
accountToken: 'xxxxx' (to be used as a cookie if ddl doesn't work)
files: [
{
'id': 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
'type': 'file',
'name': 'XXX',
'parentFolder': 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
'createTime': 1837708755,
'size': 11851111419,
'downloadCount': 442,
'md5': '509d4472ea7e00000000000000008bd3',
'mimetype': 'application/vnd.rar',
'serverChoosen': 'store1',
'directLink': 'https://store1.gofile.io/download/XYZ',
'link': 'https://store1.gofile.io/download/XYZ'
},
{
# more objects for multi-files
}
]
}
'''