From 2b31078e05821949c3cf225ab48194dda6b9e675 Mon Sep 17 00:00:00 2001 From: Preston Date: Mon, 14 Dec 2020 14:52:22 -0500 Subject: [PATCH] Prepare search code for pagination --- package-lock.json | 6 +++--- package.json | 6 +++--- src/renderer/store/modules/ytdl.js | 7 +++++++ src/renderer/views/Search/Search.js | 3 ++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index caba295d..5b8525a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18544,9 +18544,9 @@ "integrity": "sha512-MH9xq4gxR54oktdPnkMXftKJ7aqp3iCDURKjEg/5NBoCPsOZUGFMtyAaVUBVNQsoAg1Dd0vxEPinbC/aJa/InQ==" }, "ytdl-core": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/ytdl-core/-/ytdl-core-4.1.4.tgz", - "integrity": "sha512-f9M2ctrQNH9/X+jOZ/4iA4h6DvNcyuJ+fDvacheeaxtV7sX13qaNmQgNAe7UeTlJWh7Dn3RHQ6imqJJh5beGQg==", + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/ytdl-core/-/ytdl-core-4.1.5.tgz", + "integrity": "sha512-3MSGIFg3jBWuYZthumSZh69pLwC8/0Wz4Ov+Q6StsGsGcbwBN0OGtz3XvtlYS5YWLrxLeIs/FRBMXrgeEOSA+w==", "requires": { "html-entities": "^1.3.1", "m3u8stream": "^0.8.3", diff --git a/package.json b/package.json index b41cb7f7..84644707 100644 --- a/package.json +++ b/package.json @@ -47,9 +47,9 @@ "yt-dash-manifest-generator": "^1.1.0", "yt-trending-scraper": "^1.0.4", "yt-xml2vtt": "^1.1.3", - "ytdl-core": "^4.1.4", - "ytpl": "^2.0.0", - "ytsr": "^2.0.0" + "ytdl-core": "^4.1.5", + "ytpl": "^2.0.1", + "ytsr": "^2.0.1" }, "description": "A private YouTube client", "devDependencies": { diff --git a/src/renderer/store/modules/ytdl.js b/src/renderer/store/modules/ytdl.js index 8682ca8e..ead49fac 100644 --- a/src/renderer/store/modules/ytdl.js +++ b/src/renderer/store/modules/ytdl.js @@ -24,6 +24,13 @@ const actions = { 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 = { sortBy: 'relevance', time: '', diff --git a/src/renderer/views/Search/Search.js b/src/renderer/views/Search/Search.js index 192e263d..fb80a54e 100644 --- a/src/renderer/views/Search/Search.js +++ b/src/renderer/views/Search/Search.js @@ -113,6 +113,7 @@ export default Vue.extend({ performSearchLocal: function (payload) { if (!payload.nextPage) { this.isLoading = true + // payload.options.pages = 1 } this.$store.dispatch('ytSearch', payload).then((result) => { @@ -171,7 +172,7 @@ export default Vue.extend({ this.shownResults = returnDataInvidious } - this.nextPageRef = result.nextpageRef + this.nextPageRef = result.continuation this.isLoading = false const historyPayload = {