-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathlibvio.html
More file actions
757 lines (668 loc) · 24.8 KB
/
Copy pathlibvio.html
File metadata and controls
757 lines (668 loc) · 24.8 KB
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>LIBVIO WebHome</title>
<style>
:root {
--panel-rgb: 30, 30, 30;
--panel: rgba(var(--panel-rgb), .75);
--panel-soft: rgba(var(--panel-rgb), .55);
--panel-strong: rgba(var(--panel-rgb), .95);
--line: rgba(255, 255, 255, .15);
--text-main: #e5e5e5;
--text-sub: #999999;
--accent: #f5c518;
--bg-fallback: #0b0b0b;
}
html, body {
margin: 0;
padding: 0;
min-height: 100%;
background: transparent;
color: var(--text-main);
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
html:not(.fm-native), html:not(.fm-native) body {
background: var(--bg-fallback);
}
.focusable:focus {
outline: 3px solid var(--accent);
outline-offset: -2px;
transform: scale(1.02);
z-index: 5;
transition: transform 0.2s ease, outline 0.2s ease;
}
.container {
display: flex;
flex-direction: column;
min-height: 100vh;
padding: 20px;
box-sizing: border-box;
}
body.detail-active .container {
visibility: hidden;
pointer-events: none;
}
.header {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 15px;
margin-bottom: 20px;
padding: 10px;
background: var(--panel-soft);
border-radius: 8px;
border: 1px solid var(--line);
}
.logo {
font-size: 22px;
font-weight: bold;
color: var(--accent);
text-transform: uppercase;
letter-spacing: 1px;
}
.nav-tabs {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.nav-tab {
background: rgba(255, 255, 255, 0.05);
color: var(--text-main);
border: 1px solid var(--line);
padding: 8px 16px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
}
.nav-tab.active {
background: var(--accent);
color: #000;
font-weight: bold;
border-color: var(--accent);
}
.search-bar {
display: flex;
gap: 6px;
}
.search-input {
background: rgba(0, 0, 0, 0.4);
color: var(--text-main);
border: 1px solid var(--line);
padding: 8px 12px;
border-radius: 6px;
width: 180px;
font-size: 14px;
}
.search-btn {
background: rgba(255, 255, 255, 0.1);
color: var(--text-main);
border: 1px solid var(--line);
padding: 8px 16px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
}
.vod-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
gap: 16px;
flex: 1;
}
.vod-card {
background: var(--panel-soft);
border-radius: 6px;
overflow: hidden;
border: 1px solid var(--line);
cursor: pointer;
display: flex;
flex-direction: column;
position: relative;
text-decoration: none;
color: inherit;
}
.vod-thumb-box {
position: relative;
width: 100%;
padding-top: 140%;
background: rgba(0,0,0,0.2);
}
.vod-thumb {
position: absolute;
top: 0; left: 0;
width: 100%; height: 100%;
object-fit: cover;
}
.vod-tag {
position: absolute;
top: 6px;
right: 6px;
background: var(--accent);
color: #000;
font-size: 11px;
font-weight: bold;
padding: 2px 5px;
border-radius: 4px;
}
.vod-remarks {
position: absolute;
bottom: 6px;
right: 6px;
background: rgba(0, 0, 0, 0.75);
color: #fff;
font-size: 11px;
padding: 2px 5px;
border-radius: 4px;
}
.vod-title {
padding: 8px;
font-size: 13px;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.pagination {
display: flex;
justify-content: center;
align-items: center;
gap: 15px;
margin-top: 25px;
padding: 10px 0;
}
.page-btn {
background: var(--panel-soft);
color: var(--text-main);
border: 1px solid var(--line);
padding: 8px 20px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
}
.page-text {
font-size: 14px;
color: var(--text-sub);
}
.layer-sheet {
position: fixed;
inset: 0;
background: transparent;
z-index: 1000;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
box-sizing: border-box;
}
.sheet-body {
background: var(--panel-strong);
backdrop-filter: blur(15px);
-webkit-backdrop-filter: blur(15px);
border: 1px solid var(--line);
border-radius: 10px;
width: 100%;
max-width: 860px;
max-height: 90vh;
overflow-y: auto;
padding: 20px;
box-shadow: 0 12px 30px rgba(0,0,0,0.6);
display: flex;
flex-direction: column;
gap: 18px;
}
.sheet-main {
display: flex;
gap: 20px;
}
.sheet-poster {
width: 140px;
height: 196px;
object-fit: cover;
border-radius: 6px;
border: 1px solid var(--line);
flex-shrink: 0;
}
.sheet-details {
flex: 1;
display: flex;
flex-direction: column;
gap: 8px;
}
.sheet-title-row {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 15px;
}
.sheet-title {
font-size: 22px;
font-weight: bold;
color: var(--accent);
margin: 0;
}
.sheet-close {
background: rgba(255, 255, 255, 0.1);
color: var(--text-main);
border: 1px solid var(--line);
padding: 6px 14px;
border-radius: 6px;
cursor: pointer;
font-size: 13px;
}
.sheet-desc {
font-size: 13px;
color: var(--text-sub);
line-height: 1.6;
max-height: 110px;
overflow-y: auto;
}
.part-title {
font-size: 14px;
font-weight: bold;
color: #fff;
border-left: 3px solid var(--accent);
padding-left: 8px;
margin-bottom: 10px;
}
.episode-grid {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 15px;
}
.episode-item {
background: rgba(255, 255, 255, 0.06);
color: var(--text-main);
border: 1px solid var(--line);
padding: 8px 14px;
border-radius: 4px;
cursor: pointer;
font-size: 13px;
text-align: center;
min-width: 60px;
}
.disk-item {
display: flex;
align-items: center;
justify-content: space-between;
background: rgba(255, 255, 255, 0.04);
border: 1px solid var(--line);
padding: 10px 14px;
border-radius: 6px;
margin-bottom: 8px;
cursor: pointer;
}
.disk-info {
display: flex;
align-items: center;
gap: 10px;
}
.disk-status {
width: 8px;
height: 8px;
border-radius: 50%;
background: #777;
}
.disk-status.ok { background: #2ecc71; box-shadow: 0 0 6px #2ecc71; }
.disk-status.bad { background: #e74c3c; }
.disk-status.locked { background: #f1c40f; }
.status-msg {
text-align: center;
padding: 40px;
color: var(--text-sub);
font-size: 14px;
}
</style>
</head>
<body>
<div class="container" id="mainContainer">
<div class="header">
<div class="logo">LIBVIO</div>
<div class="nav-tabs" id="categoryBox">
<div class="nav-tab focusable active" data-id="home">首页</div>
<div class="nav-tab focusable" data-id="1">电影</div>
<div class="nav-tab focusable" data-id="2">剧集</div>
<div class="nav-tab focusable" data-id="4">番剧</div>
<div class="nav-tab focusable" data-id="15">日韩</div>
<div class="nav-tab focusable" data-id="16">欧美</div>
</div>
<div class="search-bar">
<input type="text" id="keywords" class="search-input focusable" placeholder="输入关键字...">
<button id="searchButton" class="search-btn focusable">搜索</button>
</div>
</div>
<div class="vod-grid" id="vodGrid"></div>
<div class="pagination" id="pageBox">
<button id="btnPrev" class="page-btn focusable">上一页</button>
<span id="txtPage" class="page-text">第 1 页</span>
<button id="btnNext" class="page-btn focusable">下一页</button>
</div>
</div>
<div class="layer-sheet" id="detailSheet" style="display: none;">
<div class="sheet-body">
<div class="sheet-main">
<img id="detailImg" class="sheet-poster" src="" alt="">
<div class="sheet-details">
<div class="sheet-title-row">
<h2 id="sheetTitle" class="sheet-title"></h2>
<button class="sheet-close focusable" id="btnCloseSheet">返回</button>
</div>
<div id="sheetDesc" class="sheet-desc"></div>
</div>
</div>
<div id="sourceContainer"></div>
</div>
</div>
<script>
const HOST = 'https://www.libvio.run';
let currentType = 'home';
let currentIdx = 1;
let queryWord = '';
let preFocusNode = null;
function verifySdk() {
if (window.fongmiBridge || window.fm || window.fongmi) {
document.documentElement.classList.add("fm-native");
}
}
window.addEventListener("fmsdk", verifySdk);
document.addEventListener("DOMContentLoaded", () => {
verifySdk();
requestList();
});
async function loadHtml(uri) {
const url = uri.startsWith('http') ? uri : HOST + uri;
if (window.fm && window.fm.req) {
const resp = await fm.req(url, { method: 'GET', responseType: 'text', timeout: 12 });
if (!resp.ok) throw new Error(`Status ${resp.status}`);
return resp.body;
}
const resp = await fetch(url);
return await resp.text();
}
function safeImg(url) {
if (!url) return '';
if (url.startsWith('//')) url = 'https:' + url;
if (window.fm && window.fm.res) {
return fm.res(url, { headers: { 'Referer': HOST } });
}
return url;
}
function parseVods(html) {
const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');
const items = [];
const blocks = doc.querySelectorAll('.stui-vodlist__box');
blocks.forEach(b => {
const node = b.querySelector('a.stui-vodlist__thumb');
if (node) {
let img = node.getAttribute('data-original') || node.getAttribute('style') || '';
if (img.includes('url(')) {
const match = img.match(/url\(['"]?(.*?)['"]?\)/);
if (match) img = match[1];
}
const score = b.querySelector('.pic-tag-top');
const remark = b.querySelector('.pic-text');
items.push({
title: node.getAttribute('title') || b.querySelector('.title a')?.innerText || '',
href: node.getAttribute('href'),
pic: img,
tag: score ? score.innerText.trim() : '',
note: remark ? remark.innerText.trim() : ''
});
}
});
return items;
}
function parseMeta(html) {
const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');
const title = doc.querySelector('h1.title')?.innerText || '';
const poster = doc.querySelector('.vod-poster img')?.getAttribute('data-original') || '';
const desc = doc.querySelector('.vod-desc .detail-sketch')?.innerText || '';
const lines = [];
const clouds = [];
doc.querySelectorAll('.playlist-panel:not(.netdisk-panel)').forEach(p => {
const label = p.querySelector('h3')?.innerText || '播放播放';
const eps = [];
p.querySelectorAll('.stui-content__playlist li a').forEach(a => {
eps.push({ name: a.innerText.trim(), href: a.getAttribute('href') });
});
if (eps.length > 0) lines.push({ name: label, data: eps });
});
doc.querySelectorAll('.netdisk-panel .netdisk-item').forEach(p => {
const tag = p.querySelector('.netdisk-name')?.innerText || '网盘下载';
const link = p.getAttribute('href');
if (link) {
let type = 'http';
if (link.includes('quark.cn')) type = 'quark';
else if (link.includes('uc.cn')) type = 'uc';
else if (link.includes('aliyun.com')) type = 'aliyun';
else if (link.includes('baidu.com')) type = 'baidu';
clouds.push({ name: tag, url: link, type: type });
}
});
return { title, poster, desc, lines, clouds };
}
function parseMediaLink(html) {
const match = html.match(/var player_aaaa\s*=\s*(\{.*?\})/);
if (match && match[1]) {
try {
const config = JSON.parse(match[1]);
return config.url || '';
} catch (e) {}
}
return '';
}
async function requestList() {
const grid = document.getElementById('vodGrid');
grid.innerHTML = '<div class="status-msg">数据加载中...</div>';
let path = '/';
if (currentType === 'search') {
path = `/search/-------------.html?wd=${encodeURIComponent(queryWord)}`;
document.getElementById('pageBox').style.display = 'none';
} else if (currentType === 'home') {
path = '/';
document.getElementById('pageBox').style.display = 'none';
} else {
path = `/type/${currentType}-${currentIdx}.html`;
document.getElementById('pageBox').style.display = 'flex';
document.getElementById('txtPage').innerText = `第 ${currentIdx} 页`;
}
try {
const html = await loadHtml(path);
const items = parseVods(html);
renderGrid(items);
} catch (e) {
grid.innerHTML = `<div class="status-msg">数据加载失败: ${e.message}</div>`;
}
}
function renderGrid(items) {
const grid = document.getElementById('vodGrid');
grid.innerHTML = '';
if (items.length === 0) {
grid.innerHTML = '<div class="status-msg">未找到相关资源</div>';
return;
}
items.forEach(item => {
const card = document.createElement('div');
card.className = 'vod-card focusable';
card.tabIndex = 0;
let html = `<div class="vod-thumb-box"><img class="vod-thumb" src="${safeImg(item.pic)}" loading="lazy">`;
if (item.tag && item.tag !== '0.0') html += `<div class="vod-tag">${item.tag}</div>`;
if (item.note) html += `<div class="vod-remarks">${item.note}</div>`;
html += `</div><div class="vod-title">${item.title}</div>`;
card.innerHTML = html;
card.onclick = () => openDetails(item.href);
card.addEventListener('keydown', (e) => {
if (e.key === 'Enter') openDetails(item.href);
});
grid.appendChild(card);
});
}
async function openDetails(url) {
preFocusNode = document.activeElement;
document.body.classList.add('detail-active');
const sheet = document.getElementById('detailSheet');
sheet.style.display = 'flex';
const title = document.getElementById('sheetTitle');
const desc = document.getElementById('sheetDesc');
const img = document.getElementById('detailImg');
const box = document.getElementById('sourceContainer');
title.innerText = '资源读取中...';
desc.innerText = '';
img.src = '';
box.innerHTML = '<div class="status-msg">详情加载中...</div>';
document.getElementById('btnCloseSheet').focus();
try {
const html = await loadHtml(url);
const meta = parseMeta(html);
title.innerText = meta.title;
desc.innerText = meta.desc;
img.src = safeImg(meta.poster);
box.innerHTML = '';
if (meta.clouds.length > 0) {
const part = document.createElement('div');
part.className = 'play-group';
part.innerHTML = `<div class="part-title">网盘下载</div>`;
const list = document.createElement('div');
meta.clouds.forEach(c => {
const item = document.createElement('div');
item.className = 'disk-item focusable';
item.tabIndex = 0;
item.innerHTML = `<div class="disk-info"><div class="disk-status" id="pan_${btoa(c.url).replace(/=/g,'')}"></div><span>${c.name} [${c.type.toUpperCase()}]</span></div>`;
const triggerPlay = () => {
if (window.fm && window.fm.pan && window.fm.pan.play) {
fm.pan.play({ type: c.type, url: c.url, title: meta.title });
} else {
window.open(c.url);
}
};
item.onclick = triggerPlay;
item.addEventListener('keydown', (e) => { if (e.key === 'Enter') triggerPlay(); });
list.appendChild(item);
});
part.appendChild(list);
box.appendChild(part);
triggerPanCheck(meta.clouds);
}
meta.lines.forEach(line => {
const part = document.createElement('div');
part.className = 'play-group';
part.innerHTML = `<div class="part-title">${line.name}</div>`;
const list = document.createElement('div');
list.className = 'episode-grid';
line.data.forEach(ep => {
const item = document.createElement('div');
item.className = 'episode-item focusable';
item.tabIndex = 0;
item.innerText = ep.name;
const startPlay = async () => {
const originalText = item.innerText;
item.innerText = '解析中...';
try {
const phtml = await loadHtml(ep.href);
const streamUrl = parseMediaLink(phtml);
item.innerText = originalText;
if (streamUrl) {
if (window.fm && window.fm.play) {
fm.play(streamUrl, `${meta.title} - ${ep.name}`, {
headers: {
'Referer': HOST + '/',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
}
});
} else {
alert(`解析直链成功:\n${streamUrl}`);
}
} else {
alert('未找到有效的媒体播放直链');
}
} catch (err) {
item.innerText = originalText;
}
};
item.onclick = startPlay;
item.addEventListener('keydown', (e) => { if (e.key === 'Enter') startPlay(); });
list.appendChild(item);
});
part.appendChild(list);
box.appendChild(part);
});
} catch (e) {
box.innerHTML = `<div class="status-msg">详情加载失败: ${e.message}</div>`;
}
}
function closeDetails() {
document.body.classList.remove('detail-active');
document.getElementById('detailSheet').style.display = 'none';
if (preFocusNode) {
preFocusNode.focus({ preventScroll: true });
preFocusNode.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
}
document.getElementById('btnCloseSheet').onclick = closeDetails;
async function triggerPanCheck(clouds) {
if (!window.fm || !window.fm.config || !window.fm.pan || !window.fm.pan.check) return;
try {
const conf = await fm.config();
if (!conf.driveCheck) return;
const targets = clouds.map(c => ({ type: c.type, url: c.url, password: "" }))
.filter(t => ['quark', 'uc', 'aliyun', 'baidu'].includes(t.type));
if (targets.length === 0) return;
const resp = await fm.pan.check(targets);
if (resp && resp.results) {
resp.results.forEach(r => {
const dot = document.getElementById(`pan_${btoa(r.url).replace(/=/g,'')}`);
if (dot) dot.className = `disk-status ${r.state}`;
});
}
} catch (e) {}
}
document.querySelectorAll('.nav-tab').forEach(tab => {
tab.addEventListener('click', (e) => {
document.querySelectorAll('.nav-tab').forEach(t => t.classList.remove('active'));
e.target.classList.add('active');
currentType = e.target.getAttribute('data-id');
currentIdx = 1;
requestList();
});
});
document.getElementById('btnPrev').onclick = () => {
if (currentIdx > 1) {
currentIdx--;
requestList();
}
};
document.getElementById('btnNext').onclick = () => {
currentIdx++;
requestList();
};
function startSearch() {
const val = document.getElementById('keywords').value.trim();
if (!val) return;
queryWord = val;
currentType = 'search';
document.querySelectorAll('.nav-tab').forEach(t => t.classList.remove('active'));
requestList();
}
document.getElementById('searchButton').onclick = startSearch;
document.getElementById('keywords').addEventListener('keydown', (e) => {
if (e.key === 'Enter') startSearch();
});
window.addEventListener('keydown', (e) => {
if (e.key === 'Escape' || e.key === 'Backspace' || e.keyCode === 27 || e.keyCode === 8) {
if (document.body.classList.contains('detail-active')) {
closeDetails();
e.preventDefault();
e.stopImmediatePropagation();
} else if (window.fm && window.fm.back) {
fm.back();
}
}
});
</script>
</body>
</html>