Bumped comment scraper (#1410)

This commit is contained in:
Luca Hohmann 2021-06-13 22:08:12 +02:00 committed by GitHub
parent 52fa523df1
commit 2b75e63b19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 29 deletions

6
package-lock.json generated
View File

@ -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"

View File

@ -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",

View File

@ -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 })
})
})

View File

@ -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)