Skip to content

Commit

Permalink
add tvbox data api
Browse files Browse the repository at this point in the history
  • Loading branch information
unilei-github committed Oct 16, 2024
1 parent ad2bc97 commit a3fd226
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 27 deletions.
2 changes: 1 addition & 1 deletion components/layout/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const goHome = () => {
<div class="max-w-[1240px] mx-auto h-[40px] flex flex-row items-center justify-between">
<div class="flex flex-row items-center justify-center gap-1">
<img class="w-[40px] h-[40px] cursor-pointer" src="@/assets/my-logo.png" alt="logo" @click="goHome()">
<h1 class="text-[14px] font-serif font-bold cursor-pointer dark:text-white" @click="goHome()">爱盼-网盘资源搜索</h1>
<h1 class="text-[14px] font-bold cursor-pointer dark:text-white" @click="goHome()">爱盼-网盘资源搜索</h1>
</div>
<client-only>
<div class="flex flex-row items-center gap-2">
Expand Down
3 changes: 3 additions & 0 deletions components/layout/netdisk/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const colorMode = useColorMode()
<nuxt-link to="/tv" class="text-sm text-slate-600 font-bold dark:text-white ">
📺 电视TV
</nuxt-link>
<nuxt-link to="/tvbox" class="text-sm text-slate-600 font-bold dark:text-white ">
📺 TVbox接口
</nuxt-link>
</div>
<div class="flex flex-row items-center gap-4">
<el-button v-if="colorMode.preference === 'dark'" link @click="colorMode.preference = 'light'">
Expand Down
53 changes: 27 additions & 26 deletions pages/tv/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,64 +181,65 @@ onBeforeUnmount(() => {
</script>

<template>
<div class="pt-20 dark:bg-slate-800 min-h-screen bg-no-repeat bg-cover bg-center"
<div class="dark:bg-slate-800 min-h-screen bg-no-repeat bg-cover bg-center relative"
:style="{ 'background-image': `url(${bgImage})` }">
<div class="fixed bottom-10 left-0 right-0 w-full h-ful">
<div class="bg-black w-full sm:max-w-screen-md 2xl:max-w-screen-lg mx-auto px-10 pt-10 pb-4 rounded-xl">
<div class="relative">
<video ref="videoPlayer" id="video" class="w-full relative shadow-md"></video>
<div class="absolute top-0 left-0 right-0 bottom-0 bg-black/20 backdrop-blur-sm"></div>
<div class="fixed bottom-10 left-10 right-10 top-10 rounded-xl max-w-screen-lg mx-auto">
<div class="w-full rounded-t-xl dark:bg-slate-700">
<div
class="relative w-full h-full bg-black rounded-t-md overflow-hidden px-6 pt-6 flex items-center justify-center aspect-video">
<video ref="videoPlayer" id="video"
class="w-full h-full relative shadow-md border border-gray-900 rounded-md"></video>
<div v-if="!videoPlayStatus"
class="absolute top-0 left-0 right-0 bottom-0 video-mask shadow-xl rounded-md flex items-center justify-center">
class="absolute top-6 left-6 right-6 bottom-0 video-mask shadow-xl rounded-md flex items-center justify-center">
<button class="bg-red-500 text-white px-2 py-1 rounded-md text-xs hover:text-md"
@click="handleSwithcSource(videoSrc)">开机</button>
</div>
<div v-if="videoLoading"
class="absolute top-0 left-0 right-0 bottom-0 flex items-center justify-center bg-black/50 z-50 bg-[url('@/assets/tvstatic.gif')]">
class="absolute top-6 left-6 right-6 bottom-0 flex items-center justify-center bg-black/50 z-50 bg-[url('@/assets/tvstatic.gif')]">
<div class="text-white text-lg font-semibold">
<button class="ml-2 bg-red-500 text-white px-2 py-1 rounded-md text-xs hover:text-md"
@click="videoLoading = !videoLoading">关闭</button>
</div>
</div>
</div>
<div class="p-4 rounded-b-xl bg-black text-center text-white text-sm font-semibold">
<nuxt-link to="/">AIPAN</nuxt-link>
</div>

<div class="grid grid-cols-12">
<div class="col-span-4 flex items-center gap-2">

<div class="mt-4 grid grid-cols-12">
<div class="col-span-4 space-x-2">
</div>
<div class="col-span-4">
<div class="bg-black w-10 h-10 mx-auto"></div>
<div class="bg-black w-full h-10"></div>
</div>
<div class="col-span-4 flex items-center justify-end gap-2">
<button class="bg-gray-500 text-white px-2 py-1 rounded-md text-xs hover:text-md" type="button"
@click="modalShow = !modalShow">频道</button>
<button class="bg-gray-500 text-white px-2 py-1 rounded-md text-xs hover:text-md" type="button"
@click="handleMute">{{ !videoMuted ? '静音' : '取消静音' }}</button>
</div>
<div class="col-span-4">
<div class="text-center text-white text-sm font-semibold">
<nuxt-link to="/">AIPAN</nuxt-link>
</div>
</div>
<div class="col-span-4 flex justify-end">
<button type="button"
class=" ml-2 bg-gray-500 text-white px-2 py-1 rounded-md text-xs hover:text-md"
<button type="button" class=" bg-gray-500 text-white px-2 py-1 rounded-md text-xs hover:text-md"
@click="handleSwitchVideoStatus">
{{ !videoPlayStatus ? '播放' : '暂停' }}
</button>
<button type="button"
class=" ml-2 bg-gray-500 text-white px-2 py-1 rounded-md text-xs hover:text-md"
<button type="button" class="bg-gray-500 text-white px-2 py-1 rounded-md text-xs hover:text-md"
@click="handleSwitchVideoTheme">
换肤
</button>
<button type="button"
class=" ml-2 bg-gray-500 text-white px-2 py-1 rounded-md text-xs hover:text-md"
<button type="button" class=" bg-gray-500 text-white px-2 py-1 rounded-md text-xs hover:text-md"
@click="handleResetTheme">
重置
</button>
<button type="button"
class=" ml-2 bg-gray-500 text-white px-2 py-1 rounded-md text-xs hover:text-md"
<button type="button" class=" bg-gray-500 text-white px-2 py-1 rounded-md text-xs hover:text-md"
@click="handleFullscreen">
全屏
</button>
</div>
</div>
</div>
<div class="w-14 h-20 bg-black mx-auto"></div>
<div class="w-1/4 h-14 bg-black mx-auto"></div>

</div>


Expand Down
53 changes: 53 additions & 0 deletions pages/tvbox/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<script setup>
useHead({
title: 'TVbox系列数据源接口地址',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ name: 'keywords', content: 'aipan.me,TVbox,数据源,接口地址,猫影视TV,电视盒子接口,数据源接口,免费数据源' },
{ hid: 'description', name: 'description', content: 'aipan.me是全网最全免费数据源,TVbox系列数据源接口地址,TVbox影视仓电视盒子接口,猫影视TV数据源接口' },
{ name: 'format-detection', content: 'telephone=no' }
]
})
const { data: tvbox } = await useAsyncData('tvbox', async () => {
const res = await $fetch('/api/tvbox')
return res.list || [];
})
const copyTipsMsg = (type) => {
ElMessage({
message: type === 'success' ? '复制成功' : '复制失败',
type: type
})
}
const copy = (text) => {
if (navigator.clipboard) {
navigator.clipboard.writeText(text).then(() => {
copyTipsMsg('success')
}, () => {
copyTipsMsg('fail')
})
} else {
copyTipsMsg('fail')
}
}
</script>
<template>
<div class="mx-4 max-w-[1240px] lg:mx-auto py-10">
<h1 class="text-sm text-bold">TVbox系列数据源接口地址 </h1>
<p class="text-xs mt-2 text-gray-400">更新时间:{{ new Date().toLocaleString() }}</p>
<ul class="mt-6 gap-4 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3">
<li class="flex flex-col items-center gap-2 bg-slate-100 p-2 rounded-md" v-for="item in tvbox" :key="item">
<span class="text-sm">{{ item.name }}</span>
<div class="flex flex-row items-center gap-2">
<input class="border border-gray-300 px-4 py-2 rounded-md text-xs" type="text" v-model="item.link">
<button type="button" class="bg-gray-500 text-white px-2 py-1 rounded-md text-xs hover:text-md"
@click="copy(item.link)">复制</button>
</div>

</li>
</ul>
</div>
</template>
12 changes: 12 additions & 0 deletions server/api/tvbox/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default defineEventHandler(async (event) => {
try {
const data = await $fetch('https://netdisk.aipan.me/api/tvbox')
return data
} catch (e) {
console.error(e);
return {
code: 500,
msg: 'error',
};
}
})

0 comments on commit a3fd226

Please sign in to comment.