From 0555badcfaec59131c1b6a25a68b1e09e80e55a0 Mon Sep 17 00:00:00 2001 From: hunlongyu Date: Tue, 14 Jul 2020 16:35:51 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=9A=20=E4=BF=AE=E5=A4=8D=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=A8=A1=E5=BC=8F=E4=B8=8B,=20=E4=B8=8B=E8=BD=BDBUG?= =?UTF-8?q?=20=F0=9F=8D=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Film.vue | 17 ++++++++++++++--- src/lib/site/tools.js | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/components/Film.vue b/src/components/Film.vue index a0853cd..d6b4d43 100644 --- a/src/components/Film.vue +++ b/src/components/Film.vue @@ -322,7 +322,7 @@ export default { }, downloadEvent (e) { zy.download(this.site.key, e.id).then(res => { - if (res) { + if (res.length > 0) { const text = res.dl.dd._t if (text) { const list = text.split('#') @@ -337,9 +337,20 @@ export default { this.$message.warning('没有查询到下载链接.') } } else { - const list = [...this.m3u8List] + let m3u8List = [] + const dd = e.dl.dd + const type = Object.prototype.toString.call(dd) + if (type === '[object Array]') { + for (const i of dd) { + if (i._flag.indexOf('m3u8') >= 0) { + m3u8List = i._t.split('#') + } + } + } else { + m3u8List = dd._t.split('#') + } let downloadUrl = e.name + '\n' - for (const i of list) { + for (const i of m3u8List) { const url = encodeURI(i.split('$')[1]) downloadUrl += (url + '\n') } diff --git a/src/lib/site/tools.js b/src/lib/site/tools.js index 6b0bae9..7adce33 100644 --- a/src/lib/site/tools.js +++ b/src/lib/site/tools.js @@ -184,7 +184,7 @@ const zy = { reject(err) }) } else { - resolve(null) + resolve([]) } }) })