From 160eae91c5c5c758d89c74266617c82ae095829e Mon Sep 17 00:00:00 2001 From: Preston Date: Thu, 27 Aug 2020 17:40:01 -0400 Subject: [PATCH] Fix playlist user links, fix mini playlist card in watch page. Update dependencies. --- package.json | 16 ++++++++-------- .../watch-video-playlist/watch-video-playlist.js | 16 +++++++++++++++- src/renderer/store/modules/ytdl.js | 10 ++++------ src/renderer/views/Playlist/Playlist.js | 11 +++++++++-- src/renderer/views/Watch/Watch.js | 2 +- 5 files changed, 37 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 74b9df25..67df45f2 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "youtube-comments-fetch": "^1.0.1", "youtube-comments-task": "^1.3.15", "youtube-suggest": "^1.1.0", - "yt-channel-info": "^1.0.3", + "yt-channel-info": "^1.1.0", "yt-trending-scraper": "^1.0.3", "yt-xml2vtt": "^1.1.2", "ytdl-core": "^3.2.2", @@ -55,19 +55,19 @@ "@babel/plugin-proposal-object-rest-spread": "^7.11.0", "@babel/preset-env": "^7.11.0", "@babel/preset-typescript": "^7.10.4", - "@typescript-eslint/eslint-plugin": "^3.10.0", - "@typescript-eslint/parser": "^3.10.0", + "@typescript-eslint/eslint-plugin": "^3.10.1", + "@typescript-eslint/parser": "^3.10.1", "acorn": "^8.0.1", "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "copy-webpack-plugin": "^6.0.3", "css-loader": "^4.2.2", "devtron": "^1.4.0", - "electron": "^10.0.0", + "electron": "^10.0.1", "electron-builder": "^22.8.0", "electron-builder-squirrel-windows": "^22.8.1", "electron-debug": "^3.1.0", - "electron-rebuild": "^2.0.0", + "electron-rebuild": "^2.0.1", "eslint": "^7.7.0", "eslint-config-prettier": "^6.11.0", "eslint-config-standard": "^14.1.1", @@ -81,13 +81,13 @@ "file-loader": "^6.0.0", "html-webpack-plugin": "^4.3.0", "jest": "^26.4.2", - "mini-css-extract-plugin": "^0.10.0", + "mini-css-extract-plugin": "^0.11.0", "node-abi": "^2.19.1", "node-loader": "^1.0.1", "npm-run-all": "^4.1.5", - "prettier": "^2.1.0", + "prettier": "^2.1.1", "sass": "^1.26.10", - "sass-loader": "^10.0.0", + "sass-loader": "^10.0.1", "style-loader": "^1.2.1", "tree-kill": "1.2.2", "typescript": "^4.0.2", diff --git a/src/renderer/components/watch-video-playlist/watch-video-playlist.js b/src/renderer/components/watch-video-playlist/watch-video-playlist.js index 87de5ec6..886ed972 100644 --- a/src/renderer/components/watch-video-playlist/watch-video-playlist.js +++ b/src/renderer/components/watch-video-playlist/watch-video-playlist.js @@ -270,7 +270,21 @@ export default Vue.extend({ this.channelThumbnail = result.author.avatar this.channelId = result.author.id - this.playlistItems = result.items + this.playlistItems = result.items.map((video) => { + if (video.author.name !== null) { + const channelName = video.author.name + const channelId = video.author.ref.replace(/https:\/\/(www\.)?youtube\.com\/(user|channel)\//g, '') + video.author = channelName + video.authorId = channelId + } else { + video.author = '' + video.authorId = '' + } + video.videoId = video.id + video.lengthSeconds = video.duration + return video + }) + this.isLoading = false }).catch((err) => { console.log(err) diff --git a/src/renderer/store/modules/ytdl.js b/src/renderer/store/modules/ytdl.js index 544c66ad..79b4103b 100644 --- a/src/renderer/store/modules/ytdl.js +++ b/src/renderer/store/modules/ytdl.js @@ -132,12 +132,10 @@ const actions = { ytGetVideoInformation ({}, videoId) { return new Promise((resolve, reject) => { console.log('Getting video info please wait...') - ytdl.getInfo(videoId).then((result, err) => { - if (err) { - reject(err) - } else { - resolve(result) - } + ytdl.getInfo(videoId).then((result) => { + resolve(result) + }).catch((err) => { + reject(err) }) }) } diff --git a/src/renderer/views/Playlist/Playlist.js b/src/renderer/views/Playlist/Playlist.js index 4cb4b6c3..54c9983d 100644 --- a/src/renderer/views/Playlist/Playlist.js +++ b/src/renderer/views/Playlist/Playlist.js @@ -93,10 +93,17 @@ export default Vue.extend({ } this.playlistItems = result.items.map((video) => { + if (video.author.name !== null) { + const channelName = video.author.name + const channelId = video.author.ref.replace(/https:\/\/(www\.)?youtube\.com\/(user|channel)\//g, '') + video.author = channelName + video.authorId = channelId + } else { + video.author = '' + video.authorId = '' + } video.videoId = video.id video.lengthSeconds = video.duration - video.author = video.author.name - return video }) diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index 813ba43c..348db186 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -342,7 +342,7 @@ export default Vue.extend({ } }) console.log(err) - if (!this.usingElectron || (this.backendPreference === 'local' && this.backendFallback)) { + if (!this.usingElectron || (this.backendPreference === 'local' && this.backendFallback && !err.includes('private'))) { this.showToast({ message: this.$t('Falling back to Invidious API') })