-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path6v.html
More file actions
764 lines (717 loc) · 36.5 KB
/
Copy path6v.html
File metadata and controls
764 lines (717 loc) · 36.5 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
758
759
760
761
762
763
764
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<title>6v影视 · 高清在线(多源推送版)</title>
<style>
:root{--panel-rgb:42,50,58;--panel:rgba(var(--panel-rgb),.62);--panel-soft:rgba(var(--panel-rgb),.44);--panel-strong:rgba(var(--panel-rgb),.86);--line:rgba(255,255,255,.16);--text:#f7fbff;--muted:rgba(247,251,255,.68);--accent:#ff6b35;--accent2:#ffb86b;--bad:#ff5c7a;--ok:#68e39a;--radius:18px;--shadow:0 18px 50px rgba(0,0,0,.28)}
*{box-sizing:border-box} html,body{margin:0;min-height:100%;background:transparent;color:var(--text);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",Arial,sans-serif} html:not(.fm-native),html:not(.fm-native) body{background:#222a32}.app{min-height:100vh;background:transparent;padding:10px 10px 28px}
.top{position:relative;z-index:1;background:rgba(var(--panel-rgb),0.75);border-radius:20px;padding:24px 16px;margin:10px auto 20px;max-width:800px;display:flex;flex-direction:column;align-items:center;gap:16px;box-shadow:var(--shadow)}
.bar{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:16px;width:100%}
.brand{font-size:28px;font-weight:900;letter-spacing:2px;text-shadow:0 4px 14px rgba(0,0,0,.35);white-space:nowrap}
.brand b{color:var(--accent2)}
.search{flex:1;width:100%;max-width:500px;display:flex;gap:8px;align-items:center;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);border-radius:999px;padding:6px 6px 6px 18px;box-shadow:inset 0 1px 0 rgba(255,255,255,.05)}
.search input{flex:1;min-width:0;background:transparent;border:0;outline:0;color:var(--text);font-size:15px}
.search input::placeholder{color:var(--muted)}
button,.btn{border:1px solid var(--line);background:var(--panel-soft);color:var(--text);border-radius:999px;padding:8px 16px;font-size:14px;cursor:pointer;white-space:nowrap}
.btn.primary,button.primary{border-color:rgba(255,107,53,.45);background:linear-gradient(135deg,rgba(255,107,53,.90),rgba(255,184,107,.72));color:#17110d;font-weight:800;padding:10px 20px}
.tabs{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;width:100%;padding:0}
.tab{border-radius:999px;padding:8px 18px;font-size:15px;background:rgba(255,255,255,.08);border:2px solid transparent;color:var(--muted);transition:all 0.2s}
.tab.active{background:transparent;color:var(--text);border-color:rgba(255,184,107,0.8);font-weight:800}
.hero{margin:10px 0 16px;padding:18px;border-radius:var(--radius);background:linear-gradient(135deg,rgba(255,107,53,.28),rgba(42,50,58,.54));border:1px solid var(--line);box-shadow:var(--shadow)}
.hero h1{margin:0 0 8px;font-size:24px}
.hero p{margin:0;color:var(--muted);line-height:1.6}
.status{margin:10px 2px;color:var(--muted);font-size:14px;text-align:center}
.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.card{position:relative;min-width:0;border-radius:15px;overflow:hidden;background:linear-gradient(180deg,rgba(255,255,255,.09),rgba(255,255,255,.045));border:1px solid rgba(255,255,255,.12);box-shadow:0 10px 28px rgba(0,0,0,.22);cursor:pointer;transition:transform 0.2s}
.poster{aspect-ratio:3/4;background:rgba(255,255,255,.08);overflow:hidden;position:relative;padding-bottom:133.33%}
.poster img{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover;display:block;filter:saturate(1.04) contrast(1.03)}
.poster .noimg{position:absolute;top:0;left:0;height:100%;width:100%;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:28px}
.meta{padding:8px 8px 10px;background:linear-gradient(180deg,rgba(18,24,30,.15),rgba(18,24,30,.44))}
.name{font-weight:800;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.remark{margin-top:4px;color:var(--muted);font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.section{margin:16px 0}
.section-title{display:flex;align-items:center;justify-content:space-between;margin:0 2px 10px}
.section-title h2{margin:0;font-size:17px;letter-spacing:.3px}
.sheet{position:fixed;top:0;right:0;bottom:0;left:0;z-index:40;display:none;background:transparent;overflow:hidden;width:100%;height:100%}
.sheet.active{display:block}
.sheet-inner{height:100vh;min-height:100vh;padding:12px;background:transparent;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;touch-action:pan-y}
.detail-panel{background:var(--panel);border:1px solid var(--line);border-radius:22px;box-shadow:var(--shadow);padding:14px;margin-bottom:42px;touch-action:pan-y}
.detail-head{display:grid;grid-template-columns:118px 1fr;gap:14px}
.detail-pic{width:118px;height:157px;border-radius:14px;object-fit:cover;background:rgba(255,255,255,.08)}
.detail-title{font-size:22px;font-weight:900;margin:2px 0 8px}
.detail-info{color:var(--muted);line-height:1.65;font-size:14px;min-width:0}
.desc{margin-top:12px;color:rgba(255,255,255,.82);line-height:1.72;max-height:8.6em;overflow:auto}
.line-tabs{display:flex;gap:8px;overflow-x:auto;margin:12px 0 8px;padding-bottom:2px}
.line-tab{border-radius:999px;padding:8px 12px;background:rgba(255,255,255,.08);border:1px solid var(--line);white-space:nowrap}
.line-tab.active{background:rgba(255,107,53,.36);border-color:rgba(255,184,107,.55);font-weight:800}
.episodes{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px;max-height:none;overflow:visible;touch-action:pan-y}
.ep{border-radius:12px;padding:9px 11px;background:rgba(255,255,255,.09);border:1px solid var(--line);cursor:pointer;min-width:68px}
.empty{padding:30px 18px;text-align:center;color:var(--muted);background:var(--panel-soft);border:1px dashed var(--line);border-radius:var(--radius)}
.loading{opacity:.75}
.focusable:focus,.card:focus,.rank-item:focus,.ep:focus,button:focus,.tab:focus,input:focus{outline:2px solid rgba(255,184,107,.76);outline-offset:2px;transform:translateY(-1px)}
html.tv-mode .focusable:focus,html.tv-mode .card:focus,html.tv-mode .ep:focus,html.tv-mode button:focus,html.tv-mode .tab:focus{
outline:4px solid var(--accent2) !important;outline-offset:4px !important;
transform:scale(1.05);box-shadow:0 0 20px rgba(255,184,107,.35);
z-index:10;position:relative}
html.tv-mode .card:focus .poster img{transform:scale(1.08)}
html.tv-mode .grid{gap:14px}
html.tv-mode .name{font-size:18px}
html.tv-mode .tab{padding:10px 24px;font-size:17px}
html.tv-mode .ep{padding:12px 18px;font-size:16px;min-width:80px}
html.tv-mode .brand{font-size:34px}
html.tv-mode .search input{font-size:18px}
body.detail-active .app{visibility:hidden;pointer-events:none}
@media (min-width:768px) and (orientation:landscape){.app{padding:18px 28px 44px;max-width:1380px;margin:0 auto}.top{padding:40px;margin:30px auto;border-radius:32px;gap:24px;max-width:900px}.bar{flex-direction:row;gap:24px}.brand{font-size:36px}.search{padding:8px 8px 8px 24px;max-width:650px}.search input{font-size:18px}.btn.primary,button.primary{padding:12px 28px;font-size:16px}.tabs{gap:14px;max-width:700px}.tab{padding:10px 24px;font-size:16px}.grid{grid-template-columns:repeat(6,minmax(0,1fr));gap:16px}.detail-head{grid-template-columns:160px 1fr}.detail-pic{width:160px;height:213px}.focusable:focus,.card:focus,.ep:focus,button:focus,.tab:focus,input:focus{transform:scale(1.05);outline:4px solid #ffb86b;outline-offset:4px}}
@media (min-width:1200px) and (orientation:landscape){.grid{grid-template-columns:repeat(8,minmax(0,1fr))}}
@media (max-width:480px),(orientation:portrait){.app{padding:8px 9px 24px}.top{padding:20px 12px;margin:10px auto;border-radius:20px;gap:16px}.bar{flex-direction:row;gap:10px}.brand{font-size:22px}.search{padding:4px 4px 4px 14px}.search input{font-size:14px}.btn.primary,button.primary{padding:8px 16px;font-size:14px}.tabs{gap:8px}.tab{padding:8px 14px;font-size:14px}.grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}.meta{padding:7px 7px 9px}.name{font-size:13px}.remark{font-size:11px}.detail-head{grid-template-columns:104px 1fr;gap:12px}.detail-pic{width:104px;height:138px}.detail-title{font-size:20px}.sheet-inner{padding:10px}.detail-panel{border-radius:20px;padding:12px}.ep{min-width:64px;padding:8px 9px}}
</style>
</head>
<body>
<div class="app" id="app">
<div class="top">
<div class="bar">
<div class="brand">6v<b>影视</b></div>
<form class="search" id="searchForm">
<input id="kw" class="focusable" type="text" placeholder="搜索影片、电视剧…" autocomplete="off">
<button class="primary focusable" type="submit">搜索</button>
</form>
</div>
<div class="tabs" id="tabs"></div>
</div>
<div class="status" id="status">准备加载…</div>
<main id="content"></main>
</div>
<div class="sheet" id="detailSheet"><div class="sheet-inner"><div class="detail-panel" id="detailPanel"></div></div></div>
<script>
(function(){
'use strict';
const BASE = 'https://www.xb6v.org';
const CATS = [
['首页', '/'],
['喜剧片', '/xijupian/'],
['动作片', '/dongzuopian/'],
['爱情片', '/aiqingpian/'],
['科幻片', '/kehuanpian/'],
['恐怖片', '/kongbupian/'],
['剧情片', '/juqingpian/'],
['战争片', '/zhanzhengpian/'],
['纪录片', '/jilupian/'],
['动画片', '/donghuapian/'],
['电视剧', '/dianshiju/'],
['综艺', '/ZongYi/']
];
const UA = 'Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 Chrome/120 Mobile Safari/537.36';
let fmReady = false;
let currentUrl = BASE + '/';
let lastFocus = null;
let lastSearchKeyword = '';
// 下滑加载相关变量
let isLoadingMore = false;
let hasMore = true;
let nextPageUrl = null;
const $ = s => document.querySelector(s);
const content = $('#content');
const statusEl = $('#status');
const tabsDiv = $('#tabs');
// ===================== 多集推送 (增强 剧集+多线路 原生推送) =====================
async function smartVodPush(detailObj, currentLineIdx, currentEpName, currentEpUrl) {
if (!window.fm || typeof window.fm.vodInline !== 'function') return false;
try {
const allLines = detailObj.lines || [];
if (allLines.length === 0) return false;
const fromArray = [];
const urlArray = [];
for (let ln of allLines) {
fromArray.push(ln.name);
const epPairs = ln.eps.map(ep => {
let epPlayUrl = ep.isDownload ? ep.href : 'video://' + ep.href;
if (ep.isDownload && ep.href.startsWith('magnet:')) epPlayUrl = ep.href;
if (ep.isDownload && !ep.href.startsWith('http') && !ep.href.startsWith('magnet:')) epPlayUrl = 'push://' + ep.href;
return ep.title + '$' + epPlayUrl;
});
urlArray.push(epPairs.join('#'));
}
const currentPlayUrl = currentEpUrl && (currentEpUrl.startsWith('http') ? 'video://' + currentEpUrl : currentEpUrl);
const vodData = {
vod_id: detailObj.detailUrl || '',
vod_name: detailObj.title,
vod_pic: detailObj.image || '',
vod_play_from: fromArray.join('$$$'),
vod_play_url: urlArray.join('$$$'),
play_from: allLines[currentLineIdx]?.name || '',
mark: currentEpName || '',
url: currentPlayUrl || '',
episodes: allLines[currentLineIdx]?.eps.map(e => ({ name: e.title, url: e.isDownload ? e.href : 'video://' + e.href })) || []
};
await window.fm.vodInline(vodData);
return true;
} catch(e) {
console.warn('vodInline error', e);
return false;
}
}
function detectTV() {
var el = document.documentElement;
if (window.fongmiClient && window.fongmiClient.isLeanback) {
el.classList.add('tv-mode');
return;
}
var fm = window.fm || window.fongmi;
if (fm && fm.device) {
fm.device().then(function(dev) {
if (dev && (Number(dev.type) === 0 || String(dev.mode).toLowerCase() === 'leanback')) {
el.classList.add('tv-mode');
}
}).catch(function(){});
}
}
function markNative() {
if (window.fongmiBridge || window.fm || window.fongmi)
document.documentElement.classList.add('fm-native');
}
function waitFm(ms) {
if (ms === undefined) ms = 1600;
markNative();
if (window.fm) {
fmReady = true;
return Promise.resolve(window.fm);
}
return new Promise(function(resolve) {
var done = false;
var ok = function() {
if (done) return;
done = true;
markNative();
fmReady = !!window.fm;
resolve(window.fm || null);
};
window.addEventListener('fmsdk', ok, { once: true });
setTimeout(ok, ms);
});
}
function abs(url) {
if (!url) return '';
try { return new URL(url, BASE + '/').href; } catch(e) { return url; }
}
function esc(s) {
if (!s) return '';
return String(s).replace(/[&<>'"]/g, function(c) {
if (c === '&') return '&';
if (c === '<') return '<';
if (c === '>') return '>';
if (c === "'") return ''';
if (c === '"') return '"';
return c;
});
}
function clean(s) {
return String(s || '').replace(/\s+/g, ' ').replace(/[\uE000-\uF8FF]/g, '').trim();
}
function imgUrl(u) {
u = abs(u);
if (!u) return '';
try {
if (window.fm && fm.res) return fm.res(u, { headers: { Referer: BASE + '/' } });
} catch(e) {}
return u;
}
async function reqText(url, options) {
if (!options) options = {};
url = abs(url);
statusEl.textContent = '加载:' + url;
var headers = Object.assign({
'User-Agent': UA,
'Referer': BASE + '/',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'zh-CN,zh;q=0.9'
}, options.headers || {});
var lastErr;
function detectCharsetFromHtml(htmlText) {
var match = htmlText.match(/<meta[^>]+charset\s*=\s*["']?([a-zA-Z0-9\-]+)["']?/i);
if (match) return match[1].toLowerCase();
return null;
}
async function fetchBuffer() {
if (window.fm && fm.req) {
try {
var resp = await fm.req(url, {
method: options.method || 'GET',
headers: headers,
responseType: 'arraybuffer',
timeout: options.timeout || 25,
credentials: 'include',
body: options.body
});
if (resp && (resp.ok || resp.status === 200)) {
return resp.body || resp.data;
}
} catch(e) { lastErr = e; }
}
try {
var r = await fetch(url, {
method: options.method || 'GET',
headers: headers,
cache: 'no-store',
credentials: 'include'
});
if (r.ok) {
return await r.arrayBuffer();
}
} catch(e) { lastErr = e; }
return null;
}
try {
if (window.fm && fm.req) {
var respText = await fm.req(url, {
method: options.method || 'GET',
headers: headers,
responseType: 'text',
timeout: options.timeout || 25,
credentials: 'include',
body: options.body
});
if (respText && (respText.ok || respText.status === 200)) {
var txt = respText.body || respText.content || respText.data || respText.text || '';
if (txt && !txt.includes('锟斤拷') && !txt.includes('�') && !txt.match(/[^\x00-\x7F]{5,}锟/)) {
return txt;
}
}
if (String(respText && respText.status) === '520') {
var retryHeaders = Object.assign({}, headers, { Referer: 'https://www.baidu.com/', Accept: 'text/html,*/*' });
var retryUrl = url + (url.indexOf('?') >= 0 ? '&' : '?') + '_t=' + Date.now();
var retryResp = await fm.req(retryUrl, {
method: options.method || 'GET',
headers: retryHeaders,
responseType: 'text',
timeout: 30,
credentials: 'include',
body: options.body
});
if (retryResp && (retryResp.ok || retryResp.status === 200)) {
var txt2 = retryResp.body || retryResp.content || retryResp.data || '';
if (txt2 && !txt2.includes('锟斤拷') && !txt2.includes('�')) return txt2;
}
}
}
} catch(e) { lastErr = e; }
var buffer = await fetchBuffer();
if (buffer) {
var uint8 = new Uint8Array(buffer);
var tempDecoder = new TextDecoder('utf-8');
var headPart = tempDecoder.decode(uint8.slice(0, Math.min(8192, uint8.length)));
var charset = detectCharsetFromHtml(headPart);
var encoding = 'utf-8';
if (charset && (charset === 'gbk' || charset === 'gb2312' || charset === 'gb18030')) {
encoding = 'gbk';
} else if (headPart.includes('锟斤拷') || headPart.includes('�') || (headPart.match(/[^\x00-\x7F]/g) || []).length > 30) {
encoding = 'gbk';
}
try {
var decoder = new TextDecoder(encoding);
var result = decoder.decode(uint8);
if (encoding === 'utf-8' && (result.includes('锟斤拷') || result.includes('�'))) {
decoder = new TextDecoder('gbk');
result = decoder.decode(uint8);
}
return result;
} catch(e) { lastErr = e; }
}
try {
var r2 = await fetch(url, { headers: headers, cache: 'no-store', credentials: 'include' });
if (r2.ok) {
return await r2.text();
}
} catch(e) { lastErr = e; }
statusEl.textContent = '加载失败';
throw lastErr || new Error('HTTP 请求全部失败');
}
function inferPaginationFromUrl(url) {
let next = null, prev = null;
let matchIndex = url.match(/(\/[^?]*\/)index_(\d+)\.html/);
if (matchIndex) {
let base = matchIndex[1];
let pageNum = parseInt(matchIndex[2], 10);
if (!isNaN(pageNum)) {
next = base + 'index_' + (pageNum + 1) + '.html';
if (pageNum > 2) prev = base + 'index_' + (pageNum - 1) + '.html';
else if (pageNum === 2) prev = base;
return { next, prev };
}
}
let categoryMatch = url.match(/^(.+\/)(?:index\.html)?$/);
if (categoryMatch && !url.includes('index_') && !url.includes('?page=')) {
let base = categoryMatch[1];
next = base + 'index_2.html';
return { next, prev: null };
}
return { next: null, prev: null };
}
function parsePaginationFromHtml(html, currentUrl) {
let nextUrl = null, prevUrl = null;
const nextTextMatch = html.match(/<a[^>]+href\s*=\s*["']([^"']+)["'][^>]*>(?:[^<]|<[^>]+>)*下一页(?:[^<]|<[^>]+>)*<\/a>/i);
if (nextTextMatch) nextUrl = nextTextMatch[1];
if (nextUrl && !nextUrl.startsWith('http')) nextUrl = abs(nextUrl);
if (prevUrl && !prevUrl.startsWith('http')) prevUrl = abs(prevUrl);
if (nextUrl === currentUrl || nextUrl === '#') nextUrl = null;
return { nextUrl, prevUrl };
}
async function getRealVideoUrl(playPageUrl) {
try {
var html = await reqText(playPageUrl);
var m3u8 = html.match(/https?:\/\/[^\s"'<>]+\.m3u8[^\s"'<>]*/i);
if (m3u8) return m3u8[0];
var iframeMatch = html.match(/<iframe[^>]+src\s*=\s*"([^"]+)"/i);
if (iframeMatch) {
var iframeUrl = iframeMatch[1];
if (!iframeUrl.startsWith('http')) iframeUrl = BASE + iframeUrl;
var frameHtml = await reqText(iframeUrl);
var m3u8InFrame = frameHtml.match(/https?:\/\/[^\s"'<>]+\.m3u8[^\s"'<>]*/i);
if (m3u8InFrame) return m3u8InFrame[0];
var constUrl = frameHtml.match(/const\s+url\s*=\s*"([^"]*\.m3u8[^"]*)"/i);
if (constUrl) return constUrl[1];
}
return null;
} catch(e) { return null; }
}
function extractDescription(html) {
let desc = '';
let match1 = html.match(/◎简\s*介\s*([\s\S]*?)(?:◎|$)/i);
if (match1) desc = match1[1];
if (!desc) {
let match2 = html.match(/<meta\s+name=["']description["'][^>]+content=["']([^"']+)["']/i);
if (match2) desc = match2[1];
}
if (desc) {
desc = desc.replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim();
if (desc.length > 800) desc = desc.substring(0, 800) + '…';
}
return desc || '暂无简介';
}
async function parseDetailLines(detailUrl) {
try {
var html = await reqText(detailUrl);
var lines = [];
var h3Regex = /<h3[^>]*>([^<]*播放地址[^<]*)<\/h3>/gi;
var h3Matches = [];
var m;
while ((m = h3Regex.exec(html))) {
h3Matches.push({ name: clean(m[1]), index: m.index });
}
for (var i = 0; i < h3Matches.length; i++) {
var h3 = h3Matches[i];
var sectionStart = h3.index;
var sectionEnd = (i + 1 < h3Matches.length) ? h3Matches[i + 1].index : html.length;
var sectionHtml = html.substring(sectionStart, sectionEnd);
var epRegex = /<a\s+(?:[^>]*?\s+)?href\s*=\s*"([^"]*\/e\/DownSys\/play\/[^"]+)"[^>]*>([^<]+)<\/a>/gi;
var eps = [];
while ((m = epRegex.exec(sectionHtml))) {
var epUrl = m[1];
if (!epUrl.startsWith('http')) epUrl = BASE + epUrl;
eps.push({ href: epUrl, title: clean(m[2]), isDownload: false });
}
if (eps.length > 0) lines.push({ sid: String(lines.length + 1), name: h3.name, eps: eps });
}
if (lines.length === 0) {
var flatRegex = /<a\s+(?:[^>]*?\s+)?href\s*=\s*"([^"]*\/e\/DownSys\/play\/[^"]+)"[^>]*>([^<]+)<\/a>/gi;
var allEps = [];
while ((m = flatRegex.exec(html))) {
var flatUrl = m[1];
if (!flatUrl.startsWith('http')) flatUrl = BASE + flatUrl;
allEps.push({ href: flatUrl, title: clean(m[2]), isDownload: false });
}
if (allEps.length) lines.push({ sid: '1', name: '在线播放', eps: allEps });
}
var downloadIdx = html.indexOf('【下载地址】');
if (downloadIdx >= 0) {
var downloadStart = downloadIdx;
var downloadEnd = html.length;
var nextH3 = html.indexOf('<h3', downloadIdx + 6);
if (nextH3 > 0 && nextH3 < downloadEnd) downloadEnd = nextH3;
var downloadHtml = html.substring(downloadStart, downloadEnd);
var downRegex = /<a\s+(?:[^>]*?\s+)?href\s*=\s*"([^"]+)"[^>]*>([^<]+)<\/a>/gi;
var downEps = [];
var seenUrls = {};
while ((m = downRegex.exec(downloadHtml))) {
var downUrl = m[1];
var downTitle = clean(m[2]);
if (seenUrls[downUrl]) continue;
if (downTitle.length < 2 && downUrl.indexOf('magnet:') !== 0) continue;
seenUrls[downUrl] = true;
if (downTitle === '链接' || downTitle.length < 2) {
if (downUrl.indexOf('quark') > 0) downTitle = '夸克网盘';
else if (downUrl.indexOf('xunlei') > 0) downTitle = '迅雷网盘';
else if (downUrl.indexOf('magnet:') === 0) downTitle = '磁力链接';
else downTitle = '下载';
}
downEps.push({ href: downUrl, title: downTitle, isDownload: true });
}
if (downEps.length) lines.push({ sid: String(lines.length + 1), name: '📥 下载地址', eps: downEps });
}
return lines;
} catch(e) { return []; }
}
async function playEpisode(playUrl, title, isDownload, detailFullObj, currentLineIndex, epName) {
if (isDownload) {
if (playUrl.indexOf('magnet:') === 0) {
if (window.fm && fm.play) fm.play(playUrl, title);
else window.open(playUrl, '_blank');
} else {
if (window.fm && fm.openUrl) fm.openUrl(playUrl);
else window.open(playUrl, '_blank');
}
return;
}
statusEl.textContent = '正在解析播放地址…';
var realUrl = await getRealVideoUrl(playUrl);
if (realUrl) {
if (detailFullObj && window.fm && typeof window.fm.vodInline === 'function') {
const pushed = await smartVodPush(detailFullObj, currentLineIndex, epName || title, realUrl);
if (pushed) { statusEl.textContent = '已推送至原生播放器'; return; }
}
if (window.fm && fm.play) {
fm.play(realUrl, title, { referer: BASE, headers: { Referer: BASE + '/' } });
statusEl.textContent = '已发送播放:' + title;
} else {
window.open(realUrl, '_blank');
}
} else {
statusEl.textContent = '未获取到直链,打开原网页';
if (window.fm && fm.openUrl) fm.openUrl(playUrl);
else window.open(playUrl, '_blank');
}
}
function parseList(html, keyword) {
var items = [];
var postRegex = /<li[^>]*class="[^"]*\bpost\b[^"]*"[^>]*>[\s\S]*?<div class="thumbnail">[\s\S]*?<a[\s\S]*?href\s*=\s*"([^"]+\.html)"[\s\S]*?<img[^>]*src="([^"]+)"[^>]*>[\s\S]*?<h2>[\s\S]*?<a[\s\S]*?href\s*=\s*"[^"]*"[^>]*>([^<]+)<\/a>/gi;
var match, seen = {};
while ((match = postRegex.exec(html))) {
var href = match[1], img = match[2], title = match[3].trim();
if (href.indexOf('/e/') === 0) continue;
if (title.length < 2) continue;
var fullUrl = href.startsWith('http') ? href : BASE + href;
if (seen[fullUrl]) continue;
seen[fullUrl] = true;
items.push({ href: fullUrl, title: clean(title), remark: '', image: abs(img) });
}
if (items.length === 0) {
var regex = /<a\s+(?:[^>]*?\s+)?href="([^"]+\.html)"[^>]*>([^<]+)<\/a>/gi;
while ((match = regex.exec(html))) {
var href2 = match[1], title2 = match[2].trim();
if (href2.indexOf('/e/') === 0) continue;
if (!href2.match(/\/[a-zA-Z0-9_-]+\/\d+\.html/) && !href2.match(/\/\d+\.html/)) continue;
if (title2.length < 2) continue;
var fullUrl2 = href2.startsWith('http') ? href2 : BASE + href2;
if (seen[fullUrl2]) continue;
seen[fullUrl2] = true;
items.push({ href: fullUrl2, title: clean(title2), remark: '', image: '' });
}
}
return items;
}
// 修改后的 renderSections:只显示标题一次,后续追加卡片
function renderSections(items, keyword, nextUrl, prevUrl) {
if (!items.length) { content.innerHTML = '<div class="empty">暂无内容</div>'; return; }
var title = keyword ? '🔍 搜索:' + keyword : '📺 影片列表';
// 检查是否已有 section 容器(判断是否为首次加载)
let existingSection = content.querySelector('.section');
if (existingSection) {
// 已有容器,只追加卡片到现有 grid
let existingGrid = existingSection.querySelector('.grid');
if (existingGrid) {
const cardsHtml = items.map(it => `<article class="card focusable" tabindex="0" data-href="${esc(it.href)}"><div class="poster">${it.image ? `<img loading="lazy" referrerpolicy="no-referrer" src="${esc(imgUrl(it.image))}" alt="${esc(it.title)}">` : '<div class="noimg">6v</div>'}</div><div class="meta"><div class="name">${esc(it.title)}</div><div class="remark">${esc(it.remark || '点击查看详情')}</div></div></article>`).join('');
existingGrid.insertAdjacentHTML('beforeend', cardsHtml);
}
} else {
// 首次加载,创建完整结构
var gridHtml = `<div class="grid">${items.map(it => `<article class="card focusable" tabindex="0" data-href="${esc(it.href)}"><div class="poster">${it.image ? `<img loading="lazy" referrerpolicy="no-referrer" src="${esc(imgUrl(it.image))}" alt="${esc(it.title)}">` : '<div class="noimg">6v</div>'}</div><div class="meta"><div class="name">${esc(it.title)}</div><div class="remark">${esc(it.remark || '点击查看详情')}</div></div></article>`).join('')}</div>`;
content.innerHTML = `<section class="section"><div class="section-title"><h2>${esc(title)}</h2></div>${gridHtml}</section>`;
}
// 绑定卡片点击事件
content.querySelectorAll('.card').forEach(card => card.onclick = () => openDetail(card.dataset.href));
}
// 下滑加载更多数据
async function loadMoreData() {
if (isLoadingMore) return;
if (!hasMore) return;
if (!nextPageUrl) return;
isLoadingMore = true;
let loadingMsg = document.getElementById('loading-more');
if (!loadingMsg) {
loadingMsg = document.createElement('div');
loadingMsg.id = 'loading-more';
loadingMsg.className = 'empty loading';
loadingMsg.textContent = '加载更多中...';
loadingMsg.style.textAlign = 'center';
loadingMsg.style.padding = '20px';
content.appendChild(loadingMsg);
}
try {
const html = await reqText(nextPageUrl);
const newItems = parseList(html);
loadingMsg.remove();
if (newItems.length === 0) {
hasMore = false;
let endMsg = document.getElementById('end-msg');
if (!endMsg) {
endMsg = document.createElement('div');
endMsg.id = 'end-msg';
endMsg.className = 'empty';
endMsg.textContent = '已经到底了';
endMsg.style.textAlign = 'center';
endMsg.style.padding = '20px';
content.appendChild(endMsg);
}
return;
}
// 追加卡片到现有 grid
let existingGrid = content.querySelector('.grid');
if (existingGrid) {
const cardsHtml = newItems.map(it => `<article class="card focusable" tabindex="0" data-href="${esc(it.href)}"><div class="poster">${it.image ? `<img loading="lazy" referrerpolicy="no-referrer" src="${esc(imgUrl(it.image))}" alt="${esc(it.title)}">` : '<div class="noimg">6v</div>'}</div><div class="meta"><div class="name">${esc(it.title)}</div><div class="remark">${esc(it.remark || '点击查看详情')}</div></div></article>`).join('');
existingGrid.insertAdjacentHTML('beforeend', cardsHtml);
}
// 绑定新卡片的点击事件
content.querySelectorAll('.card:not([data-scroll-bound])').forEach(c => {
c.setAttribute('data-scroll-bound', 'true');
c.onclick = () => openDetail(c.dataset.href);
});
// 更新下一页链接
let inferred = inferPaginationFromUrl(nextPageUrl);
let parsed = parsePaginationFromHtml(html, nextPageUrl);
nextPageUrl = inferred.next || parsed.nextUrl;
if (!nextPageUrl) {
hasMore = false;
let endMsg = document.getElementById('end-msg');
if (!endMsg) {
endMsg = document.createElement('div');
endMsg.id = 'end-msg';
endMsg.className = 'empty';
endMsg.textContent = '已经到底了';
content.appendChild(endMsg);
}
}
statusEl.textContent = `已加载更多,共 ${content.querySelectorAll('.card').length} 条`;
} catch(e) {
loadingMsg.remove();
statusEl.textContent = '加载更多失败:' + e.message;
} finally {
isLoadingMore = false;
}
}
// 滚动监听
function handleScroll() {
if (isLoadingMore) return;
if (!hasMore) return;
if (!nextPageUrl) return;
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
const scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
const clientHeight = document.documentElement.clientHeight;
if (scrollTop + clientHeight + 200 >= scrollHeight) {
loadMoreData();
}
}
function setupInfiniteScroll() {
window.removeEventListener('scroll', handleScroll);
window.addEventListener('scroll', handleScroll);
}
async function loadPage(url) {
url = abs(url);
if (!url) return;
currentUrl = url;
lastSearchKeyword = '';
// 重置下滑加载状态
hasMore = true;
isLoadingMore = false;
nextPageUrl = null;
Array.from(tabsDiv.querySelectorAll('.tab')).forEach(btn => btn.classList.toggle('active', abs(btn.dataset.url) === currentUrl));
content.innerHTML = '<div class="empty loading">正在加载内容…</div>';
try {
var html = await reqText(currentUrl);
var items = parseList(html);
let inferred = inferPaginationFromUrl(currentUrl);
let parsed = parsePaginationFromHtml(html, currentUrl);
nextPageUrl = inferred.next || parsed.nextUrl;
renderSections(items, '', null, null);
statusEl.textContent = '已加载 ' + items.length + ' 条内容';
restoreFocus();
setupInfiniteScroll();
} catch(e) { content.innerHTML = '<div class="empty">加载失败:' + esc(e.message) + '</div>'; statusEl.textContent = '错误:' + e.message; }
}
async function search(q) {
q = clean(q);
if (!q) return;
lastSearchKeyword = q;
history.pushState({ route: 'search', q }, '', '#search=' + encodeURIComponent(q));
Array.from(tabsDiv.querySelectorAll('.tab')).forEach(btn => btn.classList.remove('active'));
content.innerHTML = '<div class="empty loading">搜索中…</div>';
var searchUrl = BASE + '/e/search/11index.php';
var postData = 'keyboard=' + encodeURIComponent(q) + '&show=title&tempid=1&tbname=article&mid=1&dopost=search&submit=';
try {
var html = await reqText(searchUrl, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: postData });
var items = parseList(html);
if (!items.length) { content.innerHTML = '<div class="empty">没有找到相关结果</div>'; statusEl.textContent = '无搜索结果:' + q; return; }
renderSections(items, q, null, null);
statusEl.textContent = '搜索完成:' + q;
} catch(e) { content.innerHTML = '<div class="empty">搜索失败,请检查网络</div>'; statusEl.textContent = '搜索失败:' + q; }
}
let currentDetailCache = null;
async function openDetail(detailUrl) {
lastFocus = document.activeElement;
document.body.classList.add('detail-active');
$('#detailSheet').classList.add('active');
$('#detailPanel').innerHTML = '<div class="empty loading">正在读取详情…</div>';
history.pushState({ route: 'detail', url: detailUrl }, '', '#detail=' + encodeURIComponent(detailUrl));
try {
var html = await reqText(detailUrl);
var titleMatch = html.match(/<title>([^<]+)-/);
var title = titleMatch ? titleMatch[1].trim() : '未知影片';
var imgMatch = html.match(/<img[^>]+src="([^"]+\.jpg)"/i);
var image = imgMatch ? imgMatch[1] : '';
var desc = extractDescription(html);
var lines = await parseDetailLines(detailUrl);
if (lines.length === 0) { $('#detailPanel').innerHTML = '<button class="focusable" id="closeDetail">返回</button><div class="empty">未找到播放链接</div>'; $('#closeDetail').onclick = closeDetail; return; }
currentDetailCache = { detailUrl, title, image, lines };
var lineTabsHtml = lines.map((ln, idx) => `<button class="line-tab focusable ${idx===0?'active':''}" data-sid="${esc(ln.sid)}">${esc(ln.name)}(${ln.eps.length})</button>`).join('');
$('#detailPanel').innerHTML = `<button class="focusable" id="closeDetail">返回</button><div class="detail-head"><img class="detail-pic" referrerpolicy="no-referrer" src="${esc(image)}" onerror="this.style.display='none'"><div><div class="detail-title">${esc(title)}</div><div class="detail-info">6v影视资源</div><p class="desc">${esc(desc)}</p></div></div><h3>播放线路</h3><div class="line-tabs">${lineTabsHtml}</div><div class="episodes" id="episodeBox"></div>`;
$('#closeDetail').onclick = closeDetail;
let currentActiveLineIdx = 0;
function renderLine(sid) {
var idx = lines.findIndex(l => l.sid == sid);
if (idx === -1) idx = 0;
currentActiveLineIdx = idx;
var line = lines[idx];
$('#episodeBox').innerHTML = line.eps.map(ep => `<button class="ep focusable" data-href="${esc(ep.href)}" data-download="${ep.isDownload||false}">${esc(ep.title)}</button>`).join('') || '<div class="empty">暂无剧集</div>';
Array.from($('#episodeBox').querySelectorAll('.ep')).forEach(btn => {
btn.onclick = () => playEpisode(btn.dataset.href, title + ' ' + btn.textContent, btn.dataset.download === 'true', currentDetailCache, currentActiveLineIdx, btn.textContent);
});
}
document.querySelectorAll('.line-tab').forEach(tab => {
tab.onclick = function() {
document.querySelectorAll('.line-tab').forEach(t => t.classList.remove('active'));
tab.classList.add('active');
renderLine(tab.dataset.sid);
};
});
renderLine(lines[0].sid);
} catch(e) { $('#detailPanel').innerHTML = `<button class="focusable" id="closeDetail">返回</button><div class="empty">详情加载失败:${esc(e.message)}</div>`; $('#closeDetail').onclick = closeDetail; }
}
function closeDetail() {
document.body.classList.remove('detail-active');
$('#detailSheet').classList.remove('active');
if (location.hash.startsWith('#detail')) history.back();
if (lastFocus && lastFocus.focus) setTimeout(() => lastFocus.focus({ preventScroll: true }), 50);
}
window.__fyClose = closeDetail;
function renderTabs() {
tabsDiv.innerHTML = CATS.map(cat => `<button class="tab focusable" data-url="${esc(abs(cat[1]))}">${esc(cat[0])}</button>`).join('');
Array.from(tabsDiv.querySelectorAll('.tab')).forEach(btn => { btn.onclick = () => { lastSearchKeyword = ''; loadPage(btn.dataset.url); }; });
}
function restoreFocus() { setTimeout(() => { let el = document.querySelector('.tab.active') || document.querySelector('.card'); if (el) el.focus({ preventScroll: true }); }, 50); }
function handleKeys(e) { if (e.key === 'Escape' || e.key === 'Backspace') { if ($('#detailSheet').classList.contains('active')) { e.preventDefault(); closeDetail(); return; } } if (e.key === 'Enter' && document.activeElement?.classList.contains('focusable') && document.activeElement.tagName !== 'INPUT') document.activeElement.click(); }
function boot() { detectTV(); statusEl.textContent = '正在初始化…'; renderTabs(); $('#searchForm').onsubmit = e => { e.preventDefault(); search($('#kw').value); }; document.addEventListener('keydown', handleKeys, true); window.addEventListener('popstate', () => { if ($('#detailSheet').classList.contains('active')) closeDetail(); else if (lastSearchKeyword) search(lastSearchKeyword); else loadPage(currentUrl); }); loadPage(BASE + '/'); }
waitFm().then(() => { try { boot(); } catch(e) { statusEl.textContent = '启动失败:' + e.message; } }).catch(() => { boot(); });
})();
</script>
</body>
</html>