[Youtube] Add some comments to mix

This commit is contained in:
Xiang Rong Lin 2020-02-02 18:15:47 +01:00 committed by XiangRongLin
parent d74265c846
commit 327a5730a8
3 changed files with 18 additions and 0 deletions

View File

@ -192,6 +192,12 @@ public class YoutubeParsingHelper {
}
}
/**
* Checks if the given playlist id is a mix (auto-generated playlist)
* Ids from a mix start with "RD"
* @param playlistId
* @return Whether given id belongs to a mix
*/
public static boolean isYoutubeMixId(String playlistId) {
return playlistId.startsWith("RD");
}

View File

@ -18,6 +18,10 @@ import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeParsingH
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
/**
* A YoutubePlaylistExtractor for a mix (auto-generated playlist).
* It handles urls in the format of "youtube.com/watch?v=videoId&list=playlistId"
*/
public class YoutubeMixPlaylistExtractor extends PlaylistExtractor {
private Document doc;

View File

@ -71,6 +71,14 @@ public class YoutubePlaylistLinkHandlerFactory extends ListLinkHandlerFactory {
return true;
}
/**
* If it is a mix (auto-generated playlist) url, return a Linkhandler where the url is like
* youtube.com/watch?v=videoId&list=playlistId
* <p>Otherwise use super</p>
* @param url
* @return
* @throws ParsingException
*/
@Override
public ListLinkHandler fromUrl(String url) throws ParsingException {
try {