From 890f2fc01baf57c4c3028c6678ea073a17cfede3 Mon Sep 17 00:00:00 2001 From: Luca Date: Mon, 5 Oct 2020 20:31:45 +0200 Subject: [PATCH] No more comments, Comment repeat infinitely Added: No more comments - new toast with new string that is displayed when no more comments are available Fixed: Comment repeat infinitely - comments now stop to load when all are displayed. --- package-lock.json | 6 +++--- package.json | 2 +- .../watch-video-comments/watch-video-comments.js | 11 +++++++++++ static/locales/en-US.yaml | 3 ++- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3450ab21..9cabfa76 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20706,9 +20706,9 @@ } }, "yt-comment-scraper": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/yt-comment-scraper/-/yt-comment-scraper-1.3.2.tgz", - "integrity": "sha512-i2e+7ZNm5Dvdwsk3W8UyKtxR2xjtcMfUVGUjxVAR31HlEb8wE66XslDr5eIxSCpbhCLV7ItbmvL8NGL3D1TSxw==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/yt-comment-scraper/-/yt-comment-scraper-1.3.3.tgz", + "integrity": "sha512-t0mIJOxsXriJTVIzQpRYz7BcAo2SbhhgY8YR2HJjxEq5zBYsu6mVujs8xzrCo1431hri1mDTanvLluS/WWCgjg==", "requires": { "axios": "^0.19.2", "html2json": "^1.0.2" diff --git a/package.json b/package.json index 32e7bf04..701592d4 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "youtube-chat": "^1.1.0", "youtube-suggest": "^1.1.0", "yt-channel-info": "^1.1.2", - "yt-comment-scraper": "^1.3.2", + "yt-comment-scraper": "^1.3.3", "yt-dash-manifest-generator": "^1.1.0", "yt-trending-scraper": "^1.0.3", "yt-xml2vtt": "^1.1.2", diff --git a/src/renderer/components/watch-video-comments/watch-video-comments.js b/src/renderer/components/watch-video-comments/watch-video-comments.js index bc647247..55d801c5 100644 --- a/src/renderer/components/watch-video-comments/watch-video-comments.js +++ b/src/renderer/components/watch-video-comments/watch-video-comments.js @@ -4,6 +4,7 @@ import FtCard from '../ft-card/ft-card.vue' import FtLoader from '../../components/ft-loader/ft-loader.vue' import FtSelect from '../../components/ft-select/ft-select.vue' import FtTimestampCatcher from '../../components/ft-timestamp-catcher/ft-timestamp-catcher.vue' + import CommentScraper from 'yt-comment-scraper' export default Vue.extend({ @@ -115,6 +116,16 @@ export default Vue.extend({ this.commentData = [] } this.commentScraper.scrape_next_page_youtube_comments(this.id).then((response) => { + if (response === null) { + this.showToast({ + message: this.$t('No more comments available'), + time: 7000, + action: () => { + } + }) + this.isLoading = false + return + } console.log(response) const commentData = response.map((comment) => { comment.showReplies = false diff --git a/static/locales/en-US.yaml b/static/locales/en-US.yaml index 2352b82b..37092927 100644 --- a/static/locales/en-US.yaml +++ b/static/locales/en-US.yaml @@ -493,7 +493,8 @@ Comments: Reply: Reply There are no comments available for this video: There are no comments available for this video - Load More Comments: Load More Comments + Load More Comments: Load More + No more comments available: No more comments available Up Next: Up Next # Toast Messages