-
Notifications
You must be signed in to change notification settings - Fork 159
/
Copy pathindex.html
258 lines (232 loc) · 7.45 KB
/
index.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Video Parser by 道长</title>
<link rel="icon" href="/public/icon.svg" type="image/x-icon">
<style>
* {
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
background-color: #f4f7fa;
}
.container {
width: 100%;
max-width: 600px;
padding: 30px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
text-align: center;
}
.container h2 {
margin-bottom: 10px;
font-size: 22px;
color: #333;
}
.container p {
font-size: 16px;
color: #666;
margin-bottom: 20px;
}
.input-group {
position: relative;
display: flex;
align-items: center;
margin-bottom: 15px;
}
textarea {
width: 100%;
min-height: 60px;
padding: 12px;
font-size: 16px;
border: 1px solid #ddd;
border-radius: 4px;
outline: none;
resize: none;
line-height: 1.5;
overflow-y: auto;
}
.clear-button {
position: absolute;
bottom: 8px;
right: 8px;
background: #ff6b6b;
border: none;
border-radius: 50%;
width: 24px;
height: 24px;
cursor: pointer;
font-weight: bold;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
transition: background-color 0.3s;
opacity: 0.8;
}
.clear-button:hover {
background-color: #ff4949;
}
.button-group {
display: flex;
justify-content: center;
gap: 10px;
margin-top: 10px;
}
button {
padding: 10px 24px;
font-size: 16px;
color: #fff;
background-color: #007bff;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #0056b3;
}
.example-button {
font-size: 16px;
color: #333;
background-color: #f1f1f1;
border: 1px solid #ddd;
border-radius: 4px;
padding: 10px 20px;
cursor: pointer;
transition: background-color 0.3s;
}
.example-button:hover {
background-color: #e2e2e2;
}
.result {
margin-top: 20px;
padding: 15px;
font-size: 16px;
color: #333;
background-color: #f9f9f9;
border: 1px solid #ddd;
border-radius: 4px;
position: relative;
word-break: break-all;
text-align: left;
}
.copy-button {
position: absolute;
bottom: 8px;
right: 8px;
padding: 6px 12px;
font-size: 14px;
color: #333;
background-color: #e6e6e6;
border: none;
border-radius: 4px;
cursor: pointer;
opacity: 0.8;
}
.copy-button:hover {
background-color: #d4d4d4;
}
</style>
</head>
<body>
<div class="container">
<h2>视频直链解析器 v1.0.2 2024/11/26</h2>
<p>请输入抓包获取的央视网点播视频直链</p>
<div class="input-group">
<textarea id="urlInput" placeholder="输入网页链接"></textarea>
<button class="clear-button" onclick="clearInput()">×</button>
</div>
<div class="button-group">
<button onclick="parseUrl()">解析</button>
<button class="example-button" onclick="fillExample1()">示例地址1</button>
<button class="example-button" onclick="fillExample2()">示例地址2</button>
</div>
<div id="result" class="result" style="display: none;">
<span id="parsedUrl"></span>
<button class="copy-button" onclick="copyToClipboard()">复制</button>
</div>
</div>
<script>
function parseUrl() {
const inputUrl = document.getElementById("urlInput").value.trim();
const resultDiv = document.getElementById("result");
const parsedUrlSpan = document.getElementById("parsedUrl");
if (!inputUrl) {
resultDiv.style.display = 'none';
alert("请输入有效的链接");
return;
}
try {
const baseUrl = `${location.origin}/proxy/央视大全[官]/asp/h5e/hls`;
const regex = /\/asp\/(?:h5e\/)?hls\/(.+)/;
const match = inputUrl.match(regex);
if (match) {
const proxyUrl = `${baseUrl}/${match[1]}`;
parsedUrlSpan.textContent = proxyUrl;
resultDiv.style.display = 'block';
} else {
resultDiv.style.display = 'none';
alert("链接格式无效,请输入包含 /asp/h5e 或 /asp/hls 的链接");
}
} catch (error) {
resultDiv.style.display = 'none';
alert("处理链接时出错,请检查输入格式");
}
}
function copyToClipboard() {
const parsedUrl = document.getElementById("parsedUrl").textContent;
copyText(parsedUrl);
}
function copyText(str) {
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(str).then(() => {
alert("链接已通过第1种方式复制到剪贴板");
}, () => {
alert("复制失败,请手动复制");
});
} else {
let textArea = document.createElement("textarea");
textArea.value = str;
textArea.style.position = "absolute";
textArea.style.opacity = 0;
textArea.style.left = "-999999px";
textArea.style.top = "-999999px";
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
let res = new Promise((res, rej) => {
res(() => {
document.execCommand('copy');
textArea.remove();
});
rej(false);
});
res.then((res) => {
res();
alert("链接已通过第2种方式复制到剪贴板");
})
}
}
function fillExample1() {
document.getElementById("urlInput").value = "https://dh5.cntv.myalicdn.com/asp/h5e/hls/2000/0303000a/3/default/7048673ae21f4929a30701318754497b/2000.m3u8";
}
function fillExample2() {
document.getElementById("urlInput").value = "https://hls09.cntv.myhwcdn.cn/asp/hls/2000/0303000a/3/default/d9b0eaa065934f25abd193d391f731b6/2000.m3u8";
}
function clearInput() {
document.getElementById("urlInput").value = "";
document.getElementById("result").style.display = "none";
}
</script>
</body>
</html>