From 2b75e63b194e323498dd82c04957c1246c1e7a19 Mon Sep 17 00:00:00 2001 From: Luca Hohmann <34301369+GilgusMaximus@users.noreply.github.com> Date: Sun, 13 Jun 2021 22:08:12 +0200 Subject: [PATCH] Bumped comment scraper (#1410) --- package-lock.json | 6 ++--- package.json | 2 +- src/process/comment-module-controller.js | 23 ------------------- .../watch-video-comments.js | 5 ++-- 4 files changed, 7 insertions(+), 29 deletions(-) delete mode 100644 src/process/comment-module-controller.js diff --git a/package-lock.json b/package-lock.json index 91738e2d..38e3ff7b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19463,9 +19463,9 @@ } }, "yt-comment-scraper": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/yt-comment-scraper/-/yt-comment-scraper-4.0.4.tgz", - "integrity": "sha512-6siEScAU7aqV8fzUexHlUd4w13JPZMQ0y2d+yDbFEoKU43jkFbVtAZ3IxTRCBpfDV7rKkaoAy8umD9y5goaV2Q==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/yt-comment-scraper/-/yt-comment-scraper-5.0.1.tgz", + "integrity": "sha512-FgUD7TuWD8RdleGi+0IiITE7oOfokTldXeawFwQDwYhufGkm6ttIBEmMzuGzorHN/aPinmAKYBttvaZkG4s5Yw==", "requires": { "axios": "^0.21.1", "node-html-parser": "^2.0.2" diff --git a/package.json b/package.json index 7361183a..2764b963 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "youtube-chat": "git+https://github.com/IcedCoffeee/youtube-chat.git", "youtube-suggest": "^1.1.2", "yt-channel-info": "^2.2.0", - "yt-comment-scraper": "^4.0.4", + "yt-comment-scraper": "^5.0.1", "yt-dash-manifest-generator": "1.1.0", "yt-trending-scraper": "^2.0.0", "ytdl-core": "^4.8.2", diff --git a/src/process/comment-module-controller.js b/src/process/comment-module-controller.js deleted file mode 100644 index 2fc252d1..00000000 --- a/src/process/comment-module-controller.js +++ /dev/null @@ -1,23 +0,0 @@ -const ModuleScraper = require('yt-comment-scraper') -let scraper = null -let currentSort = null -let currentVideoId = null - -process.on('message', (msg) => { - if (msg === 'end') { - process.exit(0) - } - if (msg.id !== currentVideoId || msg.sortNewest !== currentSort) { - if (scraper !== null) { - scraper.cleanupStatics() - } - currentSort = msg.sortNewest - currentVideoId = msg.id - scraper = new ModuleScraper(true, currentSort) - } - scraper.scrape_next_page_youtube_comments(currentVideoId).then((comments) => { - process.send({ comments: JSON.stringify(comments), error: null }) - }).catch((error) => { - process.send({ comments: null, error: error }) - }) -}) 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 46cfbf8e..c6f60db4 100644 --- a/src/renderer/components/watch-video-comments/watch-video-comments.js +++ b/src/renderer/components/watch-video-comments/watch-video-comments.js @@ -164,7 +164,7 @@ export default Vue.extend({ videoId: this.id, setCookie: false, sortByNewest: this.sortNewest, - continuation: this.commentData[index].replyToken, + replyToken: this.commentData[index].replyToken, index: index }) break @@ -202,7 +202,8 @@ export default Vue.extend({ this.showToast({ message: this.$t('Comments.Getting comment replies, please wait') }) - ytcm.getCommentReplies(payload.videoId, payload.continuation).then((response) => { + + ytcm.getCommentReplies(payload).then((response) => { this.parseLocalCommentData(response, payload.index) }).catch((err) => { console.log(err)