2121import org .hibernate .StatelessSession ;
2222import org .schabi .newpipe .extractor .channel .ChannelInfo ;
2323
24+ import javax .annotation .Nullable ;
2425import java .io .IOException ;
2526import java .util .*;
2627import java .util .concurrent .TimeUnit ;
@@ -119,7 +120,7 @@ public static byte[] feedResponse(String session) throws IOException {
119120 return null ;
120121 }
121122
122- public static byte [] feedResponseRSS (String session ) throws FeedException {
123+ public static byte [] feedResponseRSS (String session , @ Nullable String filter ) throws FeedException {
123124
124125 if (StringUtils .isBlank (session ))
125126 ExceptionHandler .throwErrorResponse (new InvalidRequestResponse ("session is a required parameter" ));
@@ -131,6 +132,7 @@ public static byte[] feedResponseRSS(String session) throws FeedException {
131132 SyndFeed feed = FeedHelpers .createRssFeed (user .getUsername ());
132133
133134 final List <SyndEntry > entries = FeedHelpers .generateAuthenticatedFeed (s , user .getId (), 100 )
135+ .filter (FeedHelpers .createFeedFilter (filter ))
134136 .map (video -> {
135137 var channel = video .getChannel ();
136138 return ChannelHelpers .createEntry (video , channel );
@@ -173,7 +175,7 @@ public static byte[] unauthenticatedFeedResponse(String[] channelIds) throws Exc
173175 }
174176 }
175177
176- public static byte [] unauthenticatedFeedResponseRSS (String [] channelIds ) throws Exception {
178+ public static byte [] unauthenticatedFeedResponseRSS (String [] channelIds , @ Nullable String filter ) throws Exception {
177179
178180 Set <String > filteredChannels = Arrays .stream (channelIds )
179181 .filter (ChannelHelpers ::isValidId )
@@ -183,7 +185,9 @@ public static byte[] unauthenticatedFeedResponseRSS(String[] channelIds) throws
183185 ExceptionHandler .throwErrorResponse (new InvalidRequestResponse ("No valid channel IDs provided" ));
184186
185187 try (StatelessSession s = DatabaseSessionFactory .createStatelessSession ()) {
186- List <Video > videos = FeedHelpers .generateUnauthenticatedFeed (s , filteredChannels , 100 ).toList ();
188+ List <Video > videos = FeedHelpers .generateUnauthenticatedFeed (s , filteredChannels , 100 )
189+ .filter (FeedHelpers .createFeedFilter (filter ))
190+ .toList ();
187191
188192 List <SyndEntry > entries = videos .stream ()
189193 .map (video -> ChannelHelpers .createEntry (video , video .getChannel ()))
0 commit comments