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

44 lines
1.3 KiB
Java
Raw Normal View History

package org.schabi.newpipe.extractor.playlist;
2018-02-24 22:20:50 +01:00
import org.schabi.newpipe.extractor.InfoItemsCollector;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
2018-02-24 22:20:50 +01:00
public class PlaylistInfoItemsCollector extends InfoItemsCollector<PlaylistInfoItem, PlaylistInfoItemExtractor> {
2018-02-24 22:20:50 +01:00
public PlaylistInfoItemsCollector(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);
}
try {
resultItem.setPlaylistType(extractor.getPlaylistType());
} catch (Exception e) {
addError(e);
}
return resultItem;
}
}