Update copy/open YT video in playlist view to have playlist ID when present (#2848)

* * Update copy/open YT video in playlist view to have playlist ID when present

* * Update YT share URL for video with playlist
This commit is contained in:
PikachuEXE 2022-12-06 15:47:34 +08:00 committed by GitHub
parent 08bba94a54
commit fa9a992a52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,7 +98,13 @@ export default Vue.extend({
},
invidiousUrl: function () {
return `${this.currentInvidiousInstance}/watch?v=${this.id}`
let videoUrl = `${this.currentInvidiousInstance}/watch?v=${this.id}`
// `playlistId` can be undefined
if (this.playlistId && this.playlistId.length !== 0) {
// `index` seems can be ignored
videoUrl += `&list=${this.playlistId}`
}
return videoUrl
},
invidiousChannelUrl: function () {
@ -106,10 +112,21 @@ export default Vue.extend({
},
youtubeUrl: function () {
return `https://www.youtube.com/watch?v=${this.id}`
let videoUrl = `https://www.youtube.com/watch?v=${this.id}`
// `playlistId` can be undefined
if (this.playlistId && this.playlistId.length !== 0) {
// `index` seems can be ignored
videoUrl += `&list=${this.playlistId}`
}
return videoUrl
},
youtubeShareUrl: function () {
// `playlistId` can be undefined
if (this.playlistId && this.playlistId.length !== 0) {
// `index` seems can be ignored
return `https://youtu.be/${this.id}?list=${this.playlistId}`
}
return `https://youtu.be/${this.id}`
},