Skip to content

Commit 5627a93

Browse files
FineFindusBnyro
authored andcommitted
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
1 parent ca56ab6 commit 5627a93

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

app/src/main/java/com/github/libretube/repo/LocalFeedRepository.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import org.schabi.newpipe.extractor.channel.tabs.ChannelTabInfo
2121
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabs
2222
import org.schabi.newpipe.extractor.feed.FeedInfo
2323
import org.schabi.newpipe.extractor.stream.StreamInfoItem
24+
import org.schabi.newpipe.extractor.stream.StreamInfoItem.ContentAvailability
2425
import java.time.Duration
2526
import java.time.Instant
2627
import java.util.concurrent.atomic.AtomicInteger
@@ -146,6 +147,7 @@ class LocalFeedRepository : FeedRepository {
146147
ChannelTabInfo.getInfo(NewPipeExtractorInstance.extractor, tab).relatedItems
147148
}.getOrElse { emptyList() }
148149
}.flatten().filterIsInstance<StreamInfoItem>()
150+
.filter { it.contentAvailability == ContentAvailability.AVAILABLE || it.contentAvailability == ContentAvailability.UPCOMING }
149151

150152
val channelAvatar = channelInfo.avatars.maxByOrNull { it.height }?.url
151153
return related.map { item ->

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ buildscript {
1818

1919
allprojects {
2020
repositories {
21+
mavenLocal()
2122
google()
2223
mavenCentral()
2324
maven { setUrl("https://jitpack.io") }

0 commit comments

Comments
 (0)