Comment sorting, Sorting Button, Comment publishedText
Added: Comment sorting - The comments can now be sorted by newest or most popular (default) Fixed: 1) Sorting Button - Now displays in the selected sorting method after changing it 2) Comment publishedText - Comments published x day(s) ago should now display their publish text correctly (upstream mistake)
This commit is contained in:
parent
2b2000ab43
commit
5353acab55
|
@ -20706,9 +20706,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"yt-comment-scraper": {
|
"yt-comment-scraper": {
|
||||||
"version": "1.2.0",
|
"version": "1.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/yt-comment-scraper/-/yt-comment-scraper-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/yt-comment-scraper/-/yt-comment-scraper-1.3.2.tgz",
|
||||||
"integrity": "sha512-XVQijojldm4ztqT8GnS4YJAJYxJelEE4zTdYHiup0BRYnNMbo8p4/W3lHLcbx/6FamKBdCyCSieM4RM98li4Pw==",
|
"integrity": "sha512-i2e+7ZNm5Dvdwsk3W8UyKtxR2xjtcMfUVGUjxVAR31HlEb8wE66XslDr5eIxSCpbhCLV7ItbmvL8NGL3D1TSxw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"axios": "^0.19.2",
|
"axios": "^0.19.2",
|
||||||
"html2json": "^1.0.2"
|
"html2json": "^1.0.2"
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
"youtube-chat": "^1.1.0",
|
"youtube-chat": "^1.1.0",
|
||||||
"youtube-suggest": "^1.1.0",
|
"youtube-suggest": "^1.1.0",
|
||||||
"yt-channel-info": "^1.1.2",
|
"yt-channel-info": "^1.1.2",
|
||||||
"yt-comment-scraper": "^1.2.0",
|
"yt-comment-scraper": "^1.3.2",
|
||||||
"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",
|
||||||
|
|
|
@ -5,7 +5,7 @@ import FtLoader from '../../components/ft-loader/ft-loader.vue'
|
||||||
import FtSelect from '../../components/ft-select/ft-select.vue'
|
import FtSelect from '../../components/ft-select/ft-select.vue'
|
||||||
import FtTimestampCatcher from '../../components/ft-timestamp-catcher/ft-timestamp-catcher.vue'
|
import FtTimestampCatcher from '../../components/ft-timestamp-catcher/ft-timestamp-catcher.vue'
|
||||||
|
|
||||||
import CommentScraper from 'yt-comment-scraper'
|
import CommentScraper from 'D:\\Workspace\\JavaScript\\yt-comment-scraper\\index.js'//'yt-comment-scraper' //'D:\\Workspace\\JavaScript\\yt-comment-scraper\\index.js'
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
name: 'WatchVideoComments',
|
name: 'WatchVideoComments',
|
||||||
|
@ -27,7 +27,8 @@ export default Vue.extend({
|
||||||
showComments: false,
|
showComments: false,
|
||||||
commentScraper: null,
|
commentScraper: null,
|
||||||
nextPageToken: null,
|
nextPageToken: null,
|
||||||
commentData: []
|
commentData: [],
|
||||||
|
sortNewest: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -55,6 +56,10 @@ export default Vue.extend({
|
||||||
'top',
|
'top',
|
||||||
'newest'
|
'newest'
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
currentSortValue: function () {
|
||||||
|
return (this.sortNewest) ? 'newest' : 'top'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -63,17 +68,15 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSortChange: function (sortType) {
|
handleSortChange: function (sortType) {
|
||||||
console.log(sortType)
|
this.sortNewest = !this.sortNewest
|
||||||
this.showToast({
|
this.getCommentData(true)
|
||||||
message: 'Not currently implemented'
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getCommentData: function () {
|
getCommentData: function (sortChanged = false) {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
switch (this.backendPreference) {
|
switch (this.backendPreference) {
|
||||||
case 'local':
|
case 'local':
|
||||||
this.getCommentDataLocal()
|
this.getCommentDataLocal(sortChanged)
|
||||||
break
|
break
|
||||||
case 'invidious':
|
case 'invidious':
|
||||||
this.getCommentDataInvidious(this.nextPageToken)
|
this.getCommentDataInvidious(this.nextPageToken)
|
||||||
|
@ -107,9 +110,10 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getCommentDataLocal: function () {
|
getCommentDataLocal: function (sortChanged = false) {
|
||||||
if (this.commentScraper === null) {
|
if (this.commentScraper === null || sortChanged === true) {
|
||||||
this.commentScraper = new CommentScraper(false)
|
this.commentScraper = new CommentScraper(false, this.sortNewest)
|
||||||
|
this.commentData = []
|
||||||
}
|
}
|
||||||
this.commentScraper.scrape_next_page_youtube_comments(this.id).then((response) => {
|
this.commentScraper.scrape_next_page_youtube_comments(this.id).then((response) => {
|
||||||
console.log(response)
|
console.log(response)
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
v-if="commentData.length > 0 && !isLoading && showComments"
|
v-if="commentData.length > 0 && !isLoading && showComments"
|
||||||
class="commentSort"
|
class="commentSort"
|
||||||
:placeholder="$t('Comments.Sort by')"
|
:placeholder="$t('Comments.Sort by')"
|
||||||
:value="sortValues[0]"
|
:value="currentSortValue"
|
||||||
:select-names="sortNames"
|
:select-names="sortNames"
|
||||||
:select-values="sortValues"
|
:select-values="sortValues"
|
||||||
@change="handleSortChange"
|
@change="handleSortChange"
|
||||||
|
|
Loading…
Reference in New Issue