Temporarily disable comments in the local API

This commit is contained in:
Preston 2020-09-21 18:22:51 -04:00
parent fa36f96c17
commit f6171bdaee
3 changed files with 42 additions and 46 deletions

14
package-lock.json generated
View File

@ -10424,11 +10424,6 @@
} }
} }
}, },
"html2json": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/html2json/-/html2json-1.0.2.tgz",
"integrity": "sha1-ydbSAvplQCOGwgKzRc9RvOgO0e8="
},
"htmlparser2": { "htmlparser2": {
"version": "3.10.1", "version": "3.10.1",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz",
@ -20438,15 +20433,6 @@
"querystring": "^0.2.0" "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": { "yt-dash-manifest-generator": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/yt-dash-manifest-generator/-/yt-dash-manifest-generator-1.1.0.tgz", "resolved": "https://registry.npmjs.org/yt-dash-manifest-generator/-/yt-dash-manifest-generator-1.1.0.tgz",

View File

@ -45,7 +45,6 @@
"youtube-comments-task": "^1.3.15", "youtube-comments-task": "^1.3.15",
"youtube-suggest": "^1.1.0", "youtube-suggest": "^1.1.0",
"yt-channel-info": "^1.1.1", "yt-channel-info": "^1.1.1",
"yt-comment-scraper": "^1.1.3",
"yt-dash-manifest-generator": "^1.1.0", "yt-dash-manifest-generator": "^1.1.0",
"yt-trending-scraper": "^1.0.3", "yt-trending-scraper": "^1.0.3",
"yt-xml2vtt": "^1.1.2", "yt-xml2vtt": "^1.1.2",

View File

@ -2,7 +2,7 @@ import Vue from 'vue'
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
import FtCard from '../ft-card/ft-card.vue' import FtCard from '../ft-card/ft-card.vue'
import FtLoader from '../../components/ft-loader/ft-loader.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({ export default Vue.extend({
name: 'WatchVideoComments', name: 'WatchVideoComments',
@ -67,27 +67,8 @@ export default Vue.extend({
getCommentDataLocal: function () { getCommentDataLocal: function () {
console.log('Getting comment data please wait..') 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({ this.showToast({
message: `${errorMessage}: ${err}`, message: 'Comments through the local API are temporarily disabled'
time: 10000,
action: () => {
navigator.clipboard.writeText(err)
}
}) })
if (this.backendFallback && this.backendPreference === 'local') { if (this.backendFallback && this.backendPreference === 'local') {
this.showToast({ this.showToast({
@ -97,7 +78,37 @@ export default Vue.extend({
} else { } else {
this.isLoading = false 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 () { getCommentDataInvidious: function () {