From f6171bdaee02c4ce91af93e3e6028f31e9ebe605 Mon Sep 17 00:00:00 2001 From: Preston Date: Mon, 21 Sep 2020 18:22:51 -0400 Subject: [PATCH] Temporarily disable comments in the local API --- package-lock.json | 14 ---- package.json | 1 - .../watch-video-comments.js | 73 +++++++++++-------- 3 files changed, 42 insertions(+), 46 deletions(-) diff --git a/package-lock.json b/package-lock.json index ccc3e1a4..8a502fb8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10424,11 +10424,6 @@ } } }, - "html2json": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/html2json/-/html2json-1.0.2.tgz", - "integrity": "sha1-ydbSAvplQCOGwgKzRc9RvOgO0e8=" - }, "htmlparser2": { "version": "3.10.1", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", @@ -20438,15 +20433,6 @@ "querystring": "^0.2.0" } }, - "yt-comment-scraper": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/yt-comment-scraper/-/yt-comment-scraper-1.1.3.tgz", - "integrity": "sha512-OpLMXwd5vJ4vW4F8uYubmNcPAv0blxBEW5721qBaAGCtcQANHWGawUVlAgx8RPM3U9zmRv8VD9ertM1VW8FHzg==", - "requires": { - "axios": "^0.19.2", - "html2json": "^1.0.2" - } - }, "yt-dash-manifest-generator": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/yt-dash-manifest-generator/-/yt-dash-manifest-generator-1.1.0.tgz", diff --git a/package.json b/package.json index 7af3a042..ca67ee25 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,6 @@ "youtube-comments-task": "^1.3.15", "youtube-suggest": "^1.1.0", "yt-channel-info": "^1.1.1", - "yt-comment-scraper": "^1.1.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 c6b7b251..819d964f 100644 --- a/src/renderer/components/watch-video-comments/watch-video-comments.js +++ b/src/renderer/components/watch-video-comments/watch-video-comments.js @@ -2,7 +2,7 @@ import Vue from 'vue' import { mapActions } from 'vuex' import FtCard from '../ft-card/ft-card.vue' import FtLoader from '../../components/ft-loader/ft-loader.vue' -import ytcs from 'yt-comment-scraper' +// import ytcs from 'yt-comment-scraper' export default Vue.extend({ name: 'WatchVideoComments', @@ -67,37 +67,48 @@ export default Vue.extend({ getCommentDataLocal: function () { console.log('Getting comment data please wait..') - ytcs.scrape_next_page_youtube_comments(this.id).then((response) => { - console.log(response) - const commentData = response.comments.map((comment) => { - comment.showReplies = false - comment.dataType = 'local' - - return comment - }) - console.log(commentData) - this.commentData = this.commentData.concat(commentData) - this.isLoading = false - this.showComments = true - }).catch((err) => { - console.log(err) - const errorMessage = this.$t('Local API Error (Click to copy)') - this.showToast({ - message: `${errorMessage}: ${err}`, - time: 10000, - action: () => { - navigator.clipboard.writeText(err) - } - }) - if (this.backendFallback && this.backendPreference === 'local') { - this.showToast({ - message: this.$t('Falling back to Invidious API') - }) - this.getCommentDataInvidious() - } else { - this.isLoading = false - } + this.showToast({ + message: 'Comments through the local API are temporarily disabled' }) + if (this.backendFallback && this.backendPreference === 'local') { + this.showToast({ + message: this.$t('Falling back to Invidious API') + }) + this.getCommentDataInvidious() + } else { + this.isLoading = false + } + // ytcs.scrape_next_page_youtube_comments(this.id).then((response) => { + // console.log(response) + // const commentData = response.comments.map((comment) => { + // comment.showReplies = false + // comment.dataType = 'local' + // + // return comment + // }) + // console.log(commentData) + // this.commentData = this.commentData.concat(commentData) + // this.isLoading = false + // this.showComments = true + // }).catch((err) => { + // console.log(err) + // const errorMessage = this.$t('Local API Error (Click to copy)') + // this.showToast({ + // message: `${errorMessage}: ${err}`, + // time: 10000, + // action: () => { + // navigator.clipboard.writeText(err) + // } + // }) + // if (this.backendFallback && this.backendPreference === 'local') { + // this.showToast({ + // message: this.$t('Falling back to Invidious API') + // }) + // this.getCommentDataInvidious() + // } else { + // this.isLoading = false + // } + // }) }, getCommentDataInvidious: function () {