-
Notifications
You must be signed in to change notification settings - Fork 448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Youtube] Mark members-only videos #1280
base: dev
Are you sure you want to change the base?
Conversation
YouTube inserts members-only videos (i.e., videos that require channel membership to watch) into the Videos tab. Because the extractor unable to distinguish between them and "normal" videos, they may appear in subscriptions feeds. This enables the extractor to check if videos require membership, allowing clients to filter them. Ref: TeamNewPipe/NewPipe#12040 Ref: TeamNewPipe/NewPipe#12011
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about it a bit more, maybe it makes sense to rename requiresMembership
to isPaidContent
(or something similar)? That would keep the naming consistent with the PaidContentException
that is already thrown for member only content, and it would be generic enough for other services to use. But I'm not sure if that might conflict with something else, e.g. premium videos?
YouTube has started to mix members-only videos into the normal videos in the Videos tab. This filters them, as they cannot be watched without an account, leading to clutter in the feed. Requires TeamNewPipe/NewPipeExtractor#1280. Closes: TeamNewPipe#12011 Closes: TeamNewPipe#12040
YouTube has started to mix members-only videos into the normal videos in the Videos tab. This filters them, as they cannot be watched without an account, leading to clutter in the feed. Requires TeamNewPipe/NewPipeExtractor#1280. Closes: TeamNewPipe#12011 Closes: TeamNewPipe#12040
What about tests? Is it possible to create tests for the new extractions? |
I'm honestly a bit overwhelmed with how to create tests for static class MembersOnlyVideos extends DefaultListExtractorTest<ChannelTabExtractor> {
private static YoutubeChannelTabExtractor extractor;
@BeforeAll
static void setUp() throws IOException, ExtractionException {
YoutubeTestsUtils.ensureStateless();
NewPipe.init(DownloaderFactory.getDownloader(RESOURCE_PATH + "membersOnlyVideos"));
extractor = (YoutubeChannelTabExtractor) YouTube.getChannelTabExtractorFromId(
"@TheLinuxEXP", ChannelTabs.VIDEOS);
extractor.fetchPage();
}
@Override public ChannelTabExtractor extractor() throws Exception { return extractor; }
@Override public StreamingService expectedService() throws Exception { return YouTube; }
@Override public String expectedName() throws Exception { return ChannelTabs.VIDEOS; }
@Override public String expectedId() throws Exception { return "UC5UAwBUum7CPN5buc-_N1Fw"; }
@Override public String expectedUrlContains() throws Exception { return "https://www.youtube.com/channel/UC5UAwBUum7CPN5buc-_N1Fw/videos"; }
@Override public String expectedOriginalUrlContains() throws Exception { return "https://www.youtube.com/@TheLinuxEXP/videos"; }
@Override public boolean expectedHasMoreItems() { return true; }
@Test
@Override
public void testRelatedItems() throws Exception {
final List<StreamInfoItem> allItems = extractor.getInitialPage().getItems()
.stream()
.filter(StreamInfoItem.class::isInstance)
.map(StreamInfoItem.class::cast)
.collect(Collectors.toUnmodifiableList());
final List<StreamInfoItem> membershipVideos = allItems.stream()
.filter(item -> !item.requiresMembership())
.collect(Collectors.toUnmodifiableList());
assertTrue(membershipVideos.size() <= allItems.size());
}
} log
And just checking if there are |
Note about tests: When writing a channel extractor test the channel should be chosen very carefully. I think it's best to chose a channel here that either
Maybe as an alternative a playlist can also be considered. |
YouTube inserts members-only videos (i.e., videos that require channel membership to watch) into the Videos tab. Because the extractor unable to distinguish between them and "normal" videos, they may appear in subscriptions feeds.
This enables the extractor to check if videos require membership, allowing clients to filter them.
Ref: TeamNewPipe/NewPipe#12040
Ref: TeamNewPipe/NewPipe#12011