根据videoFlag获取下载链接

This commit is contained in:
buvta
2020-12-31 20:11:06 +08:00
parent e1c942dc7b
commit 2c6ad44974
6 changed files with 21 additions and 12 deletions

View File

@@ -245,7 +245,7 @@ export default {
}
},
downloadEvent () {
zy.download(this.detail.key, this.info.id).then(res => {
zy.download(this.detail.key, this.info.id, this.videoFlag).then(res => {
clipboard.writeText(res.downloadUrls)
this.$message.success(res.info)
}).catch((err) => {

View File

@@ -747,8 +747,11 @@ export default {
info: e
}
},
downloadEvent (site, row) {
zy.download(site.key, row.id).then(res => {
async downloadEvent (site, row) {
const db = await history.find({ site: site.key, ids: row.id })
let videoFlag
if (db) videoFlag = db.videoFlag
zy.download(site.key, row.id, videoFlag).then(res => {
clipboard.writeText(res.downloadUrls)
this.$message.success(res.info)
}).catch((err) => {

View File

@@ -250,7 +250,7 @@ export default {
}
},
downloadEvent (e) {
zy.download(e.site, e.ids).then(res => {
zy.download(e.site, e.ids, e.videoFlag).then(res => {
clipboard.writeText(res.downloadUrls)
this.$message.success(res.info)
}).catch((err) => {

View File

@@ -279,8 +279,11 @@ export default {
info: e.detail
}
},
downloadEvent (e) {
zy.download(e.key, e.ids).then(res => {
async downloadEvent (e) {
const db = await history.find({ site: e.key, ids: e.ids })
let videoFlag
if (db) videoFlag = db.videoFlag
zy.download(e.key, e.ids, videoFlag).then(res => {
clipboard.writeText(res.downloadUrls)
this.$message.success(res.info)
}).catch((err) => {

View File

@@ -138,7 +138,7 @@
</template>
<script>
import { mapMutations } from 'vuex'
import { star, sites, setting } from '../lib/dexie'
import { history, star, sites, setting } from '../lib/dexie'
import zy from '../lib/site/tools'
import { remote } from 'electron'
import fs from 'fs'
@@ -339,8 +339,11 @@ export default {
this.updateEvent(e)
})
},
downloadEvent (e) {
zy.download(e.key, e.ids).then(res => {
async downloadEvent (e) {
const db = await history.find({ site: e.key, ids: e.ids })
let videoFlag
if (db) videoFlag = db.videoFlag
zy.download(e.key, e.ids, videoFlag).then(res => {
clipboard.writeText(res.downloadUrls)
this.$message.success(res.info)
}).catch((err) => {

View File

@@ -291,7 +291,7 @@ const zy = {
* @param {*} id 资源唯一标识符 id
* @returns
*/
download (key, id) {
download (key, id, videoFlag) {
return new Promise((resolve, reject) => {
let info = ''
let downloadUrls = ''
@@ -325,8 +325,8 @@ const zy = {
})
} else {
zy.detail(key, id).then(res => {
const list = [...res[0].list]
for (const i of list) {
const dl = res.fullList.find(e => e.flag === videoFlag) || res[0]
for (const i of dl.list) {
const url = encodeURI(i.split('$')[1])
downloadUrls += (url + '\n')
}