修复zy.detail获取到的链接不包含"$"时产生的bug

This commit is contained in:
buvta
2021-01-18 21:01:00 +08:00
parent 516b791719
commit 51208892d0
3 changed files with 16 additions and 9 deletions

View File

@@ -61,7 +61,7 @@
</div>
<div class="m3u8">
<div class="box">
<span v-bind:class="{ selected: j === selectedEpisode }" v-for="(i, j) in videoList" :key="j" @click="playEvent(j)" @mouseenter="() => { selectedEpisode = j }">{{i | ftName}}</span>
<span v-bind:class="{ selected: j === selectedEpisode }" v-for="(i, j) in videoList" :key="j" @click="playEvent(j)" @mouseenter="() => { selectedEpisode = j }">{{ i | ftName(j) }}</span>
</div>
</div>
</div>
@@ -93,9 +93,13 @@ export default {
}
},
filters: {
ftName (e) {
const name = e.split('$')[0]
return name
ftName (e, n) {
const num = e.split('$')
if (num.length > 1) {
return e.split('$')[0]
} else {
return `${(n + 1)}`
}
}
},
computed: {

View File

@@ -640,8 +640,8 @@ export default {
playlist = fullList.find(x => x.flag === videoFlag).list
}
this.right.list = playlist
const url = playlist[index].split('$')[1]
if (playlist.every(e => e.split('$')[1].endsWith('.m3u8'))) this.exportablePlaylist = true
const url = playlist[index].includes('$') ? playlist[index].split('$')[1] : playlist[index]
if (playlist.every(e => e.endsWith('.m3u8') || e.split('$')[1].endsWith('.m3u8'))) this.exportablePlaylist = true
if (!url.endsWith('.m3u8') && !url.endsWith('.mp4')) {
const currentSite = await sites.find({ key: this.video.key })
this.$message.info('即将调用解析接口播放,请等待...')

View File

@@ -253,7 +253,10 @@ 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+?$/)))).map(e => e.slice(1))
const ext = Array.from(new Set(...i._t.split('#').map(e => {
const itemUrl = e.includes('$') ? e.split('$')[1] : e
return itemUrl.match(/\.\w+?$/)
}))).map(e => e.slice(1))
if (ext.length && ext.length <= supportedFormats.length && ext.every(e => supportedFormats.includes(e))) {
if (ext.length === 1) {
i._flag = ext[0]
@@ -265,7 +268,7 @@ const zy = {
fullList.push(
{
flag: i._flag,
list: i._t.split('#').filter(e => e && e.split('$')[1] && e.split('$')[1].startsWith('http'))
list: i._t.split('#').filter(e => e && (e.startsWith('http') || (e.split('$')[1] && e.split('$')[1].startsWith('http'))))
}
)
}
@@ -273,7 +276,7 @@ const zy = {
fullList.push(
{
flag: dd._flag,
list: dd._t.split('#').filter(e => e && e.split('$')[1] && e.split('$')[1].startsWith('http'))
list: dd._t.split('#').filter(e => e && (e.startsWith('http') || (e.split('$')[1] && e.split('$')[1].startsWith('http'))))
}
)
}