Skip to content

Commit 327a573

Browse files
committed
[Youtube] Add some comments to mix
1 parent d74265c commit 327a573

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeParsingHelper.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ public static OffsetDateTime parseDateFrom(String textualUploadDate) throws Pars
192192
}
193193
}
194194

195+
/**
196+
* Checks if the given playlist id is a mix (auto-generated playlist)
197+
* Ids from a mix start with "RD"
198+
* @param playlistId
199+
* @return Whether given id belongs to a mix
200+
*/
195201
public static boolean isYoutubeMixId(String playlistId) {
196202
return playlistId.startsWith("RD");
197203
}

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/extractors/YoutubeMixPlaylistExtractor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
1919
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
2020

21+
/**
22+
* A YoutubePlaylistExtractor for a mix (auto-generated playlist).
23+
* It handles urls in the format of "youtube.com/watch?v=videoId&list=playlistId"
24+
*/
2125
public class YoutubeMixPlaylistExtractor extends PlaylistExtractor {
2226

2327
private Document doc;

extractor/src/main/java/org/schabi/newpipe/extractor/services/youtube/linkHandler/YoutubePlaylistLinkHandlerFactory.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ public boolean onAcceptUrl(final String url) {
7171
return true;
7272
}
7373

74+
/**
75+
* If it is a mix (auto-generated playlist) url, return a Linkhandler where the url is like
76+
* youtube.com/watch?v=videoId&list=playlistId
77+
* <p>Otherwise use super</p>
78+
* @param url
79+
* @return
80+
* @throws ParsingException
81+
*/
7482
@Override
7583
public ListLinkHandler fromUrl(String url) throws ParsingException {
7684
try {

0 commit comments

Comments
 (0)