NewPipeExtractor/src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfoItemCollector.java

39 lines
1.1 KiB
Java
Raw Normal View History

package org.schabi.newpipe.extractor.playlist;
import org.schabi.newpipe.extractor.InfoItemCollector;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
public class PlaylistInfoItemCollector extends InfoItemCollector<PlaylistInfoItem, PlaylistInfoItemExtractor> {
public PlaylistInfoItemCollector(int serviceId) {
super(serviceId);
}
@Override
public PlaylistInfoItem extract(PlaylistInfoItemExtractor extractor) throws ParsingException {
2017-11-11 02:55:56 +01:00
String name = extractor.getName();
int serviceId = getServiceId();
String url = extractor.getUrl();
PlaylistInfoItem resultItem = new PlaylistInfoItem(serviceId, url, name);
try {
2017-11-11 02:55:56 +01:00
resultItem.setUploaderName(extractor.getUploaderName());
} catch (Exception e) {
addError(e);
}
try {
2017-11-11 02:55:56 +01:00
resultItem.setThumbnailUrl(extractor.getThumbnailUrl());
} catch (Exception e) {
addError(e);
}
try {
2017-11-11 02:55:56 +01:00
resultItem.setStreamCount(extractor.getStreamCount());
} catch (Exception e) {
addError(e);
}
return resultItem;
}
}