-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathctfile.html
140 lines (133 loc) · 5.83 KB
/
ctfile.html
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!DOCTYPE html>
<html>
<title>城通网盘解析器</title>
<head>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script>
</script>
<link href="https://npm.elemecdn.com/[email protected]/dist/material-components-web.min.css"
rel="stylesheet">
<script
src="https://npm.elemecdn.com/[email protected]/dist/material-components-web.min.js"></script>
</head>
<body>
<H2>请输入链接和密码(可选)</H2>
<H4>下载地址有一定有效期,不可用于分享</H4>
<label style="width:100%;" class="mdc-text-field mdc-text-field--outlined" data-mdc-auto-init="MDCTextField">
<input id="link" class="mdc-text-field__input" aria-labelledby="my-label-id">
<span class="mdc-notched-outline">
<span class="mdc-notched-outline__leading"></span>
<span class="mdc-notched-outline__notch">
<span class="mdc-floating-label" id="my-label-id">分享链接</span>
</span>
<span class="mdc-notched-outline__trailing"></span>
</span>
</label>
<br>
<br>
<label style="width:100%;" class="mdc-text-field mdc-text-field--outlined" data-mdc-auto-init="MDCTextField">
<input id="passcode" class="mdc-text-field__input" aria-labelledby="my-label-id">
<span class="mdc-notched-outline">
<span class="mdc-notched-outline__leading"></span>
<span class="mdc-notched-outline__notch">
<span class="mdc-floating-label" id="my-label-id">密码(留空则使用默认密码)</span>
</span>
<span class="mdc-notched-outline__trailing"></span>
</span>
</label>
<br>
<br>
<button onclick="getInfo();" class="mdc-button foo-button1">
<div class="mdc-button__ripple"></div>
<span class="mdc-button__label">获取下载地址</span>
</button>
<br>
<H4 id="filename"></H4>
<H4 id="filesize"></H4>
<H4 id="filetime"></H4>
<p id="dlURL"></p>
<button onclick="dlFile();" id="dlbtn" style="display:none;" class="mdc-button foo-button2">
<div class="mdc-button__ripple"></div>
<span class="mdc-button__label">下载文件</span>
</button>
<script>
var link;
var fileid;
var jsonurl;
var passcodeArgu="";
var jsonText;
var jsonText2;
var xhr;
var dlURL;
var getInfo = function () {
link = document.getElementById("link").value;
fileid = link.slice(link.indexOf("/f/") + 3);
xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
jsonText = JSON.parse(xhr.responseText);
if(jsonText.code==200){
document.getElementById("filename").innerText = "文件名称:" + jsonText.file_name;
document.getElementById("filesize").innerText = "文件大小:" + jsonText.file_size;
document.getElementById("filetime").innerText = "文件时间:" + jsonText.file_time;
document.getElementById("dlURL").innerText = "正在获取下载地址...";
getURL();
}else{
document.getElementById("filename").innerText = "文件请求失败,请检查地址";
}
}
};
if (document.getElementById("passcode").value) {
passcodeArgu = "&passcode=" + document.getElementById("passcode").value;
}else{
passcodeArgu = "&passcode=547873715"
}
jsonurl = "https://webapi.ctfile.com/getfile.php?path=f&f=" + fileid + passcodeArgu + "&token=false&r=" + Math.random() + "&ref=https://ctfile.qinlili.bid"
xhr.open('get', jsonurl);
//xhr.setRequestHeader('X-Referer', link);
xhr.send(null);
}
var getURL = function () {
jsonurl = "https://webapi.ctfile.com/get_file_url.php?uid=" + jsonText.userid + "&fid=" + jsonText.file_id + "&file_chk=" + jsonText.file_chk + "&app=0&acheck=2&rd=" + Math.random()
xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
jsonText2 = JSON.parse(xhr.responseText);
dlURL = jsonText2.downurl;
document.getElementById("dlURL").innerText = "下载地址:" + dlURL;
document.getElementById("dlbtn").style.display = "block";
}
};
xhr.open('get', jsonurl);
xhr.send(null);
}
var dlFile = function () {
funDownload(dlURL, jsonText.file_name);
}
</script>
<script>
window.mdc.autoInit();
mdc.ripple.MDCRipple.attachTo(document.querySelector('.foo-button1'));
mdc.ripple.MDCRipple.attachTo(document.querySelector('.foo-button2'));
var getRandomColor = function () {
return '#' + (function (color) {
return (color += 'abcdef'[Math.floor(Math.random() * 6)])
&& (color.length == 6) ? color : arguments.callee(color);
})('');
}
function strip(num, precision = 10) {
return +parseFloat(num.toPrecision(precision));
}
function funDownload(content, filename) {
var eleLink = document.createElement('a');
eleLink.download = filename;
eleLink.style.display = 'none';
eleLink.href = content;
document.body.appendChild(eleLink);
eleLink.click();
document.body.removeChild(eleLink);
};
</script>
</body>
</html>