Skip to content

Commit ac4201e

Browse files
FineFindusBnyro
authored andcommitted
feat: filter members-only videos from channel tab
Applies the filtering of members-only videos to the channel page. As some channels upload a lot/mainly members-only content, it can be a hassle to find videos that are watchable in the app, which isn't a great user experience. Ref: libre-tube#7113
1 parent 933a2e1 commit ac4201e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/src/main/java/com/github/libretube/api/NewPipeMediaServiceRepository.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExt
5252
import org.schabi.newpipe.extractor.stream.AudioStream
5353
import org.schabi.newpipe.extractor.stream.StreamInfo
5454
import org.schabi.newpipe.extractor.stream.StreamInfoItem
55+
import org.schabi.newpipe.extractor.stream.StreamInfoItem.ContentAvailability
5556
import org.schabi.newpipe.extractor.stream.VideoStream
5657

5758

@@ -449,7 +450,9 @@ class NewPipeMediaServiceRepository : MediaServiceRepository {
449450
}
450451

451452
return ChannelTabResponse(
452-
content = items.mapNotNull { it.toContentItem() },
453+
content = items.filterIsInstance<StreamInfoItem>()
454+
.filter { it.contentAvailability == ContentAvailability.AVAILABLE || it.contentAvailability == ContentAvailability.UPCOMING }
455+
.mapNotNull { it.toContentItem() },
453456
nextpage = newNextPage?.toNextPageString()
454457
)
455458
}

0 commit comments

Comments
 (0)