新增xhamster视频下载,新增视频在线预览(xgPlayer)(同步更新)

This commit is contained in:
chuzhongzai 2023-02-23 13:09:05 +08:00
parent 57ff0a3686
commit f27bcff9eb
2 changed files with 33 additions and 0 deletions

View File

@ -243,8 +243,13 @@ function validateLink(rawLink){
else if(rawLink.includes("pornhub.com")){
return rawLink.includes("view_video.php")
}
else if(rawLink.includes("xhamster") && rawLink.includes(".com")){
return true
}
}
function coverLink(rawLink){
if(rawLink.includes("xhamster"))
rawLink = "https://zh.xhamster" + rawLink.substring(rawLink.indexOf(".com"))
let url = new URL(rawLink)
maskDomain.value.forEach((mask) => {
if(url.host === mask['raw'])

View File

@ -56,6 +56,7 @@
任务创建时间:{{props.row.createTimeDisplay}}<br>
<el-button @click="downloadTask(props.row.download)" :disabled="props.row.download === undefined">下载</el-button>
<el-button @click="deleteVideo(props.row.id)" :disabled="props.row.download === undefined">删除</el-button>
<el-button @click="openVideoPanel(props.row.download)" :disabled="props.row.download === undefined">在线播放</el-button>
</template>
</el-table-column>
@ -135,6 +136,9 @@
:preview-src-list="currentLinks" :initial-index="index" loading="lazy"/>
</el-scrollbar>
</el-dialog>
<el-dialog v-model="isPlaying" @opened="initPlayer()" @closed="destroyPlayer()" width="95%" title="在线预览">
<div id="player"></div>
</el-dialog>
</template>
<script setup>
@ -142,6 +146,7 @@ import store from "../store";
import {computed, ref} from "vue";
import axios from "axios";
import {ElMessage} from "element-plus";
import Player from "xgplayer";
//
let inputNode = ref(null)
@ -149,6 +154,12 @@ let inputNode = ref(null)
let isEditingPage = ref(false)
//
let isEditingTag = ref(false)
//
let isPlaying = ref(false)
//
let current_video_link = ref("")
let player = ref()
//
let tempTag = ref("")
@ -314,6 +325,23 @@ function shareGallery(data){
ElMessage(res.data.data)
})
}
function openVideoPanel(link){
current_video_link.value = link
isPlaying.value = true
}
function initPlayer(){
player.value = new Player({
id: "player",
url: current_video_link.value,
videoInit: true,
lang: 'zh-cn',
width: '100%',
height: '56%'
})
}
function destroyPlayer(){
player.value.destroy()
}
//
function showThumbnail(gallery){