AI 生成: 一个基于 Python Flask 的影视采集站,自动从公开采集接口抓取影视资源,提供现代风格的分类浏览页面和在线播放功能。

This commit is contained in:
admin
2026-09-28 21:24:13 +08:00
commit 5d4679ff1e
9 changed files with 530 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
(function () {
var sources = window.__PLAY_SOURCES__ || [];
var video = document.getElementById('video');
var hls = null;
var currentSource = 0;
function play(url) {
if (!url) return;
if (hls) { hls.destroy(); hls = null; }
if (url.indexOf('.m3u8') !== -1 && window.Hls && window.Hls.isSupported()) {
hls = new Hls();
hls.loadSource(url);
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED, function () { video.play().catch(function () {}); });
} else {
video.src = url;
video.play().catch(function () {});
}
}
// 切换线路
var tabs = document.querySelectorAll('.source-tab');
var groups = document.querySelectorAll('.episode-group');
tabs.forEach(function (tab) {
tab.addEventListener('click', function () {
tabs.forEach(function (t) { t.classList.remove('active'); });
tab.classList.add('active');
var idx = parseInt(tab.getAttribute('data-idx'), 10);
currentSource = idx;
groups.forEach(function (g) {
g.style.display = parseInt(g.getAttribute('data-idx'), 10) === idx ? 'flex' : 'none';
});
});
});
// 点击剧集
document.querySelectorAll('.ep-btn').forEach(function (btn) {
btn.addEventListener('click', function () {
var url = btn.getAttribute('data-url');
play(url);
});
});
// 自动播放第一集
if (sources.length && sources[0].episodes && sources[0].episodes.length) {
play(sources[0].episodes[0].url);
}
})();