Prepare search code for pagination

This commit is contained in:
Preston 2020-12-14 14:52:22 -05:00
parent e0e6433b6c
commit 2b31078e05
4 changed files with 15 additions and 7 deletions

6
package-lock.json generated
View File

@ -18544,9 +18544,9 @@
"integrity": "sha512-MH9xq4gxR54oktdPnkMXftKJ7aqp3iCDURKjEg/5NBoCPsOZUGFMtyAaVUBVNQsoAg1Dd0vxEPinbC/aJa/InQ==" "integrity": "sha512-MH9xq4gxR54oktdPnkMXftKJ7aqp3iCDURKjEg/5NBoCPsOZUGFMtyAaVUBVNQsoAg1Dd0vxEPinbC/aJa/InQ=="
}, },
"ytdl-core": { "ytdl-core": {
"version": "4.1.4", "version": "4.1.5",
"resolved": "https://registry.npmjs.org/ytdl-core/-/ytdl-core-4.1.4.tgz", "resolved": "https://registry.npmjs.org/ytdl-core/-/ytdl-core-4.1.5.tgz",
"integrity": "sha512-f9M2ctrQNH9/X+jOZ/4iA4h6DvNcyuJ+fDvacheeaxtV7sX13qaNmQgNAe7UeTlJWh7Dn3RHQ6imqJJh5beGQg==", "integrity": "sha512-3MSGIFg3jBWuYZthumSZh69pLwC8/0Wz4Ov+Q6StsGsGcbwBN0OGtz3XvtlYS5YWLrxLeIs/FRBMXrgeEOSA+w==",
"requires": { "requires": {
"html-entities": "^1.3.1", "html-entities": "^1.3.1",
"m3u8stream": "^0.8.3", "m3u8stream": "^0.8.3",

View File

@ -47,9 +47,9 @@
"yt-dash-manifest-generator": "^1.1.0", "yt-dash-manifest-generator": "^1.1.0",
"yt-trending-scraper": "^1.0.4", "yt-trending-scraper": "^1.0.4",
"yt-xml2vtt": "^1.1.3", "yt-xml2vtt": "^1.1.3",
"ytdl-core": "^4.1.4", "ytdl-core": "^4.1.5",
"ytpl": "^2.0.0", "ytpl": "^2.0.1",
"ytsr": "^2.0.0" "ytsr": "^2.0.1"
}, },
"description": "A private YouTube client", "description": "A private YouTube client",
"devDependencies": { "devDependencies": {

View File

@ -24,6 +24,13 @@ const actions = {
resolve(false) resolve(false)
} }
if (typeof payload.options.nextPageRef !== 'undefined') {
const continuation = payload.options.nextPageRef
const nextPageResults = ytsr.continueReq(continuation)
console.log(nextPageResults)
resolve(nextPageResults)
}
const defaultFilters = { const defaultFilters = {
sortBy: 'relevance', sortBy: 'relevance',
time: '', time: '',

View File

@ -113,6 +113,7 @@ export default Vue.extend({
performSearchLocal: function (payload) { performSearchLocal: function (payload) {
if (!payload.nextPage) { if (!payload.nextPage) {
this.isLoading = true this.isLoading = true
// payload.options.pages = 1
} }
this.$store.dispatch('ytSearch', payload).then((result) => { this.$store.dispatch('ytSearch', payload).then((result) => {
@ -171,7 +172,7 @@ export default Vue.extend({
this.shownResults = returnDataInvidious this.shownResults = returnDataInvidious
} }
this.nextPageRef = result.nextpageRef this.nextPageRef = result.continuation
this.isLoading = false this.isLoading = false
const historyPayload = { const historyPayload = {