forked from mengzonefire/baidupan-rapidupload
-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert.html
123 lines (116 loc) · 5.77 KB
/
convert.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
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no" />
<title>百度网盘秒传链接生成</title>
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/5.0.2/css/bootstrap.min.css" />
<script src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/5.0.2/js/bootstrap.min.js"></script>
<script type="text/javascript">
function atou(str) {
return decodeURIComponent(escape(window.atob(str)));
}
function utoa(str) {
return window.btoa(unescape(encodeURIComponent(str)));
}
function Trim(str) {
return str.replace(/(^\s*)|(\s*$)/g, "");
}
function getLink(link, backcall) {
var bdpan = link.match(/bdpan:\/\/(.+)/);;
var pcs = link.match('BaiduPCS-Go');
var mengji = link.match(/.{32}#.{32}/);
if (bdpan != null) {
var de_b64 = atou(bdpan[1]);
var md5 = de_b64.match(/\|(.{32})\|/)[1];
var slicemd5 = de_b64.match(/\|([^\|]{32})$/)[1];
var file_length = de_b64.match(/\|([0-9]+)\|/)[1];
var file_name = de_b64.match(/^(.+?)\|/)[1];
backcall(md5, slicemd5, file_length, file_name);
}
else if (pcs) {
var input = link;
var length = input.match(/length\=([0-9]+)/)[1];
var md5 = input.match(/\-md5\=(.{32})/)[1];
var slicemd5 = input.match(/\-slicemd5\=(.{32})/)[1];
var file_name = input.match(/\"(.+)\"/)[1];
backcall(md5, slicemd5, length, file_name);
}
else if (mengji) {
var input = link;
var md5 = input.match(/^(.{32})#/)[1];
var slicemd5 = input.match(/#(.{32})#/)[1];
var file_length = input.match(/#([0-9]+)#/)[1];
var file_name = input.match(/#[0-9]+#(.+)$/)[1];
file_name = Trim(file_name);
backcall(md5, slicemd5, file_length, file_name);
}
}
function convertpcs(md5, slicemd5, file_length, file_name) {
return 'BaiduPCS-Go rapidupload -length=' + file_length + ' -md5=' + md5 + ' -slicemd5=' + slicemd5 + ' \"\/' + file_name + '\"';
} function convertpcs(md5, slicemd5, file_length, file_name) {
return 'BaiduPCS-Go rapidupload -length=' + file_length + ' -md5=' + md5 + ' -slicemd5=' + slicemd5 + ' \"\/' + file_name + '\"';
}
function convert() {
document.getElementById('convert').innerHTML = '';
var lines = document.getElementById('link').value.split('\n');
for (var i = 0; i < lines.length; i++) {
//code here using lines[i] which will give you each line
if (document.getElementById('pcs').className == 'btn btn-outline-primary active') {
getLink(lines[i], backcall = function (md5, slicemd5, file_length, file_name) {
document.getElementById('convert').innerHTML += 'BaiduPCS-Go rapidupload -length=' + file_length + ' -md5=' + md5 + ' -slicemd5=' + slicemd5 + ' \"\/' + file_name + '\"' + '\n';
});
}
if (document.getElementById('bdpan').className == 'btn btn-outline-primary active') {
getLink(lines[i], backcall = function (md5, slicemd5, file_length, file_name) {
document.getElementById('convert').innerHTML += 'bdpan://' + utoa(file_name + '\|' + file_length + '\|' + md5 + '\|' + slicemd5) + '\n';
});
}
if (document.getElementById('mengji').className == 'btn btn-outline-primary active') {
getLink(lines[i], backcall = function (md5, slicemd5, file_length, file_name) {
document.getElementById('convert').innerHTML += md5 + '#' + slicemd5 + '#' + file_length + '#' + file_name + '\n';
});
}
}
}
</script>
<style>
</style>
</head>
<body>
<div id="app">
<div id="container" class="container">
<div class="row">
<div class="col-sm-8 offset-sm-2 col-md-6 offset-md-3 text-center">
<h1>百度网盘秒传链接转换</h1>
<p id="version">v0.6 mengzonefire version</p>
<p><b>请先阅读 <a href='./manual.html' target=_blank>使用教程</b></a></br></p>
<p><a href='./index.html'>秒传转存</a> <a href='./multisave.html'>批量转存</a> <a href='./gen.html'>秒传生成</a></p>
</div>
<div class="col-sm-8 offset-sm-2 col-md-6 offset-md-3 text-center">
</div>
<div id="body" class="col-sm-8 offset-sm-2 col-md-6 offset-md-3 text-center">
<div class="form-group">
<label for="link">秒传链接</label>
<p><textarea name="link" id="link" class="form-control" placeholder="需要转换的链接" rows="8"></textarea></p>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-outline-primary active" id="pcs">
<input type="radio" style="display:none;" id="pcs" name="options" checked> BaiduPCS-Go
</label>
<label class="btn btn-outline-primary" id="bdpan">
<input type="radio" style="display:none;" id="bdpan" name="options"> PanDownload
</label>
<label class="btn btn-outline-primary" id="mengji">
<input type="radio" style="display:none;" id="mengji" name="options"> 梦姬
</label>
</div>
<p><button class="btn btn-primary" onclick="convert();">转换</button>
<p><textarea name="convert" id="convert" class="form-control" placeholder="转换后的链接" rows="8"></textarea></p>
</div>
<p><b>所有请求在用户端进行,服务器不保存任何数据</b></p>
</div>
</div>
</div>
</div>
</body>