22 lines
14 KiB
HTML
22 lines
14 KiB
HTML
<!doctypehtml><html lang=zh-CN><meta charset=UTF-8><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"name=viewport><title>Wuma</title><style>*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent}body,html{min-height:100%;background:0 0}html:not(.fm-native),html:not(.fm-native) body{background:#1a1a2e}body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;color:#e0e0e0}.header{height:52px;background:#16162a;display:flex;align-items:center;padding:0 12px;gap:10px;position:sticky;top:0;z-index:100}.logo{font-size:18px;font-weight:700;white-space:nowrap;color:#fff}.search-group{flex:1;display:flex;align-items:center;background:#2a2a4a;border-radius:25px;padding-right:4px}.search-group .search-box{flex:1;border:none;background:0 0;outline:0;padding:0 10px;height:34px;color:#e0e0e0;font-size:12px}.search-group .search-btn{width:32px;height:28px;background:#e0592f;border:none;border-radius:50%;display:flex;align-items:center;justify-content:center;cursor:pointer}.search-group .search-btn svg{width:14px;height:14px;color:#fff}.category-bar{display:flex;gap:8px;padding:8px 12px;overflow-x:auto;background:#16162a}.category-bar::-webkit-scrollbar{display:none}.category-item{padding:6px 16px;border-radius:20px;background:rgba(42,42,74,.6);font-size:13px;white-space:nowrap;color:#e0e0e0;cursor:pointer;transition:all .2s}.category-item.active{background:#e0592f;color:#fff}.list-section{background:rgba(26,26,46,.5);padding:12px}.list-item{display:flex;flex-direction:row;background:#16162a;border-radius:10px;margin-bottom:10px;overflow:hidden;cursor:pointer;transition:transform .2s,box-shadow .2s}.list-item:active{transform:scale(.98)}.list-item-img-wrap{position:relative;width:120px;min-width:120px;flex-shrink:0}.list-item-img{width:120px;height:90px;object-fit:cover;display:block;background:#2a2a4a}.list-item-play-icon{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:36px;height:36px;background:rgba(0,0,0,.6);border-radius:50%;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .2s}.list-item:hover .list-item-play-icon{opacity:1}.list-item-play-icon svg{width:16px;height:16px;fill:#fff;margin-left:2px}.list-item-content{flex:1;padding:10px 12px;display:flex;flex-direction:column;justify-content:center;min-width:0}.list-item-title{font-size:14px;font-weight:500;color:#fff;line-height:1.4;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;margin-bottom:6px}.list-item-meta{font-size:12px;color:rgba(224,224,224,.5)}.loading{text-align:center;padding:20px;color:rgba(224,224,224,.5);font-size:12px}.loading-spinner{width:24px;height:24px;border:3px solid rgba(224,224,224,.2);border-top-color:#e0592f;border-radius:50%;animation:spin 1s linear infinite;margin:0 auto 10px}@keyframes spin{to{transform:rotate(360deg)}}.error-tip{text-align:center;padding:40px;color:#e0592f;font-size:14px}.load-more,.no-more{text-align:center;padding:20px;color:rgba(224,224,224,.5);font-size:12px;width:100%}.parse-toast{position:fixed;top:70px;left:50%;transform:translateX(-50%);background:rgba(22,22,42,.95);border:1px solid #e0592f;border-radius:8px;padding:12px 20px;z-index:1000;text-align:center;min-width:200px;box-shadow:0 4px 20px rgba(0,0,0,.5)}.parse-toast.success{border-color:#10b981}.parse-toast.error{border-color:#ef4444}.parse-toast-title{font-size:14px;font-weight:700;color:#fff;margin-bottom:4px}.parse-toast-msg{font-size:12px;color:rgba(224,224,224,.7)}.search-overlay{position:fixed;inset:0;background:#1a1a2e;z-index:150;display:none;overflow-y:auto}.search-overlay.active{display:block}.search-nav{height:52px;background:#16162a;display:flex;align-items:center;justify-content:space-between;padding:0 16px;position:sticky;top:0;z-index:10}.search-title{font-size:16px;font-weight:700;color:#fff}@media (min-width:600px){.list-item-img-wrap{width:160px;min-width:160px}.list-item-img{width:160px;height:120px}.list-item-title{font-size:15px}}</style><div id=mainView><div class=header><div class=logo id=siteLogo>Wuma</div><div class=search-group><input class=search-box id=searchInput placeholder=搜索影片...> <button class=search-btn id=searchBtn><svg fill=none stroke=currentColor viewBox="0 0 24 24"xmlns=http://www.w3.org/2000/svg><path d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"stroke-linecap=round stroke-linejoin=round stroke-width=2></path></svg></button></div></div><div class=category-bar id=categoryBar></div><div class=list-section><div id=listContainer></div><div id=listTip></div></div></div><div class=search-overlay id=searchOverlay><div class=search-nav><div class=search-title id=searchKeywordTitle>搜索结果</div><button class=detail-close-btn id=searchCloseBtn style=background:rgba(255,255,255,.15);border:none;color:#fff;width:32px;height:32px;border-radius:50%;cursor:pointer;font-size:20px>×</button></div><div class=list-section><div id=searchListContainer></div><div id=searchListTip></div></div></div><div class=parse-toast id=parseToast style=display:none><div class=parse-toast-title id=toastTitle>解析中...</div><div class=parse-toast-msg id=toastMsg>正在获取直链</div></div><script>!function(){"use strict";const d={siteName:"Wuma",siteUrl:"https://wuma.vc",apiBase:"https://wuma.vc/api/v1",listPageSize:5,searchPageSize:10,categories:[{id:"20",name:"日韩"},{id:"21",name:"亚洲"},{id:"22",name:"自拍"},{id:"23",name:"欧美"},{id:"24",name:"动漫"}],cache:{ttl:3e5,prefix:"wuma_"}},l={currentCategory:"",currentStart:0,isLoading:!1,hasMore:!0,vodList:[],searchMode:!1,searchKeyword:"",searchStart:0,searchHasMore:!0,searchVodList:[]},h=e=>document.querySelector(e);let s=null;function a(e,t,a=""){const i=h("#parseToast");i&&(h("#toastTitle").textContent=e,h("#toastMsg").textContent=t,i.className="parse-toast "+a,i.style.display="block",s&&clearTimeout(s),s=setTimeout(()=>{i.style.display="none"},3e3))}const i={getKey(e,t,a){t="search"===e?"search_"+l.searchKeyword:t||"home";return d.cache.prefix+"list_"+t+"_s"+a},isValid(e){return!!e&&Date.now()-e.timestamp<d.cache.ttl},async get(e){return window.fm?.cache?window.fm.cache.get(e):localStorage.getItem(e)||""},async set(e,t){window.fm?.cache?await window.fm.cache.set(e,t):localStorage.setItem(e,t)},async getCache(e,t,a){try{var i=this.getKey(e,t,a),s=i+"_meta",[r,n]=await Promise.all([this.get(i),this.get(s)]);if(!r||!n)return null;var c=JSON.parse(n);return this.isValid(c)?JSON.parse(r):null}catch(e){return null}},async setCache(e,t,a,i){try{var s=this.getKey(e,t,a),r=s+"_meta",n={timestamp:Date.now()};await Promise.all([this.set(s,JSON.stringify(i)),this.set(r,JSON.stringify(n))])}catch(e){}}};async function r(e){if(console.log("[Wuma] GET:",e),!window.fm?.req)throw new Error("fm.req 不可用");var t={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120.0.0.0 Safari/537.36",Accept:"application/json, text/plain, */*","Accept-Language":"zh-CN,zh;q=0.9,en;q=0.8","Accept-Encoding":"gzip, deflate",Connection:"keep-alive",Referer:d.siteUrl+"/",Origin:d.siteUrl},t=await window.fm.req(e,{method:"GET",responseType:"json",timeout:30,credentials:"include",headers:t});if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.error||"请求失败"}`);return t.body}async function n(e,t){let a=`${d.apiBase}/videos?start=${t}&count=${d.listPageSize}&sort=-publishedAt&skipCount=true&nsfw=both&nsfwFlagsExcluded=0&nsfwFlagsIncluded=0&isLive=false`;e&&(a+=`&categoryOneOf=${e}`);const i=await r(a);return i.data&&Array.isArray(i.data)?i.data.map(e=>({uuid:e.uuid,name:e.name,thumbnailPath:e.thumbnailPath})):[]}async function c(e,t){const a=await r(`${d.apiBase}/search/videos?start=${t}&count=${d.searchPageSize}&search=${encodeURIComponent(e)}&sort=-match&searchTarget=local&nsfw=both&nsfwFlagsIncluded=0`);return a.data&&Array.isArray(a.data)?a.data.map(e=>({uuid:e.uuid,name:e.name,thumbnailPath:e.thumbnailPath})):[]}async function m(e){a("解析中...",`正在获取 ${e.name} 的直链`,"");try{var t=await async function(e){if(!(e=await r(`${d.apiBase}/videos/${e}`)).streamingPlaylists||0===e.streamingPlaylists.length)throw new Error("未找到播放源");if(!(e=e.streamingPlaylists[0].playlistUrl))throw new Error("未找到播放地址");return e}(e.uuid);a("解析成功!","正在调起播放器...","success"),window.fm?.play?await window.fm.play(t,e.name,{}):a("播放失败","当前环境不支持内置播放","error")}catch(e){console.error("[Wuma] 播放错误:",e),a("解析失败",e.message,"error")}}function o(e=!1,t=[]){const s=l.searchMode,r=s?h("#searchListContainer"):h("#listContainer"),a=s?h("#searchListTip"):h("#listTip");var i=s?l.searchVodList:l.vodList,n=s?l.searchHasMore:l.hasMore;if(r&&a){if(!e){if(r.innerHTML="",l.isLoading)return void(a.innerHTML=`
|
||
<div class="loading">
|
||
<div class="loading-spinner"></div>
|
||
<div>加载中...</div>
|
||
</div>
|
||
`);if(0===i.length)return void(a.innerHTML='<div class="error-tip">暂无内容</div>')}const c=e?t:i,o=e?i.length-t.length:0;c.forEach((e,t)=>{const a=o+t;t=(t=e.thumbnailPath)?window.fm?.res?window.fm.res(d.siteUrl+t,{credentials:"include"}):t.startsWith("http")?t:d.siteUrl+t:"";const i=document.createElement("div");i.className="list-item",i.innerHTML=`
|
||
<div class="list-item-img-wrap">
|
||
<img class="list-item-img" src="${t}" loading="lazy" decoding="async" alt="${e.name}" />
|
||
<div class="list-item-play-icon">
|
||
<svg viewBox="0 0 24 24"><path d="M8 5v14l11-7z"/></svg>
|
||
</div>
|
||
</div>
|
||
<div class="list-item-content">
|
||
<div class="list-item-title">${e.name}</div>
|
||
<div class="list-item-meta">点击播放</div>
|
||
</div>
|
||
`,i.addEventListener("click",()=>{m((s?l.searchVodList:l.vodList)[a])}),r.appendChild(i)}),a.innerHTML=n?'<div class="load-more">加载更多</div>':'<div class="no-more">没有更多了</div>'}}async function u(e=!1){if(!e&&0===l.currentStart){e=await i.getCache("list",l.currentCategory,l.currentStart);if(e)return l.vodList=e,void o(!1)}o(!(l.isLoading=!0));try{var t=await n(l.currentCategory,l.currentStart);l.vodList=t,l.hasMore=t.length===d.listPageSize,0===l.currentStart&&await i.setCache("list",l.currentCategory,l.currentStart,l.vodList)}catch(e){console.error("[Wuma] 加载错误:",e),l.vodList=[]}o(l.isLoading=!1)}async function v(){if(!l.isLoading){if(l.searchMode){if(!l.searchHasMore)return}else if(!l.hasMore)return;l.isLoading=!0;const a=l.searchMode?h("#searchListTip"):h("#listTip");a&&(a.innerHTML=`
|
||
<div class="loading">
|
||
<div class="loading-spinner"></div>
|
||
<div>加载中...</div>
|
||
</div>
|
||
`);let t,e;e=l.searchMode?(t=l.searchStart+d.searchPageSize,d.searchPageSize):(t=l.currentStart+d.listPageSize,d.listPageSize);try{let e;e=l.searchMode?await c(l.searchKeyword,t):await n(l.currentCategory,t),e&&0<e.length?(l.searchMode?(l.searchStart=t,l.searchVodList=[...l.searchVodList,...e],l.searchHasMore=e.length===d.searchPageSize):(l.currentStart=t,l.vodList=[...l.vodList,...e],l.hasMore=e.length===d.listPageSize),o(!0,e)):(l.searchMode?l.searchHasMore=!1:l.hasMore=!1,a&&(a.innerHTML='<div class="no-more">没有更多了</div>'))}catch(e){console.error("[Wuma] 加载更多错误:",e),a&&(a.innerHTML='<div class="load-more">加载失败,点击重试</div>')}l.isLoading=!1}}async function t(e){if(e?.trim()){l.searchMode=!0,l.searchKeyword=e.trim(),l.searchStart=0,l.searchVodList=[],l.searchHasMore=!0,l.isLoading=!0,h("#searchKeywordTitle").textContent=`搜索: "${l.searchKeyword}"`,h("#searchOverlay").classList.add("active"),o(!1);try{var t=await c(l.searchKeyword,0);l.searchVodList=t,l.searchHasMore=t.length===d.searchPageSize}catch(e){console.error("[Wuma] 搜索错误:",e),l.searchVodList=[]}o(l.isLoading=!1)}}function g(){h("#searchOverlay").classList.remove("active"),l.searchMode=!1,l.searchKeyword="",l.searchStart=0,l.searchVodList=[]}!async function(){await async function(){if((window.fongmiBridge||window.fm||window.fongmi)&&document.documentElement.classList.add("fm-native"),window.fm||await new Promise(e=>{const t=()=>{window.fm?e():setTimeout(t,100)};window.addEventListener("fmsdk",t,{once:!0}),setTimeout(e,3e3)}),window.fm?.site)try{var e=await window.fm.site();const t=h("#siteLogo");t&&(t.textContent=e.name||d.siteName)}catch(e){}}(),function(){const a=h("#categoryBar");if(a){let t='<div class="category-item active" data-id="">全部</div>';d.categories.forEach(e=>{t+=`<div class="category-item" data-id="${e.id}">${e.name}</div>`}),a.innerHTML=t,a.querySelectorAll(".category-item").forEach(t=>{t.addEventListener("click",()=>{var e=t.dataset.id||"";e===l.currentCategory&&0<l.vodList.length&&!l.searchMode||(a.querySelectorAll(".category-item").forEach(e=>e.classList.remove("active")),t.classList.add("active"),g(),l.currentCategory=e,l.currentStart=0,l.vodList=[],u(!(l.hasMore=!0)))})})}}(),h("#searchBtn")?.addEventListener("click",()=>{t(h("#searchInput")?.value)}),h("#searchInput")?.addEventListener("keypress",e=>{"Enter"===e.key&&t(e.target.value)}),h("#searchCloseBtn")?.addEventListener("click",g),document.addEventListener("click",e=>{e.target.classList.contains("load-more")&&v()}),function(){let a=null;window.addEventListener("scroll",()=>{l.searchMode||(a=a||setTimeout(()=>{a=null;var e=window.scrollY||document.documentElement.scrollTop,t=window.innerHeight;document.documentElement.scrollHeight-e-t<200&&v()},100))},{passive:!0}),h("#searchOverlay")?.addEventListener("scroll",()=>{var e,t,a;!l.searchMode||(e=h("#searchOverlay"))&&(t=e.scrollTop,a=e.clientHeight,e.scrollHeight-t-a<200&&v())},{passive:!0})}(),await u(!1)}().catch(console.error)}()</script> |