From 23e693a31468608c422f799f33aa3c77f0b30dcb Mon Sep 17 00:00:00 2001 From: buvta <12312540+buvta@users.noreply.github.com> Date: Wed, 30 Dec 2020 23:52:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E6=92=AD=E6=94=BE=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E5=88=97=E8=A1=A8=E6=97=B6=E4=BC=98=E5=85=88=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=BA=94=E7=94=A8=E6=94=AF=E6=8C=81=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Play.vue | 4 +++- src/lib/site/tools.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Play.vue b/src/components/Play.vue index 68d6330..90a6f33 100644 --- a/src/components/Play.vue +++ b/src/components/Play.vue @@ -621,8 +621,10 @@ export default { this.isLive = false this.exportablePlaylist = false this.fetchPlaylist().then(async (fullList) => { - // 默认播放第一个video flag下面的视频 var playlist = fullList[0].list + if (fullList.length > 1) { + playlist = fullList.find(x => x.flag === 'm3u8' || x.flag === 'mp4').list // 播放器支持的格式优先 + } const videoFlag = this.video.info.videoFlag // 如果设定了特定的video flag, 获取该flag下的视频列表 if (videoFlag) { diff --git a/src/lib/site/tools.js b/src/lib/site/tools.js index c3532da..72bf644 100644 --- a/src/lib/site/tools.js +++ b/src/lib/site/tools.js @@ -244,6 +244,8 @@ const zy = { const type = Object.prototype.toString.call(dd) if (type === '[object Array]') { for (const i of dd) { + const ext = Array.from(new Set(...i._t.split('#').map(e => e.split('$')[1].match(/\.\w+?$/)))) + if (ext.length === 1) i._flag = ext[0].slice(1) fullList.push( { flag: i._flag, @@ -284,7 +286,7 @@ const zy = { download (key, id) { return new Promise((resolve, reject) => { let info = '' - let downloadUrls = [] + let downloadUrls = '' this.getSite(key).then(res => { const site = res if (site.download) {