修复下载功能

This commit is contained in:
haiyangcui
2020-08-27 15:52:56 +02:00
parent df22efa980
commit 033bcb3df7
4 changed files with 27 additions and 13 deletions

View File

@@ -133,7 +133,7 @@ export default {
starEvent () {
star.find({ key: this.detail.key, ids: this.info.id }).then(res => {
const docs = {
key: this.detail.site.key,
key: this.detail.key,
ids: this.info.id,
name: this.info.name,
type: this.info.type,
@@ -156,7 +156,7 @@ export default {
},
downloadEvent () {
zy.download(this.detail.key, this.info.id).then(res => {
if (res) {
if (res && res.dl && res.dl.dd) {
const text = res.dl.dd._t
if (text) {
const list = text.split('#')

View File

@@ -329,7 +329,7 @@ export default {
},
downloadEvent (site, e) {
zy.download(site.key, e.id).then(res => {
if (res.length > 0) {
if (res && res.length > 0 && res.dl && res.dl.dd) {
const text = res.dl.dd._t
if (text) {
const list = text.split('#')

View File

@@ -101,7 +101,7 @@ export default {
},
downloadEvent (e) {
zy.download(e.site, e.ids).then(res => {
if (res) {
if (res && res.dl && res.dl.dd) {
const text = res.dl.dd._t
if (text) {
const list = text.split('#')

View File

@@ -166,7 +166,7 @@ export default {
},
downloadEvent (e) {
zy.download(e.key, e.ids).then(res => {
if (res) {
if (res && res.dl && res.dl.dd) {
const text = res.dl.dd._t
if (text) {
const list = text.split('#')
@@ -181,14 +181,28 @@ export default {
this.$message.warning('没有查询到下载链接.')
}
} else {
const list = [...this.m3u8List]
let downloadUrl = ''
for (const i of list) {
const url = encodeURI(i.split('$')[1])
downloadUrl += (url + '\n')
}
clipboard.writeText(downloadUrl)
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
var m3u8List = {}
zy.detail(e.key, e.ids).then(res => {
const dd = res.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('#')
}
const list = [...m3u8List]
let downloadUrl = ''
for (const i of list) {
const url = encodeURI(i.split('$')[1])
downloadUrl += (url + '\n')
}
clipboard.writeText(downloadUrl)
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
})
}
})
},