2017-03-12 16:15:51 +01:00
|
|
|
package org.schabi.newpipe.extractor.playlist;
|
|
|
|
|
|
|
|
import org.schabi.newpipe.extractor.InfoItemCollector;
|
|
|
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
|
|
|
|
2017-11-11 12:17:14 +01:00
|
|
|
public class PlaylistInfoItemCollector extends InfoItemCollector<PlaylistInfoItem, PlaylistInfoItemExtractor> {
|
|
|
|
|
2017-06-29 20:12:55 +02:00
|
|
|
public PlaylistInfoItemCollector(int serviceId) {
|
2017-03-12 16:15:51 +01:00
|
|
|
super(serviceId);
|
|
|
|
}
|
|
|
|
|
2017-11-11 12:17:14 +01:00
|
|
|
@Override
|
2017-06-29 20:12:55 +02:00
|
|
|
public PlaylistInfoItem extract(PlaylistInfoItemExtractor extractor) throws ParsingException {
|
2017-03-12 16:15:51 +01:00
|
|
|
|
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);
|
2017-07-11 05:08:03 +02:00
|
|
|
|
2017-08-10 04:50:29 +02:00
|
|
|
try {
|
2017-11-11 02:55:56 +01:00
|
|
|
resultItem.setUploaderName(extractor.getUploaderName());
|
2017-08-10 04:50:29 +02:00
|
|
|
} catch (Exception e) {
|
|
|
|
addError(e);
|
|
|
|
}
|
2017-07-11 05:08:03 +02:00
|
|
|
try {
|
2017-11-11 02:55:56 +01:00
|
|
|
resultItem.setThumbnailUrl(extractor.getThumbnailUrl());
|
2017-07-11 05:08:03 +02:00
|
|
|
} catch (Exception e) {
|
|
|
|
addError(e);
|
|
|
|
}
|
2017-03-12 16:15:51 +01:00
|
|
|
try {
|
2017-11-11 02:55:56 +01:00
|
|
|
resultItem.setStreamCount(extractor.getStreamCount());
|
2017-03-12 16:15:51 +01:00
|
|
|
} catch (Exception e) {
|
|
|
|
addError(e);
|
|
|
|
}
|
|
|
|
return resultItem;
|
|
|
|
}
|
|
|
|
}
|