mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-05-17 05:35:55 +08:00
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:
@ -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 ->
|
||||
|
@ -18,6 +18,7 @@ buildscript {
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
google()
|
||||
mavenCentral()
|
||||
maven { setUrl("https://jitpack.io") }
|
||||
|
Reference in New Issue
Block a user