feat(LocalFeedRepository): filter members only videos

YouTube inserts Members only videos into the normal video feed.
As there not watchable without signing in, they clutter the feed, this
filters them out before the're displayed.
Ref: https://github.com/FineFindus/NewPipeExtractor/tree/feat/member-channeltab-info
This commit is contained in:
FineFindus 2025-02-18 17:51:24 +01:00 committed by Bnyro
parent ca56ab6a11
commit 5627a93065
No known key found for this signature in database
2 changed files with 3 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import org.schabi.newpipe.extractor.channel.tabs.ChannelTabInfo
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabs
import org.schabi.newpipe.extractor.feed.FeedInfo
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipe.extractor.stream.StreamInfoItem.ContentAvailability
import java.time.Duration
import java.time.Instant
import java.util.concurrent.atomic.AtomicInteger
@ -146,6 +147,7 @@ class LocalFeedRepository : FeedRepository {
ChannelTabInfo.getInfo(NewPipeExtractorInstance.extractor, tab).relatedItems
}.getOrElse { emptyList() }
}.flatten().filterIsInstance<StreamInfoItem>()
.filter { it.contentAvailability == ContentAvailability.AVAILABLE || it.contentAvailability == ContentAvailability.UPCOMING }
val channelAvatar = channelInfo.avatars.maxByOrNull { it.height }?.url
return related.map { item ->

View File

@ -18,6 +18,7 @@ buildscript {
allprojects {
repositories {
mavenLocal()
google()
mavenCentral()
maven { setUrl("https://jitpack.io") }