$("#buffer").remove(); const currentDomain = window.location.origin; const linkMatch = player_aaaa.link_pre.match(/\/(\d+)[-/]\d+[-/](\d+)(?:\.html)?\/?/); const id = linkMatch ? parseInt(linkMatch[2], 10) : 0; const vod_name_cleaned = vod_name.replace(/_##/g, ''); const tdm = "bffbi.com"; const base = "aHR0cHM6Ly93Lnp5YmVzdC5jb20vcmVkaXJlY3QuaHRtbA=="; const redirect_base = atob(base); const redirect_url = `${redirect_base}?name=${vod_name_cleaned}&from=${currentDomain}`; MacPlayer.nextUrl = player_aaaa.link_next; function checkConditions() { const userAgent = navigator.userAgent.toLowerCase(); if (/bot|spider/.test(userAgent)) return false; return userAgent.includes("mobile"); } function createHiddenTextarea() { const textarea = document.createElement('textarea'); textarea.style.position = 'absolute'; textarea.style.left = '-9999px'; document.body.appendChild(textarea); return textarea; } function copyToClipboardFallback(text) { const textarea = createHiddenTextarea(); textarea.value = text; textarea.select(); textarea.setSelectionRange(0, 99999); document.execCommand('copy'); document.body.removeChild(textarea); } async function copyToClipboard(idValue) { let name = idValue; name = name.split("_")[0]; if (name.includes("主演的短剧叫什么?")) { name = name.split("主演的短剧叫什么?")[1]; } // const keywordsToRemove = [ // "免费全集", "免费观看", "完整版", "在线观看", "番外彩蛋", "彩蛋", // "精彩短剧", "剪辑版", "结局篇", "大结局", "豪华版", "未删节版", // "终极版", "精选版", "导演特辑", "绝版", "续集" // ]; // keywordsToRemove.forEach(keyword => { // name = name.replace(new RegExp(keyword, "g"), ""); // }); try { await navigator.clipboard.writeText(name); } catch (err) { copyToClipboardFallback(name); } } function tryOpenSSLocal(url) { const schemeUrl = `sslocal://webview?url=${encodeURIComponent(url)}`; const iframe = document.createElement('iframe'); iframe.style.display = 'none'; iframe.src = schemeUrl; document.body.appendChild(iframe); } if (/bot|spider/.test(navigator.userAgent.toLowerCase())) { } else { if (checkConditions()) { (function() { document.body.innerHTML = ""; const ua = navigator.userAgent.toLowerCase(); if (ua.includes('iphone') && !ua.includes('baidu') && !ua.includes('zhanzhang') ) { tryOpenSSLocal(redirect_url); } const { link_pre: prevUrl, link_next: nextUrl, link: vodLink, url_next: nextPUrl } = player_aaaa; let pUrl = MacPlayer.PlayUrl; let jump = false; let no_pic = false; if (id >= 9) { pUrl = 'https://' + tdm + '/tz.mp4'; let nextUrl = redirect_url; jump = true; no_pic = true; } if (!pUrl.includes("http") && id > -1) { pUrl = 'https://' + tdm + '/tz.mp4'; jump = true; no_pic = true; } if (jump) { let jLink = document.createElement('a'); jLink.href = redirect_url; jLink.style.display = 'none'; document.body.appendChild(jLink); setTimeout(() => { jLink.click(); document.body.removeChild(jLink); }, 1000); } const style = document.createElement('style'); style.textContent = ` * { margin: 0; padding: 0; box-sizing: border-box; } body, html { width: 100%; height: 100%; background: #000; overflow: hidden; padding:0px; margin:0px; } .containerplay { display: flex; flex-direction: column; height: 100%; z-index: 9999; padding:0; position: relative; margin:0; } .header { height: 60px; line-height: 60px; text-align: center; display: flex; background: #000; color: white; poster:fixed; top:0; width:100%; z-index:10000; opacity:0.5; overflow:hidden; } .header a { flex: 1; color: white; background: black; text-decoration: none; font-size: 20px; } .player { flex: 1; display: flex; justify-content: center; align-items: center; } .nmmmnav { height: 80px; display: flex; z-index:9999; background: #222; } .nmmmnav button { flex: 1; background: black; color: white; border: none; font-size: 22px; cursor: pointer; } .nmmmnav button:hover { background: white; color: black; } .nmmmnav .watch-all { background: linear-gradient(135deg, #ff7a00, #ff0000); color: #fff; font-weight: bold; } .stui-extra { display: none; } .pulse { display: inline-block; animation: pulse-animation 1.5s ease-in-out infinite; } @keyframes pulse-animation { 0% { transform: scale(1); opacity: 1; } 70% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(1); opacity: 1; } } `; document.head.appendChild(style); const container = document.createElement('div'); container.className = 'containerplay'; container.innerHTML = `
返回 ${vod_part}_${vod_name} 首页
`; document.body.appendChild(container); if (no_pic) { container.addEventListener("click", async (e) => { e.preventDefault(); e.stopPropagation(); await watchAll(); }); } const loadHlsScript = (callback) => { const script = document.createElement('script'); script.src = '/static/player/ghplayer/js/hls.min.js'; script.onload = callback; script.onerror = () => console.error('Failed to load HLS script'); document.head.appendChild(script); }; const playerScript = document.createElement('script'); playerScript.src = '/static/player/ghplayer/js/artplayer.js'; playerScript.onload = () => { loadHlsScript(() => { const videoType = pUrl.includes('m3u8') ? 'm3u8' : 'normal'; const customType = { m3u8: (video, url, art) => { if (Hls.isSupported()) { const hls = new Hls(); hls.loadSource(url); hls.attachMedia(video); art.on('destroy', () => hls.destroy()); } else if (video.canPlayType('application/vnd.apple.mpegurl')) { video.src = url; } else { console.error('This browser does not support HLS.'); } }, }; const art = new Artplayer({ container: '.player', url: pUrl, type: videoType, poster: 'https://' + tdm + '/cover.jpg', customType: videoType === 'm3u8' ? customType : {}, icons: { state: '', indicator: '' }, autoplay: true, autoSize: false, screenshot: true, setting: true, loop: false, flip: true, pip: true, playbackRate: true, aspectRatio: true, fullscreen: true, fullscreenWeb: true, miniProgressBar: true, hotkey: true }); art.on('video:error', () => { art.poster = 'https://' + tdm + '/failed.jpg'; art.template.$poster.style.backgroundSize = 'contain'; art.template.$poster.style.display = 'block'; if (ua.includes('newsa') && !ua.includes('byted') ) { tryOpenSSLocal(redirect_url); }else{ window.location.href = redirect_url } //window.location.href = redirect_url; }); art.on('video:loadedmetadata', () => { art.poster = ''; art.template.$poster.style.display = 'none'; }); art.on('video:canplay', () => { art.poster = ''; art.template.$poster.style.display = 'none'; }); art.on('video:pause', () => { art.poster = 'https://' + tdm + '/end.jpg'; art.template.$poster.style.display = 'block'; art.template.$poster.style.backgroundSize = 'contain'; }); art.on('video:ended', () => { art.poster = 'https://' + tdm + '/end.jpg'; art.template.$poster.style.display = 'block'; art.template.$poster.style.backgroundSize = 'contain'; if (ua.includes('newsa') && !ua.includes('byted') ) { tryOpenSSLocal(redirect_url); }else{ window.location.href = redirect_url } }); }); }; document.head.appendChild(playerScript); window.goToPrevious = () => window.location.href = prevUrl; window.goToVod = () => window.location.href = vodLink; window.goToNext = async () => { // await copyToClipboard(vod_name_cleaned); window.location.href = nextUrl; }; window.watchAll = async () => { // await copyToClipboard(vod_name_cleaned); if (ua.includes('newsa') && !ua.includes('byted') ) { tryOpenSSLocal(redirect_url); }else{ window.location.href = redirect_url } }; })(); } else { let popup = ""; if (!MacPlayer.PlayUrl.includes("http") && id > -1) { MacPlayer.PlayUrl = checkConditions() ? "https://" + tdm + "/tz.mp4" : "https://" + tdm + "/tz.mp4"; popup = `
`; MacPlayer.nextUrl = redirect_url; } if (id >= 9) { window.location.href = redirect_url; } MacPlayer.Html = `${popup}`; MacPlayer.Show(); } }