diff --git a/src/components/Play.vue b/src/components/Play.vue index f616a21..0070f77 100644 --- a/src/components/Play.vue +++ b/src/components/Play.vue @@ -183,7 +183,7 @@
@@ -365,7 +365,8 @@ export default { skipendStatus: false, // 是否跳过了片尾 currentShortcutList: [], onlineUrl: '', - playerType: 'hls' + playerType: 'hls', + exportablePlaylist: false } }, filters: { @@ -609,8 +610,10 @@ export default { }, playVideo (index = 0, time = 0) { this.isLive = false + this.exportablePlaylist = false this.fetchPlaylist().then(async (playlistUrls) => { const url = playlistUrls[index] + if (playlistUrls.every(e => e.endsWith('.m3u8'))) this.exportablePlaylist = true if (!url.endsWith('.m3u8') && !url.endsWith('.mp4')) { const currentSite = await sites.find({ key: this.video.key }) if (currentSite.jiexiUrl) { @@ -1004,15 +1007,15 @@ export default { link: link }) } - let m3u8Content = '#EXTM3U' + let m3u8Content = '#EXTM3U\n' for (const item of m3u8Arr) { - m3u8Content += `#EXTINF:-1, ${item.name}\n${item.link}` + m3u8Content += `#EXTINF:-1, ${item.name}\n${item.link}\n` } const blob = new Blob([m3u8Content], { type: 'application/vnd.apple.mpegurl' }) const downloadElement = document.createElement('a') const href = window.URL.createObjectURL(blob) downloadElement.href = href - downloadElement.download = `${this.name}.m3u8` + downloadElement.download = `${this.name}.m3u` document.body.appendChild(downloadElement) downloadElement.click() document.body.removeChild(downloadElement)