File tree Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -2048,21 +2048,20 @@ async function searchChannelLocal() {
2048
2048
contents = result .contents .contents
2049
2049
}
2050
2050
2051
- const results = []
2052
- contents
2051
+ const results = contents
2053
2052
.filter (node => node .type === ' ItemSection' )
2054
2053
.flatMap (itemSection => itemSection .contents )
2055
- .forEach ( item => {
2054
+ .reduce (( items , item ) => {
2056
2055
if (item .type === ' Video' ) {
2057
2056
const video = parseLocalListVideo (item)
2058
2057
if (video .isMemberOnly || video .isMemberFirst ) { return null }
2059
2058
2060
- results .push (video)
2059
+ items .push (video)
2061
2060
} else if (! hideChannelPlaylists .value && item .type === ' Playlist' ) {
2062
- results .push (parseLocalListPlaylist (item, id .value , channelName .value ))
2061
+ items .push (parseLocalListPlaylist (item, id .value , channelName .value ))
2063
2062
}
2064
- })
2065
- . filter ( item => item != null )
2063
+ return items
2064
+ }, [] )
2066
2065
2067
2066
if (isNewSearch) {
2068
2067
searchResults .value = results
Original file line number Diff line number Diff line change @@ -148,8 +148,13 @@ async function getInvidiousHashtag(page = 1) {
148
148
async function getLocalHashtag () {
149
149
try {
150
150
const hashtagData = await getHashtagLocal (hashtag .value )
151
- videos .value = hashtagData .videos .map ((video ) => parseLocalListVideo (video))
152
- .filter (v => ! v .isMemberOnly && ! v .isMemberFirst )
151
+ videos .value = hashtagData .videos .reduce ((results , video ) => {
152
+ const v = parseLocalListVideo (video)
153
+ if (v .isMemberOnly || v .isMemberFirst ) {
154
+ results .push (v)
155
+ }
156
+ return results
157
+ }, [])
153
158
apiUsed .value = ' local'
154
159
hashtagContinuationData .value = hashtagData .has_continuation ? hashtagData : null
155
160
isLoading .value = false
@@ -172,8 +177,13 @@ async function getLocalHashtag() {
172
177
async function getLocalHashtagMore () {
173
178
try {
174
179
const continuation = await hashtagContinuationData .value .getContinuation ()
175
- const newVideos = continuation .videos .map ((video ) => parseLocalListVideo (video))
176
- .filter (v => ! v .isMemberOnly && ! v .isMemberFirst )
180
+ const newVideos = continuation .videos .reduce ((results , video ) => {
181
+ const v = parseLocalListVideo (video)
182
+ if (v .isMemberOnly || v .isMemberFirst ) {
183
+ results .push (v)
184
+ }
185
+ return results
186
+ }, [])
177
187
hashtagContinuationData .value = continuation .has_continuation ? continuation : null
178
188
videos .value = videos .value .concat (newVideos)
179
189
} catch (error) {
You can’t perform that action at this time.
0 commit comments