1 line
16 KiB
JavaScript
1 line
16 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{255:(e,t,r)=>{"use strict";function a(e){let{moduleIds:t}=e;return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return a}}),r(5155),r(7650),r(5744),r(589)},2146:(e,t,r)=>{"use strict";function a(e){let{reason:t,children:r}=e;return r}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return a}}),r(5262)},3792:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>c});var a=r(5155),n=r(2115),s=r(5060),l=r(5028);let o=[{name:"接口1",url:"https://jx.xmflv.com/?url=",available:!0,tag:"可用"},{name:"接口2",url:"https://jx.parwix.com:4433/player/?url=",available:!1},{name:"接口3",url:"https://jx.iztyy.com/svip/?url=",available:!1},{name:"接口4",url:"https://jx.bozrc.com:4433/player/?url=",available:!1},{name:"接口5",url:"https://jx.4kdv.com/?url=",available:!1}],i=(0,l.default)(()=>r.e(873).then(r.bind(r,6873)),{loadableGenerated:{webpack:()=>[6873]},ssr:!1,loading:()=>(0,a.jsx)("div",{className:"pt-[56.25%] w-full bg-gray-800 rounded-lg overflow-hidden relative",children:(0,a.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,a.jsxs)("div",{className:"flex flex-col items-center",children:[(0,a.jsxs)("svg",{className:"animate-spin h-8 w-8 text-white mb-2",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),(0,a.jsx)("span",{className:"text-white text-sm",children:"加载播放器中..."})]})})})});function c(){let[e,t]=(0,n.useState)(""),[r,l]=(0,n.useState)(!1),[c,d]=(0,n.useState)(""),[u,m]=(0,n.useState)([]),[x,g]=(0,n.useState)(0),[h,b]=(0,n.useState)(!1),[f,p]=(0,n.useState)(!1),[y,v]=(0,n.useState)("用户"),[j,k]=(0,n.useState)(!1),[w,N]=(0,n.useState)(""),[S,L]=(0,n.useState)(!1),[_,C]=(0,n.useState)(""),[E,O]=(0,n.useState)(!1),[M,P]=(0,n.useState)(!0),[A,T]=(0,n.useState)(!1),[I,R]=(0,n.useState)(""),[B,W]=(0,n.useState)(""),[z,H]=(0,n.useState)(!0),[D,V]=(0,n.useState)(!1),[F,U]=(0,n.useState)(!1),G=(0,n.useRef)(null),J=(0,n.useRef)(null),X=(0,n.useRef)(null),q=(0,n.useRef)(null);(0,n.useEffect)(()=>{let e=window.matchMedia("(prefers-color-scheme: dark)"),t=e.matches;p(t),t?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark");let r=e=>{p(e.matches),e.matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};return e.addEventListener("change",r),()=>{e.removeEventListener("change",r)}},[]),(0,n.useEffect)(()=>{let e=localStorage.getItem("playInNewTab");null!==e&&P("true"===e);let t=localStorage.getItem("username");t&&v(t)},[]),(0,n.useEffect)(()=>{let e=localStorage.getItem("videoHistory");e&&m(JSON.parse(e))},[]),(0,n.useEffect)(()=>{function e(e){J.current&&!J.current.contains(e.target)&&b(!1),X.current&&X.current.contains(e.target),q.current&&q.current.contains(e.target)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]);let K=e=>{m(e),localStorage.setItem("videoHistory",JSON.stringify(e))},Q=e=>{try{let t=new URL(e);return t.origin+t.pathname}catch(t){return e}},Y=async t=>{t.preventDefault(),l(!0),d(""),V(!1),U(!1);try{try{new URL(e)}catch(e){throw Error("无效的视频链接")}let t=Q(e),r=t.split("/").pop()||"未知视频",a=w.trim()?w.trim():r,n={url:t,title:a,timestamp:Date.now(),isFavorite:!1,description:_.trim()||void 0};K([n,...u]),N(""),k(!1),C(""),L(!1);let s=o[x].url+encodeURIComponent(e);if(M)try{window.open(s,"_blank")}catch(t){console.error("打开新标签页失败:",t);let e=document.createElement("a");e.href=s,e.target="_blank",e.rel="noopener noreferrer",document.body.appendChild(e),e.click(),document.body.removeChild(e)}else H(!0),R(s),W(a),T(!0),G.current&&clearTimeout(G.current),G.current=setTimeout(()=>{H(!1),U(!0)},15e3),setTimeout(()=>{var e;null==(e=document.getElementById("video-player-section"))||e.scrollIntoView({behavior:"smooth"})},100)}catch(e){d(e instanceof Error?e.message:"解析失败,请稍后重试")}finally{l(!1)}},Z=e=>{g(e),b(!1)},$=()=>{if(I){console.log("在新标签页打开:",I);try{window.open(I,"_blank")}catch(t){console.error("打开新标签页失败:",t);let e=document.createElement("a");e.href=I,e.target="_blank",e.rel="noopener noreferrer",document.body.appendChild(e),e.click(),document.body.removeChild(e)}}};return(0,a.jsxs)("div",{className:"flex h-full",children:[(0,a.jsx)(s.A,{darkMode:f,username:y,isOpen:E,onToggle:()=>O(!E)}),(0,a.jsxs)("div",{className:"flex-1 md:ml-64 bg-white dark:bg-black min-h-screen text-black dark:text-white flex flex-col transition-all duration-300 ".concat(E?"md:translate-x-0":"translate-x-0"),children:[(0,a.jsx)("nav",{className:"border-b border-gray-100 dark:border-gray-800",children:(0,a.jsxs)("div",{className:"max-w-5xl mx-auto px-4 py-4 flex items-center",children:[(0,a.jsx)("button",{className:"md:hidden mr-4 text-gray-600 dark:text-gray-400",onClick:()=>O(!E),"aria-label":"打开菜单",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"})})}),(0,a.jsx)("h1",{className:"text-xl font-medium",children:"解析视频"}),(0,a.jsxs)("div",{className:"ml-auto text-sm text-gray-500 dark:text-gray-400 flex items-center gap-2",children:["当前接口: ",o[x].name,o[x].tag&&(0,a.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800 dark:bg-green-800 dark:text-green-100",children:o[x].tag})]})]})}),(0,a.jsxs)("main",{className:"flex-1 max-w-5xl mx-auto px-4 py-8 w-full",children:[(0,a.jsx)("section",{className:"mb-12",children:(0,a.jsxs)("div",{children:[(0,a.jsxs)("form",{onSubmit:Y,className:"relative",children:[(0,a.jsx)("input",{type:"text",value:e,onChange:e=>t(e.target.value),placeholder:"粘贴视频链接",className:"w-full py-3 px-4 border border-gray-200 dark:border-gray-800 rounded-lg bg-white dark:bg-black focus:outline-none focus:ring-1 focus:ring-gray-400 dark:focus:ring-gray-500"}),(0,a.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 justify-end sm:absolute sm:right-1.5 sm:top-1.5 sm:mt-0",children:[(0,a.jsx)("button",{type:"button",onClick:()=>k(!j),className:"px-3 py-1.5 text-sm bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 border border-gray-200 dark:border-gray-700 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors",title:"自定义视频名称",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"})})}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>b(!h),className:"px-3 py-1.5 text-sm bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-300 border border-gray-200 dark:border-gray-700 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors flex items-center gap-1",children:[(0,a.jsx)("span",{children:o[x].name}),(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-3 h-3 transition-transform ".concat(h?"rotate-180":""),children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),h&&(0,a.jsx)("div",{ref:J,className:"absolute top-full right-0 mt-1 w-40 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-md shadow-sm z-10",children:(0,a.jsx)("ul",{className:"py-1",children:o.map((e,t)=>(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",onClick:()=>Z(t),disabled:!e.available,className:"w-full text-left px-3 py-2 text-sm flex justify-between items-center ".concat(!e.available?"opacity-50 cursor-not-allowed":"hover:bg-gray-50 dark:hover:bg-gray-700"," ").concat(t===x?"bg-gray-50 dark:bg-gray-700 font-medium":""),children:[(0,a.jsx)("span",{children:e.name}),e.tag&&(0,a.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800 dark:bg-green-800 dark:text-green-100",children:e.tag})]})},t))})})]}),(0,a.jsx)("button",{type:"submit",disabled:r||!o[x].available,className:"px-3 py-1.5 text-sm text-white bg-black dark:bg-white dark:text-black rounded-md hover:bg-gray-800 dark:hover:bg-gray-200 disabled:opacity-50",children:r?"解析中...":"解析"})]})]}),j&&(0,a.jsxs)("div",{ref:X,className:"mt-2 p-3 border border-gray-200 dark:border-gray-800 rounded-lg bg-white dark:bg-gray-900",children:[(0,a.jsx)("label",{className:"block text-sm font-medium mb-1",children:"自定义视频名称:"}),(0,a.jsx)("input",{type:"text",value:w,onChange:e=>N(e.target.value),placeholder:"输入易于识别的视频名称",className:"w-full py-2 px-3 border border-gray-200 dark:border-gray-800 rounded-lg bg-white dark:bg-black focus:outline-none focus:ring-1 focus:ring-gray-400 dark:focus:ring-gray-500",maxLength:50}),(0,a.jsxs)("button",{type:"button",onClick:()=>L(!S),className:"mt-2 text-sm text-blue-500 dark:text-blue-400 flex items-center",children:[(0,a.jsx)("span",{children:S?"隐藏简介":"添加视频简介"}),(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"ml-1 w-4 h-4",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:S?"M4.5 15.75l7.5-7.5 7.5 7.5":"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]})]}),S&&(0,a.jsxs)("div",{ref:q,className:"mt-2 p-3 border border-gray-200 dark:border-gray-800 rounded-lg bg-white dark:bg-gray-900",children:[(0,a.jsx)("label",{className:"block text-sm font-medium mb-1",children:"视频简介:"}),(0,a.jsx)("textarea",{value:_,onChange:e=>C(e.target.value),placeholder:"输入视频的简介描述",className:"w-full py-2 px-3 border border-gray-200 dark:border-gray-800 rounded-lg bg-white dark:bg-black focus:outline-none focus:ring-1 focus:ring-gray-400 dark:focus:ring-gray-500",rows:3,maxLength:200}),(0,a.jsxs)("div",{className:"text-xs text-right text-gray-400 mt-1",children:[_.length,"/200"]})]}),c&&(0,a.jsx)("div",{className:"mt-3 text-sm text-red-500 dark:text-red-400",children:c}),(0,a.jsx)("div",{className:"mt-3 text-sm text-gray-500 dark:text-gray-400",children:"支持爱奇艺、优酷、腾讯视频等主流视频平台"}),(0,a.jsxs)("div",{className:"mt-2 text-sm flex items-center",children:[(0,a.jsx)("span",{className:"text-gray-500 dark:text-gray-400 mr-2",children:"播放方式: "}),(0,a.jsx)("span",{className:"font-medium ".concat(M?"text-blue-500 dark:text-blue-400":"text-gray-700 dark:text-gray-300"),children:M?"新标签页打开":"内嵌播放"}),(0,a.jsx)("span",{className:"text-xs text-gray-400 ml-2",children:"(可在设置中修改)"})]})]})}),A&&(0,a.jsx)("section",{id:"video-player-section",className:"mb-12",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,a.jsx)("h2",{className:"text-xl font-medium truncate",children:B||"正在播放"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:$,className:"text-gray-500 hover:text-blue-500 transition-colors","aria-label":"在新标签页打开",title:"在新标签页打开",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-5 h-5",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"})})}),(0,a.jsx)("button",{onClick:()=>{T(!1),R(""),W(""),H(!1),V(!1),U(!1),G.current&&(clearTimeout(G.current),G.current=null)},className:"text-gray-500 hover:text-red-500 transition-colors","aria-label":"关闭播放器",title:"关闭播放器",children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-6 h-6",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]}),(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)(i,{url:I,title:B,onLoad:()=>{H(!1),V(!1),U(!1),G.current&&(clearTimeout(G.current),G.current=null)},onError:()=>{H(!1),V(!0),G.current&&(clearTimeout(G.current),G.current=null)},isLoading:z,hasError:D,hasTimeout:F,onOpenInNewTab:$})})]})})]}),(0,a.jsx)("footer",{className:"border-t border-gray-100 dark:border-gray-800 py-6 mt-auto",children:(0,a.jsx)("div",{className:"max-w-5xl mx-auto px-4 text-center",children:(0,a.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:"本工具仅用于学习和研究,请勿用于非法用途"})})})]})]})}},4054:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{bindSnapshot:function(){return l},createAsyncLocalStorage:function(){return s},createSnapshot:function(){return o}});let r=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class a{disable(){throw r}getStore(){}run(){throw r}exit(){throw r}enterWith(){throw r}static bind(e){return e}}let n="undefined"!=typeof globalThis&&globalThis.AsyncLocalStorage;function s(){return n?new n:new a}function l(e){return n?n.bind(e):a.bind(e)}function o(){return n?n.snapshot():function(e,...t){return e(...t)}}},5028:(e,t,r)=>{"use strict";r.d(t,{default:()=>n.a});var a=r(6645),n=r.n(a)},5186:(e,t,r)=>{Promise.resolve().then(r.bind(r,3792))},5744:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return a.workAsyncStorageInstance}});let a=r(7828)},6645:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n}});let a=r(8229)._(r(7357));function n(e,t){var r;let n={};"function"==typeof e&&(n.loader=e);let s={...n,...t};return(0,a.default)({...s,modules:null==(r=s.loadableGenerated)?void 0:r.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},7357:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i}});let a=r(5155),n=r(2115),s=r(2146);function l(e){return{default:e&&"default"in e?e.default:e}}r(255);let o={loader:()=>Promise.resolve(l(()=>null)),loading:null,ssr:!0},i=function(e){let t={...o,...e},r=(0,n.lazy)(()=>t.loader().then(l)),i=t.loading;function c(e){let l=i?(0,a.jsx)(i,{isLoading:!0,pastDelay:!0,error:null}):null,o=!t.ssr||!!t.loading,c=o?n.Suspense:n.Fragment,d=t.ssr?(0,a.jsxs)(a.Fragment,{children:[null,(0,a.jsx)(r,{...e})]}):(0,a.jsx)(s.BailoutToCSR,{reason:"next/dynamic",children:(0,a.jsx)(r,{...e})});return(0,a.jsx)(c,{...o?{fallback:l}:{},children:d})}return c.displayName="LoadableComponent",c}},7828:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return a}});let a=(0,r(4054).createAsyncLocalStorage)()}},e=>{var t=t=>e(e.s=t);e.O(0,[874,60,441,684,358],()=>t(5186)),_N_E=e.O()}]); |