Finish transition to use getters on Info classes
- Renamed Collector method
This commit is contained in:
parent
6c07b7851b
commit
5dd2daad37
|
@ -31,7 +31,7 @@ public interface Collector<I, E> {
|
|||
* Get all items
|
||||
* @return the items
|
||||
*/
|
||||
List<I> getItemList();
|
||||
List<I> getItems();
|
||||
|
||||
/**
|
||||
* Get all errors
|
||||
|
|
|
@ -7,16 +7,16 @@ import java.util.List;
|
|||
|
||||
public abstract class Info implements Serializable {
|
||||
|
||||
public final int service_id;
|
||||
private final int serviceId;
|
||||
/**
|
||||
* Id of this Info object <br>
|
||||
* e.g. Youtube: https://www.youtube.com/watch?v=RER5qCTzZ7 > RER5qCTzZ7
|
||||
*/
|
||||
public final String id;
|
||||
public final String url;
|
||||
public final String name;
|
||||
private final String id;
|
||||
private final String url;
|
||||
private final String name;
|
||||
|
||||
public final List<Throwable> errors = new ArrayList<>();
|
||||
private final List<Throwable> errors = new ArrayList<>();
|
||||
|
||||
public void addError(Throwable throwable) {
|
||||
this.errors.add(throwable);
|
||||
|
@ -27,20 +27,19 @@ public abstract class Info implements Serializable {
|
|||
}
|
||||
|
||||
public Info(int serviceId, String id, String url, String name) {
|
||||
this.service_id = serviceId;
|
||||
this.serviceId = serviceId;
|
||||
this.id = id;
|
||||
this.url = url;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + "[url=\"" + url + "\", name=\"" + name + "\"]";
|
||||
}
|
||||
|
||||
public int getServiceId() {
|
||||
return service_id;
|
||||
return serviceId;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
|
|
|
@ -23,25 +23,25 @@ package org.schabi.newpipe.extractor;
|
|||
import java.io.Serializable;
|
||||
|
||||
public abstract class InfoItem implements Serializable {
|
||||
public final InfoType info_type;
|
||||
public final int service_id;
|
||||
public final String url;
|
||||
public final String name;
|
||||
public String thumbnail_url;
|
||||
private final InfoType infoType;
|
||||
private final int serviceId;
|
||||
private final String url;
|
||||
private final String name;
|
||||
private String thumbnailUrl;
|
||||
|
||||
public InfoItem(InfoType infoType, int serviceId, String url, String name) {
|
||||
this.info_type = infoType;
|
||||
this.service_id = serviceId;
|
||||
this.infoType = infoType;
|
||||
this.serviceId = serviceId;
|
||||
this.url = url;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public InfoType getInfoType() {
|
||||
return info_type;
|
||||
return infoType;
|
||||
}
|
||||
|
||||
public int getServiceId() {
|
||||
return service_id;
|
||||
return serviceId;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
|
@ -53,11 +53,11 @@ public abstract class InfoItem implements Serializable {
|
|||
}
|
||||
|
||||
public void setThumbnailUrl(String thumbnailUrl) {
|
||||
this.thumbnail_url = thumbnailUrl;
|
||||
this.thumbnailUrl = thumbnailUrl;
|
||||
}
|
||||
|
||||
public String getThumbnailUrl() {
|
||||
return thumbnail_url;
|
||||
return thumbnailUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,7 +42,7 @@ public abstract class InfoItemsCollector<I extends InfoItem, E> implements Colle
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<I> getItemList() {
|
||||
public List<I> getItems() {
|
||||
return Collections.unmodifiableList(itemList);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public abstract class ListExtractor extends Extractor {
|
|||
private final List<Throwable> errors;
|
||||
|
||||
public InfoItemPage(InfoItemsCollector<T, ?> collector, String nextPageUrl) {
|
||||
this(collector.getItemList(), nextPageUrl, collector.getErrors());
|
||||
this(collector.getItems(), nextPageUrl, collector.getErrors());
|
||||
}
|
||||
|
||||
public InfoItemPage(List<T> itemsList, String nextPageUrl, List<Throwable> errors) {
|
||||
|
|
|
@ -2,20 +2,20 @@ package org.schabi.newpipe.extractor;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ListInfo extends Info {
|
||||
public List<InfoItem> related_streams;
|
||||
public String nextPageUrl = null;
|
||||
public abstract class ListInfo<T extends InfoItem> extends Info {
|
||||
private List<T> relatedItems;
|
||||
private String nextPageUrl = null;
|
||||
|
||||
public ListInfo(int serviceId, String id, String url, String name) {
|
||||
super(serviceId, id, url, name);
|
||||
}
|
||||
|
||||
public List<InfoItem> getRelatedStreams() {
|
||||
return related_streams;
|
||||
public List<T> getRelatedItems() {
|
||||
return relatedItems;
|
||||
}
|
||||
|
||||
public void setRelatedStreams(List<InfoItem> related_streams) {
|
||||
this.related_streams = related_streams;
|
||||
public void setRelatedItems(List<T> relatedItems) {
|
||||
this.relatedItems = relatedItems;
|
||||
}
|
||||
|
||||
public boolean hasNextPage() {
|
||||
|
|
|
@ -79,7 +79,7 @@ public class ChannelInfo extends ListInfo {
|
|||
info.addError(e);
|
||||
}
|
||||
|
||||
info.setRelatedStreams(ExtractorHelper.getInfoItemsOrLogError(info, extractor));
|
||||
info.setRelatedItems(ExtractorHelper.getInfoItemsOrLogError(info, extractor));
|
||||
|
||||
try {
|
||||
info.setSubscriberCount(extractor.getSubscriberCount());
|
||||
|
@ -96,42 +96,42 @@ public class ChannelInfo extends ListInfo {
|
|||
return info;
|
||||
}
|
||||
|
||||
public String avatar_url;
|
||||
public String banner_url;
|
||||
public String feed_url;
|
||||
public long subscriber_count = -1;
|
||||
public String description;
|
||||
private String avatarUrl;
|
||||
private String bannerUrl;
|
||||
private String feedUrl;
|
||||
private long subscriberCount = -1;
|
||||
private String description;
|
||||
|
||||
public String getAvatarUrl() {
|
||||
return avatar_url;
|
||||
return avatarUrl;
|
||||
}
|
||||
|
||||
public void setAvatarUrl(String avatarUrl) {
|
||||
this.avatar_url = avatarUrl;
|
||||
this.avatarUrl = avatarUrl;
|
||||
}
|
||||
|
||||
public String getBannerUrl() {
|
||||
return banner_url;
|
||||
return bannerUrl;
|
||||
}
|
||||
|
||||
public void setBannerUrl(String bannerUrl) {
|
||||
this.banner_url = bannerUrl;
|
||||
this.bannerUrl = bannerUrl;
|
||||
}
|
||||
|
||||
public String getFeedUrl() {
|
||||
return feed_url;
|
||||
return feedUrl;
|
||||
}
|
||||
|
||||
public void setFeedUrl(String feedUrl) {
|
||||
this.feed_url = feedUrl;
|
||||
this.feedUrl = feedUrl;
|
||||
}
|
||||
|
||||
public long getSubscriberCount() {
|
||||
return subscriber_count;
|
||||
return subscriberCount;
|
||||
}
|
||||
|
||||
public void setSubscriberCount(long subscriberCount) {
|
||||
this.subscriber_count = subscriberCount;
|
||||
this.subscriberCount = subscriberCount;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
|
|
|
@ -24,9 +24,9 @@ import org.schabi.newpipe.extractor.InfoItem;
|
|||
|
||||
public class ChannelInfoItem extends InfoItem {
|
||||
|
||||
public String description;
|
||||
public long subscriber_count = -1;
|
||||
public long stream_count = -1;
|
||||
private String description;
|
||||
private long subscriberCount = -1;
|
||||
private long streamCount = -1;
|
||||
|
||||
|
||||
public ChannelInfoItem(int serviceId, String url, String name) {
|
||||
|
@ -42,18 +42,18 @@ public class ChannelInfoItem extends InfoItem {
|
|||
}
|
||||
|
||||
public long getSubscriberCount() {
|
||||
return subscriber_count;
|
||||
return subscriberCount;
|
||||
}
|
||||
|
||||
public void setSubscriberCount(long subscriber_count) {
|
||||
this.subscriber_count = subscriber_count;
|
||||
this.subscriberCount = subscriber_count;
|
||||
}
|
||||
|
||||
public long getStreamCount() {
|
||||
return stream_count;
|
||||
return streamCount;
|
||||
}
|
||||
|
||||
public void setStreamCount(long stream_count) {
|
||||
this.stream_count = stream_count;
|
||||
this.streamCount = stream_count;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public class KioskInfo extends ListInfo {
|
|||
|
||||
KioskInfo info = new KioskInfo(serviceId, id, name, url);
|
||||
|
||||
info.related_streams = ExtractorHelper.getInfoItemsOrLogError(info, extractor);
|
||||
info.setRelatedItems(ExtractorHelper.getInfoItemsOrLogError(info, extractor));
|
||||
|
||||
return info;
|
||||
}
|
||||
|
|
|
@ -75,63 +75,63 @@ public class PlaylistInfo extends ListInfo {
|
|||
info.addError(e);
|
||||
}
|
||||
|
||||
info.setRelatedStreams(getInfoItemsOrLogError(info, extractor));
|
||||
info.setRelatedItems(getInfoItemsOrLogError(info, extractor));
|
||||
info.setNextPageUrl(extractor.getNextPageUrl());
|
||||
return info;
|
||||
}
|
||||
|
||||
public String thumbnail_url;
|
||||
public String banner_url;
|
||||
public String uploader_url;
|
||||
public String uploader_name;
|
||||
public String uploader_avatar_url;
|
||||
public long stream_count = 0;
|
||||
private String thumbnailUrl;
|
||||
private String bannerUrl;
|
||||
private String uploaderUrl;
|
||||
private String uploaderName;
|
||||
private String uploaderAvatarUrl;
|
||||
private long streamCount = 0;
|
||||
|
||||
public String getThumbnailUrl() {
|
||||
return thumbnail_url;
|
||||
}
|
||||
|
||||
public String getBannerUrl() {
|
||||
return banner_url;
|
||||
}
|
||||
|
||||
public String getUploaderUrl() {
|
||||
return uploader_url;
|
||||
}
|
||||
|
||||
public String getUploaderName() {
|
||||
return uploader_name;
|
||||
}
|
||||
|
||||
public String getUploaderAvatarUrl() {
|
||||
return uploader_avatar_url;
|
||||
}
|
||||
|
||||
public long getStreamCount() {
|
||||
return stream_count;
|
||||
return thumbnailUrl;
|
||||
}
|
||||
|
||||
public void setThumbnailUrl(String thumbnailUrl) {
|
||||
this.thumbnail_url = thumbnailUrl;
|
||||
this.thumbnailUrl = thumbnailUrl;
|
||||
}
|
||||
|
||||
public String getBannerUrl() {
|
||||
return bannerUrl;
|
||||
}
|
||||
|
||||
public void setBannerUrl(String bannerUrl) {
|
||||
this.banner_url = bannerUrl;
|
||||
this.bannerUrl = bannerUrl;
|
||||
}
|
||||
|
||||
public String getUploaderUrl() {
|
||||
return uploaderUrl;
|
||||
}
|
||||
|
||||
public void setUploaderUrl(String uploaderUrl) {
|
||||
this.uploader_url = uploaderUrl;
|
||||
this.uploaderUrl = uploaderUrl;
|
||||
}
|
||||
|
||||
public String getUploaderName() {
|
||||
return uploaderName;
|
||||
}
|
||||
|
||||
public void setUploaderName(String uploaderName) {
|
||||
this.uploader_name = uploaderName;
|
||||
this.uploaderName = uploaderName;
|
||||
}
|
||||
|
||||
public String getUploaderAvatarUrl() {
|
||||
return uploaderAvatarUrl;
|
||||
}
|
||||
|
||||
public void setUploaderAvatarUrl(String uploaderAvatarUrl) {
|
||||
this.uploader_avatar_url = uploaderAvatarUrl;
|
||||
this.uploaderAvatarUrl = uploaderAvatarUrl;
|
||||
}
|
||||
|
||||
public long getStreamCount() {
|
||||
return streamCount;
|
||||
}
|
||||
|
||||
public void setStreamCount(long streamCount) {
|
||||
this.stream_count = streamCount;
|
||||
this.streamCount = streamCount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,29 +4,29 @@ import org.schabi.newpipe.extractor.InfoItem;
|
|||
|
||||
public class PlaylistInfoItem extends InfoItem {
|
||||
|
||||
public String uploader_name;
|
||||
private String uploaderName;
|
||||
/**
|
||||
* How many streams this playlist have
|
||||
*/
|
||||
public long stream_count = 0;
|
||||
private long streamCount = 0;
|
||||
|
||||
public PlaylistInfoItem(int serviceId, String url, String name) {
|
||||
super(InfoType.PLAYLIST, serviceId, url, name);
|
||||
}
|
||||
|
||||
public String getUploaderName() {
|
||||
return uploader_name;
|
||||
return uploaderName;
|
||||
}
|
||||
|
||||
public void setUploaderName(String uploader_name) {
|
||||
this.uploader_name = uploader_name;
|
||||
this.uploaderName = uploader_name;
|
||||
}
|
||||
|
||||
public long getStreamCount() {
|
||||
return stream_count;
|
||||
return streamCount;
|
||||
}
|
||||
|
||||
public void setStreamCount(long stream_count) {
|
||||
this.stream_count = stream_count;
|
||||
this.streamCount = stream_count;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package org.schabi.newpipe.extractor.search;
|
||||
|
||||
import org.schabi.newpipe.extractor.*;
|
||||
import org.schabi.newpipe.extractor.channel.ChannelInfoItemsCollector;
|
||||
import org.schabi.newpipe.extractor.InfoItem;
|
||||
import org.schabi.newpipe.extractor.InfoItemExtractor;
|
||||
import org.schabi.newpipe.extractor.InfoItemsCollector;
|
||||
import org.schabi.newpipe.extractor.channel.ChannelInfoItemExtractor;
|
||||
import org.schabi.newpipe.extractor.channel.ChannelInfoItemsCollector;
|
||||
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||
import org.schabi.newpipe.extractor.playlist.PlaylistInfoItemsCollector;
|
||||
import org.schabi.newpipe.extractor.playlist.PlaylistInfoItemExtractor;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
|
||||
import org.schabi.newpipe.extractor.playlist.PlaylistInfoItemsCollector;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItemExtractor;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfoItemsCollector;
|
||||
|
||||
/*
|
||||
* Created by Christian Schabesberger on 12.02.17.
|
||||
|
@ -60,7 +62,7 @@ public class InfoItemsSearchCollector extends InfoItemsCollector<InfoItem, InfoI
|
|||
}
|
||||
|
||||
public SearchResult getSearchResult() throws ExtractionException {
|
||||
return new SearchResult(getServiceId(), suggestion, getItemList(), getErrors());
|
||||
return new SearchResult(getServiceId(), suggestion, getItems(), getErrors());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -119,7 +119,7 @@ public class SoundcloudParsingHelper {
|
|||
public static String getUsersFromApiMinItems(int minItems, ChannelInfoItemsCollector collector, String apiUrl) throws IOException, ReCaptchaException, ParsingException {
|
||||
String nextPageUrl = SoundcloudParsingHelper.getUsersFromApi(collector, apiUrl);
|
||||
|
||||
while (!nextPageUrl.isEmpty() && collector.getItemList().size() < minItems) {
|
||||
while (!nextPageUrl.isEmpty() && collector.getItems().size() < minItems) {
|
||||
nextPageUrl = SoundcloudParsingHelper.getUsersFromApi(collector, nextPageUrl);
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ public class SoundcloudParsingHelper {
|
|||
public static String getStreamsFromApiMinItems(int minItems, StreamInfoItemsCollector collector, String apiUrl) throws IOException, ReCaptchaException, ParsingException {
|
||||
String nextPageUrl = SoundcloudParsingHelper.getStreamsFromApi(collector, apiUrl);
|
||||
|
||||
while (!nextPageUrl.isEmpty() && collector.getItemList().size() < minItems) {
|
||||
while (!nextPageUrl.isEmpty() && collector.getItems().size() < minItems) {
|
||||
nextPageUrl = SoundcloudParsingHelper.getStreamsFromApi(collector, nextPageUrl);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,9 +71,9 @@ public class SoundcloudPlaylistExtractor extends PlaylistExtractor {
|
|||
// if it also fails, return null
|
||||
try {
|
||||
final StreamInfoItemsCollector infoItems = getInfoItems();
|
||||
if (infoItems.getItemList().isEmpty()) return null;
|
||||
if (infoItems.getItems().isEmpty()) return null;
|
||||
|
||||
for (StreamInfoItem item : infoItems.getItemList()) {
|
||||
for (StreamInfoItem item : infoItems.getItems()) {
|
||||
final String thumbnailUrl = item.getThumbnailUrl();
|
||||
if (thumbnailUrl == null || thumbnailUrl.isEmpty()) continue;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ public class SoundcloudSubscriptionExtractor extends SubscriptionExtractor {
|
|||
// ± 2000 is the limit of followings on SoundCloud, so this minimum should be enough
|
||||
SoundcloudParsingHelper.getUsersFromApiMinItems(2500, collector, apiUrl);
|
||||
|
||||
return toSubscriptionItems(collector.getItemList());
|
||||
return toSubscriptionItems(collector.getItems());
|
||||
}
|
||||
|
||||
private String getUrlFrom(String channelUrl) {
|
||||
|
|
|
@ -477,7 +477,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
|
|||
collector.commit(extractVideoPreviewInfo(doc.select("div[class=\"watch-sidebar-section\"]")
|
||||
.first().select("li").first()));
|
||||
|
||||
return collector.getItemList().get(0);
|
||||
return collector.getItems().get(0);
|
||||
} catch (Exception e) {
|
||||
throw new ParsingException("Could not get next video", e);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.schabi.newpipe.extractor.utils.DashMpdParser;
|
|||
import org.schabi.newpipe.extractor.utils.ExtractorHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
|
@ -33,209 +33,20 @@ import java.util.List;
|
|||
/**
|
||||
* Info object for opened videos, ie the video ready to play.
|
||||
*/
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
public class StreamInfo extends Info {
|
||||
|
||||
public StreamInfo(int serviceId, String url, StreamType streamType, String id, String name, int ageLimit) {
|
||||
super(serviceId, id, url, name);
|
||||
this.stream_type = streamType;
|
||||
this.age_limit = ageLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stream type
|
||||
* @return the stream type
|
||||
*/
|
||||
public StreamType getStreamType() {
|
||||
return stream_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the thumbnail url
|
||||
* @return the thumbnail url as a string
|
||||
*/
|
||||
public String getThumbnailUrl() {
|
||||
return thumbnail_url;
|
||||
}
|
||||
|
||||
public String getUploadDate() {
|
||||
return upload_date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the duration in seconds
|
||||
* @return the duration in seconds
|
||||
*/
|
||||
public long getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public int getAgeLimit() {
|
||||
return age_limit;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public long getViewCount() {
|
||||
return view_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of likes.
|
||||
* @return The number of likes or -1 if this information is not available
|
||||
*/
|
||||
public long getLikeCount() {
|
||||
return like_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of dislikes.
|
||||
* @return The number of likes or -1 if this information is not available
|
||||
*/
|
||||
public long getDislikeCount() {
|
||||
return dislike_count;
|
||||
}
|
||||
|
||||
public String getUploaderName() {
|
||||
return uploader_name;
|
||||
}
|
||||
|
||||
public String getUploaderUrl() {
|
||||
return uploader_url;
|
||||
}
|
||||
|
||||
public String getUploaderAvatarUrl() {
|
||||
return uploader_avatar_url;
|
||||
}
|
||||
|
||||
public List<VideoStream> getVideoStreams() {
|
||||
return video_streams;
|
||||
}
|
||||
|
||||
public List<AudioStream> getAudioStreams() {
|
||||
return audio_streams;
|
||||
}
|
||||
|
||||
public List<VideoStream> getVideoOnlyStreams() {
|
||||
return video_only_streams;
|
||||
}
|
||||
|
||||
public String getDashMpdUrl() {
|
||||
return dashMpdUrl;
|
||||
}
|
||||
|
||||
public String getHlsUrl() {
|
||||
return hlsUrl;
|
||||
}
|
||||
|
||||
public StreamInfoItem getNextVideo() {
|
||||
return next_video;
|
||||
}
|
||||
|
||||
public List<InfoItem> getRelatedStreams() {
|
||||
return related_streams;
|
||||
}
|
||||
|
||||
public long getStartPosition() {
|
||||
return start_position;
|
||||
}
|
||||
|
||||
public List<Subtitles> getSubtitles() {
|
||||
return subtitles;
|
||||
}
|
||||
|
||||
public void setStreamType(StreamType stream_type) {
|
||||
this.stream_type = stream_type;
|
||||
}
|
||||
|
||||
public void setThumbnailUrl(String thumbnail_url) {
|
||||
this.thumbnail_url = thumbnail_url;
|
||||
}
|
||||
|
||||
public void setUploadDate(String upload_date) {
|
||||
this.upload_date = upload_date;
|
||||
}
|
||||
|
||||
public void setDuration(long duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public void setAgeLimit(int age_limit) {
|
||||
this.age_limit = age_limit;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setViewCount(long view_count) {
|
||||
this.view_count = view_count;
|
||||
}
|
||||
|
||||
public void setLikeCount(long like_count) {
|
||||
this.like_count = like_count;
|
||||
}
|
||||
|
||||
public void setDislikeCount(long dislike_count) {
|
||||
this.dislike_count = dislike_count;
|
||||
}
|
||||
|
||||
public void setUploaderName(String uploader_name) {
|
||||
this.uploader_name = uploader_name;
|
||||
}
|
||||
|
||||
public void setUploaderUrl(String uploader_url) {
|
||||
this.uploader_url = uploader_url;
|
||||
}
|
||||
|
||||
public void setUploaderAvatarUrl(String uploader_avatar_url) {
|
||||
this.uploader_avatar_url = uploader_avatar_url;
|
||||
}
|
||||
|
||||
public void setVideoStreams(List<VideoStream> video_streams) {
|
||||
this.video_streams = video_streams;
|
||||
}
|
||||
|
||||
public void setAudioStreams(List<AudioStream> audio_streams) {
|
||||
this.audio_streams = audio_streams;
|
||||
}
|
||||
|
||||
public void setVideoOnlyStreams(List<VideoStream> video_only_streams) {
|
||||
this.video_only_streams = video_only_streams;
|
||||
}
|
||||
|
||||
public void setDashMpdUrl(String dashMpdUrl) {
|
||||
this.dashMpdUrl = dashMpdUrl;
|
||||
}
|
||||
|
||||
public void setHlsUrl(String hlsUrl) {
|
||||
this.hlsUrl = hlsUrl;
|
||||
}
|
||||
|
||||
public void setNextVideo(StreamInfoItem next_video) {
|
||||
this.next_video = next_video;
|
||||
}
|
||||
|
||||
public void setRelatedStreams(List<InfoItem> related_streams) {
|
||||
this.related_streams = related_streams;
|
||||
}
|
||||
|
||||
public void setStartPosition(long start_position) {
|
||||
this.start_position = start_position;
|
||||
}
|
||||
|
||||
public void setSubtitles(List<Subtitles> subtitles) {
|
||||
this.subtitles = subtitles;
|
||||
}
|
||||
|
||||
public static class StreamExtractException extends ExtractionException {
|
||||
StreamExtractException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
public StreamInfo(int serviceId, String url, StreamType streamType, String id, String name, int ageLimit) {
|
||||
super(serviceId, id, url, name);
|
||||
this.streamType = streamType;
|
||||
this.ageLimit = ageLimit;
|
||||
}
|
||||
|
||||
public static StreamInfo getInfo(String url) throws IOException, ExtractionException {
|
||||
return getInfo(NewPipe.getServiceByUrl(url), url);
|
||||
}
|
||||
|
@ -244,10 +55,6 @@ public class StreamInfo extends Info {
|
|||
return getInfo(service.getStreamExtractor(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills out the video info fields which are common to all services.
|
||||
* Probably needs to be overridden by subclasses
|
||||
*/
|
||||
private static StreamInfo getInfo(StreamExtractor extractor) throws ExtractionException, IOException {
|
||||
extractor.fetchPage();
|
||||
StreamInfo streamInfo;
|
||||
|
@ -332,9 +139,9 @@ public class StreamInfo extends Info {
|
|||
}
|
||||
|
||||
// Lists can be null if a exception was thrown during extraction
|
||||
if (streamInfo.getVideoStreams() == null) streamInfo.setVideoStreams(Collections.<VideoStream>emptyList());
|
||||
if (streamInfo.getVideoOnlyStreams()== null) streamInfo.setVideoOnlyStreams(Collections.<VideoStream>emptyList());
|
||||
if (streamInfo.getAudioStreams() == null) streamInfo.setAudioStreams(Collections.<AudioStream>emptyList());
|
||||
if (streamInfo.getVideoStreams() == null) streamInfo.setVideoStreams(new ArrayList<VideoStream>());
|
||||
if (streamInfo.getVideoOnlyStreams() == null) streamInfo.setVideoOnlyStreams(new ArrayList<VideoStream>());
|
||||
if (streamInfo.getAudioStreams() == null) streamInfo.setAudioStreams(new ArrayList<AudioStream>());
|
||||
|
||||
Exception dashMpdError = null;
|
||||
if (streamInfo.getDashMpdUrl() != null && !streamInfo.getDashMpdUrl().isEmpty()) {
|
||||
|
@ -348,8 +155,8 @@ public class StreamInfo extends Info {
|
|||
}
|
||||
|
||||
// Either audio or video has to be available, otherwise we didn't get a stream (since videoOnly are optional, they don't count).
|
||||
if ((streamInfo.video_streams.isEmpty())
|
||||
&& (streamInfo.audio_streams.isEmpty())) {
|
||||
if ((streamInfo.videoStreams.isEmpty())
|
||||
&& (streamInfo.audioStreams.isEmpty())) {
|
||||
|
||||
if (dashMpdError != null) {
|
||||
// If we don't have any video or audio and the dashMpd 'errored', add it to the error list
|
||||
|
@ -434,39 +241,228 @@ public class StreamInfo extends Info {
|
|||
} catch (Exception e) {
|
||||
streamInfo.addError(e);
|
||||
}
|
||||
|
||||
streamInfo.setRelatedStreams(ExtractorHelper.getRelatedVideosOrLogError(streamInfo, extractor));
|
||||
return streamInfo;
|
||||
}
|
||||
|
||||
public StreamType stream_type;
|
||||
public String thumbnail_url;
|
||||
public String upload_date;
|
||||
public long duration = -1;
|
||||
public int age_limit = -1;
|
||||
public String description;
|
||||
private StreamType streamType;
|
||||
private String thumbnailUrl;
|
||||
private String uploadDate;
|
||||
private long duration = -1;
|
||||
private int ageLimit = -1;
|
||||
private String description;
|
||||
|
||||
public long view_count = -1;
|
||||
public long like_count = -1;
|
||||
public long dislike_count = -1;
|
||||
private long viewCount = -1;
|
||||
private long likeCount = -1;
|
||||
private long dislikeCount = -1;
|
||||
|
||||
public String uploader_name;
|
||||
public String uploader_url;
|
||||
public String uploader_avatar_url;
|
||||
private String uploaderName;
|
||||
private String uploaderUrl;
|
||||
private String uploaderAvatarUrl;
|
||||
|
||||
public List<VideoStream> video_streams;
|
||||
public List<AudioStream> audio_streams;
|
||||
public List<VideoStream> video_only_streams;
|
||||
// video streams provided by the dash mpd do not need to be provided as VideoStream.
|
||||
// Later on this will also apply to audio streams. Since dash mpd is standarized,
|
||||
// crawling such a file is not service dependent. Therefore getting audio only streams by yust
|
||||
// providing the dash mpd file will be possible in the future.
|
||||
public String dashMpdUrl;
|
||||
public String hlsUrl;
|
||||
private List<VideoStream> videoStreams;
|
||||
private List<AudioStream> audioStreams;
|
||||
private List<VideoStream> videoOnlyStreams;
|
||||
|
||||
public StreamInfoItem next_video;
|
||||
public List<InfoItem> related_streams;
|
||||
//in seconds. some metadata is not passed using a StreamInfo object!
|
||||
public long start_position = 0;
|
||||
private String dashMpdUrl;
|
||||
private String hlsUrl;
|
||||
private StreamInfoItem nextVideo;
|
||||
private List<InfoItem> relatedStreams;
|
||||
|
||||
public List<Subtitles> subtitles;
|
||||
private long startPosition = 0;
|
||||
private List<Subtitles> subtitles;
|
||||
|
||||
/**
|
||||
* Get the stream type
|
||||
*
|
||||
* @return the stream type
|
||||
*/
|
||||
public StreamType getStreamType() {
|
||||
return streamType;
|
||||
}
|
||||
|
||||
public void setStreamType(StreamType streamType) {
|
||||
this.streamType = streamType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the thumbnail url
|
||||
*
|
||||
* @return the thumbnail url as a string
|
||||
*/
|
||||
public String getThumbnailUrl() {
|
||||
return thumbnailUrl;
|
||||
}
|
||||
|
||||
public void setThumbnailUrl(String thumbnailUrl) {
|
||||
this.thumbnailUrl = thumbnailUrl;
|
||||
}
|
||||
|
||||
public String getUploadDate() {
|
||||
return uploadDate;
|
||||
}
|
||||
|
||||
public void setUploadDate(String uploadDate) {
|
||||
this.uploadDate = uploadDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the duration in seconds
|
||||
*
|
||||
* @return the duration in seconds
|
||||
*/
|
||||
public long getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(long duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public int getAgeLimit() {
|
||||
return ageLimit;
|
||||
}
|
||||
|
||||
public void setAgeLimit(int ageLimit) {
|
||||
this.ageLimit = ageLimit;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public long getViewCount() {
|
||||
return viewCount;
|
||||
}
|
||||
|
||||
public void setViewCount(long viewCount) {
|
||||
this.viewCount = viewCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of likes.
|
||||
*
|
||||
* @return The number of likes or -1 if this information is not available
|
||||
*/
|
||||
public long getLikeCount() {
|
||||
return likeCount;
|
||||
}
|
||||
|
||||
public void setLikeCount(long likeCount) {
|
||||
this.likeCount = likeCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of dislikes.
|
||||
*
|
||||
* @return The number of likes or -1 if this information is not available
|
||||
*/
|
||||
public long getDislikeCount() {
|
||||
return dislikeCount;
|
||||
}
|
||||
|
||||
public void setDislikeCount(long dislikeCount) {
|
||||
this.dislikeCount = dislikeCount;
|
||||
}
|
||||
|
||||
public String getUploaderName() {
|
||||
return uploaderName;
|
||||
}
|
||||
|
||||
public void setUploaderName(String uploaderName) {
|
||||
this.uploaderName = uploaderName;
|
||||
}
|
||||
|
||||
public String getUploaderUrl() {
|
||||
return uploaderUrl;
|
||||
}
|
||||
|
||||
public void setUploaderUrl(String uploaderUrl) {
|
||||
this.uploaderUrl = uploaderUrl;
|
||||
}
|
||||
|
||||
public String getUploaderAvatarUrl() {
|
||||
return uploaderAvatarUrl;
|
||||
}
|
||||
|
||||
public void setUploaderAvatarUrl(String uploaderAvatarUrl) {
|
||||
this.uploaderAvatarUrl = uploaderAvatarUrl;
|
||||
}
|
||||
|
||||
public List<VideoStream> getVideoStreams() {
|
||||
return videoStreams;
|
||||
}
|
||||
|
||||
public void setVideoStreams(List<VideoStream> videoStreams) {
|
||||
this.videoStreams = videoStreams;
|
||||
}
|
||||
|
||||
public List<AudioStream> getAudioStreams() {
|
||||
return audioStreams;
|
||||
}
|
||||
|
||||
public void setAudioStreams(List<AudioStream> audioStreams) {
|
||||
this.audioStreams = audioStreams;
|
||||
}
|
||||
|
||||
public List<VideoStream> getVideoOnlyStreams() {
|
||||
return videoOnlyStreams;
|
||||
}
|
||||
|
||||
public void setVideoOnlyStreams(List<VideoStream> videoOnlyStreams) {
|
||||
this.videoOnlyStreams = videoOnlyStreams;
|
||||
}
|
||||
|
||||
public String getDashMpdUrl() {
|
||||
return dashMpdUrl;
|
||||
}
|
||||
|
||||
public void setDashMpdUrl(String dashMpdUrl) {
|
||||
this.dashMpdUrl = dashMpdUrl;
|
||||
}
|
||||
|
||||
public String getHlsUrl() {
|
||||
return hlsUrl;
|
||||
}
|
||||
|
||||
public void setHlsUrl(String hlsUrl) {
|
||||
this.hlsUrl = hlsUrl;
|
||||
}
|
||||
|
||||
public StreamInfoItem getNextVideo() {
|
||||
return nextVideo;
|
||||
}
|
||||
|
||||
public void setNextVideo(StreamInfoItem nextVideo) {
|
||||
this.nextVideo = nextVideo;
|
||||
}
|
||||
|
||||
public List<InfoItem> getRelatedStreams() {
|
||||
return relatedStreams;
|
||||
}
|
||||
|
||||
public void setRelatedStreams(List<InfoItem> relatedStreams) {
|
||||
this.relatedStreams = relatedStreams;
|
||||
}
|
||||
|
||||
public long getStartPosition() {
|
||||
return startPosition;
|
||||
}
|
||||
|
||||
public void setStartPosition(long startPosition) {
|
||||
this.startPosition = startPosition;
|
||||
}
|
||||
|
||||
public List<Subtitles> getSubtitles() {
|
||||
return subtitles;
|
||||
}
|
||||
|
||||
public void setSubtitles(List<Subtitles> subtitles) {
|
||||
this.subtitles = subtitles;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,42 +26,46 @@ import org.schabi.newpipe.extractor.InfoItem;
|
|||
* Info object for previews of unopened videos, eg search results, related videos
|
||||
*/
|
||||
public class StreamInfoItem extends InfoItem {
|
||||
public final StreamType stream_type;
|
||||
private final StreamType streamType;
|
||||
|
||||
public String uploader_name;
|
||||
public String upload_date;
|
||||
public long view_count = -1;
|
||||
public long duration = -1;
|
||||
private String uploaderName;
|
||||
private String uploadDate;
|
||||
private long viewCount = -1;
|
||||
private long duration = -1;
|
||||
|
||||
private String uploaderUrl = null;
|
||||
|
||||
public StreamInfoItem(int serviceId, String url, String name, StreamType streamType) {
|
||||
super(InfoType.STREAM, serviceId, url, name);
|
||||
this.stream_type = streamType;
|
||||
}
|
||||
|
||||
public void setUploaderUrl(String uploaderUrl) {
|
||||
this.uploaderUrl = uploaderUrl;
|
||||
}
|
||||
|
||||
public String getUploaderUrl() {
|
||||
return uploaderUrl;
|
||||
this.streamType = streamType;
|
||||
}
|
||||
|
||||
public StreamType getStreamType() {
|
||||
return stream_type;
|
||||
return streamType;
|
||||
}
|
||||
|
||||
public String getUploaderName() {
|
||||
return uploader_name;
|
||||
return uploaderName;
|
||||
}
|
||||
|
||||
public void setUploaderName(String uploader_name) {
|
||||
this.uploaderName = uploader_name;
|
||||
}
|
||||
|
||||
public String getUploadDate() {
|
||||
return upload_date;
|
||||
return uploadDate;
|
||||
}
|
||||
|
||||
public void setUploadDate(String upload_date) {
|
||||
this.uploadDate = upload_date;
|
||||
}
|
||||
|
||||
public long getViewCount() {
|
||||
return view_count;
|
||||
return viewCount;
|
||||
}
|
||||
|
||||
public void setViewCount(long view_count) {
|
||||
this.viewCount = view_count;
|
||||
}
|
||||
|
||||
public long getDuration() {
|
||||
|
@ -72,32 +76,28 @@ public class StreamInfoItem extends InfoItem {
|
|||
this.duration = duration;
|
||||
}
|
||||
|
||||
public void setUploaderName(String uploader_name) {
|
||||
this.uploader_name = uploader_name;
|
||||
public String getUploaderUrl() {
|
||||
return uploaderUrl;
|
||||
}
|
||||
|
||||
public void setUploadDate(String upload_date) {
|
||||
this.upload_date = upload_date;
|
||||
}
|
||||
|
||||
public void setViewCount(long view_count) {
|
||||
this.view_count = view_count;
|
||||
public void setUploaderUrl(String uploaderUrl) {
|
||||
this.uploaderUrl = uploaderUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StreamInfoItem{" +
|
||||
"stream_type=" + stream_type +
|
||||
", uploader_name='" + uploader_name + '\'' +
|
||||
", upload_date='" + upload_date + '\'' +
|
||||
", view_count=" + view_count +
|
||||
"streamType=" + streamType +
|
||||
", uploaderName='" + uploaderName + '\'' +
|
||||
", uploadDate='" + uploadDate + '\'' +
|
||||
", viewCount=" + viewCount +
|
||||
", duration=" + duration +
|
||||
", uploaderUrl='" + uploaderUrl + '\'' +
|
||||
", info_type=" + info_type +
|
||||
", service_id=" + service_id +
|
||||
", url='" + url + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", thumbnail_url='" + thumbnail_url + '\'' +
|
||||
", infoType=" + getInfoType() +
|
||||
", serviceId=" + getServiceId() +
|
||||
", url='" + getUrl() + '\'' +
|
||||
", name='" + getName() + '\'' +
|
||||
", thumbnailUrl='" + getThumbnailUrl() + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -96,7 +96,7 @@ public class StreamInfoItemsCollector extends InfoItemsCollector<StreamInfoItem,
|
|||
|
||||
public List<StreamInfoItem> getStreamInfoItemList() {
|
||||
List<StreamInfoItem> siiList = new Vector<>();
|
||||
for(InfoItem ii : super.getItemList()) {
|
||||
for(InfoItem ii : super.getItems()) {
|
||||
if(ii instanceof StreamInfoItem) {
|
||||
siiList.add((StreamInfoItem) ii);
|
||||
}
|
||||
|
|
|
@ -64,9 +64,9 @@ public class DashMpdParser {
|
|||
String dashDoc;
|
||||
Downloader downloader = NewPipe.getDownloader();
|
||||
try {
|
||||
dashDoc = downloader.download(streamInfo.dashMpdUrl);
|
||||
dashDoc = downloader.download(streamInfo.getDashMpdUrl());
|
||||
} catch (IOException ioe) {
|
||||
throw new DashMpdParsingException("Could not get dash mpd: " + streamInfo.dashMpdUrl, ioe);
|
||||
throw new DashMpdParsingException("Could not get dash mpd: " + streamInfo.getDashMpdUrl(), ioe);
|
||||
} catch (ReCaptchaException e) {
|
||||
throw new ReCaptchaException("reCaptcha Challenge needed");
|
||||
}
|
||||
|
@ -92,19 +92,19 @@ public class DashMpdParser {
|
|||
if (itag.itagType.equals(ItagItem.ItagType.AUDIO)) {
|
||||
AudioStream audioStream = new AudioStream(url, mediaFormat, itag.avgBitrate);
|
||||
|
||||
if (!Stream.containSimilarStream(audioStream, streamInfo.audio_streams)) {
|
||||
streamInfo.audio_streams.add(audioStream);
|
||||
if (!Stream.containSimilarStream(audioStream, streamInfo.getAudioStreams())) {
|
||||
streamInfo.getAudioStreams().add(audioStream);
|
||||
}
|
||||
} else {
|
||||
boolean isVideoOnly = itag.itagType.equals(ItagItem.ItagType.VIDEO_ONLY);
|
||||
VideoStream videoStream = new VideoStream(url, mediaFormat, itag.resolutionString, isVideoOnly);
|
||||
|
||||
if (isVideoOnly) {
|
||||
if (!Stream.containSimilarStream(videoStream, streamInfo.video_only_streams)) {
|
||||
streamInfo.video_only_streams.add(videoStream);
|
||||
if (!Stream.containSimilarStream(videoStream, streamInfo.getVideoOnlyStreams())) {
|
||||
streamInfo.getVideoOnlyStreams().add(videoStream);
|
||||
}
|
||||
} else if (!Stream.containSimilarStream(videoStream, streamInfo.video_streams)) {
|
||||
streamInfo.video_streams.add(videoStream);
|
||||
} else if (!Stream.containSimilarStream(videoStream, streamInfo.getVideoStreams())) {
|
||||
streamInfo.getVideoStreams().add(videoStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ExtractorHelper {
|
|||
private static List<InfoItem> getInfoItems(Info info, InfoItemsCollector collector) {
|
||||
List<InfoItem> result;
|
||||
try {
|
||||
result = collector.getItemList();
|
||||
result = collector.getItems();
|
||||
info.addAllErrors(collector.getErrors());
|
||||
} catch (Exception e) {
|
||||
info.addError(e);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.schabi.newpipe.extractor.utils;
|
||||
|
||||
import org.schabi.newpipe.extractor.Collector;
|
||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -40,8 +39,7 @@ public class Utils {
|
|||
}
|
||||
}
|
||||
|
||||
public static void printErrors(Collector c) {
|
||||
List<Throwable> errors = c.getErrors();
|
||||
public static void printErrors(List<Throwable> errors) {
|
||||
for(Throwable e : errors) {
|
||||
e.printStackTrace();
|
||||
System.err.println("----------------");
|
||||
|
|
|
@ -34,7 +34,7 @@ public final class DefaultTests {
|
|||
|
||||
public static void defaultTestRelatedItems(ListExtractor extractor, int expectedServiceId) throws Exception {
|
||||
final InfoItemsCollector<? extends InfoItem, ?> itemsCollector = extractor.getInfoItems();
|
||||
final List<? extends InfoItem> itemsList = itemsCollector.getItemList();
|
||||
final List<? extends InfoItem> itemsList = itemsCollector.getItems();
|
||||
List<Throwable> errors = itemsCollector.getErrors();
|
||||
|
||||
defaultTestListOfItems(expectedServiceId, itemsList, errors);
|
||||
|
|
|
@ -57,7 +57,7 @@ public class SoundcloudChartsExtractorTest {
|
|||
}
|
||||
}
|
||||
assertTrue("no streams are received",
|
||||
!collector.getItemList().isEmpty()
|
||||
!collector.getItems().isEmpty()
|
||||
&& collector.getErrors().isEmpty());
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class SoundcloudChartsExtractorTest {
|
|||
|
||||
@Test
|
||||
public void testGetNextPage() throws Exception {
|
||||
extractor.getInfoItems().getItemList();
|
||||
extractor.getInfoItems().getItems();
|
||||
assertFalse("extractor has next streams", extractor.getPage(extractor.getNextPageUrl()) == null
|
||||
|| extractor.getPage(extractor.getNextPageUrl()).getItemsList().isEmpty());
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class SoundcloudSearchEngineChannelTest extends BaseSoundcloudSearchTest
|
|||
@Test
|
||||
public void testResultsItemType() {
|
||||
for (InfoItem infoItem : result.resultList) {
|
||||
assertEquals(InfoItem.InfoType.CHANNEL, infoItem.info_type);
|
||||
assertEquals(InfoItem.InfoType.CHANNEL, infoItem.getInfoType());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public class SoundcloudSearchEnginePlaylistTest extends BaseSoundcloudSearchTest
|
|||
@Test
|
||||
public void testUserItemType() {
|
||||
for (InfoItem infoItem : result.resultList) {
|
||||
assertEquals(InfoItem.InfoType.PLAYLIST, infoItem.info_type);
|
||||
assertEquals(InfoItem.InfoType.PLAYLIST, infoItem.getInfoType());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public class SoundcloudSearchEngineStreamTest extends BaseSoundcloudSearchTest {
|
|||
@Test
|
||||
public void testResultsItemType() {
|
||||
for (InfoItem infoItem : result.resultList) {
|
||||
assertEquals(InfoItem.InfoType.STREAM, infoItem.info_type);
|
||||
assertEquals(InfoItem.InfoType.STREAM, infoItem.getInfoType());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ public class SoundcloudStreamExtractorDefaultTest {
|
|||
@Test
|
||||
public void testGetRelatedVideos() throws ExtractionException, IOException {
|
||||
StreamInfoItemsCollector relatedVideos = extractor.getRelatedVideos();
|
||||
assertFalse(relatedVideos.getItemList().isEmpty());
|
||||
assertFalse(relatedVideos.getItems().isEmpty());
|
||||
assertTrue(relatedVideos.getErrors().isEmpty());
|
||||
}
|
||||
|
||||
|
|
|
@ -52,8 +52,8 @@ public class YoutubeSearchEngineAllTest extends BaseYoutubeSearchTest {
|
|||
|
||||
// THe channel should be the first item
|
||||
assertTrue(firstInfoItem instanceof ChannelInfoItem);
|
||||
assertEquals("name", "PewDiePie", firstInfoItem.name);
|
||||
assertEquals("url","https://www.youtube.com/user/PewDiePie", firstInfoItem.url);
|
||||
assertEquals("name", "PewDiePie", firstInfoItem.getName());
|
||||
assertEquals("url","https://www.youtube.com/user/PewDiePie", firstInfoItem.getUrl());
|
||||
}
|
||||
|
||||
@Ignore
|
||||
|
|
|
@ -52,7 +52,7 @@ public class YoutubeSearchEngineChannelTest extends BaseYoutubeSearchTest {
|
|||
@Test
|
||||
public void testResultsItemType() {
|
||||
for (InfoItem infoItem : result.resultList) {
|
||||
assertEquals(InfoItem.InfoType.CHANNEL, infoItem.info_type);
|
||||
assertEquals(InfoItem.InfoType.CHANNEL, infoItem.getInfoType());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public class YoutubeSearchEnginePlaylistTest extends BaseYoutubeSearchTest {
|
|||
public void testInfoItemType() {
|
||||
for (InfoItem infoItem : result.resultList) {
|
||||
assertTrue(infoItem instanceof PlaylistInfoItem);
|
||||
assertEquals(InfoItem.InfoType.PLAYLIST, infoItem.info_type);
|
||||
assertEquals(InfoItem.InfoType.PLAYLIST, infoItem.getInfoType());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class YoutubeSearchEngineStreamTest extends BaseYoutubeSearchTest {
|
|||
@Test
|
||||
public void testResultsItemType() {
|
||||
for (InfoItem infoItem : result.resultList) {
|
||||
assertEquals(InfoItem.InfoType.STREAM, infoItem.info_type);
|
||||
assertEquals(InfoItem.InfoType.STREAM, infoItem.getInfoType());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -139,8 +139,8 @@ public class YoutubeStreamExtractorDefaultTest {
|
|||
@Test
|
||||
public void testGetRelatedVideos() throws ExtractionException, IOException {
|
||||
StreamInfoItemsCollector relatedVideos = extractor.getRelatedVideos();
|
||||
Utils.printErrors(relatedVideos);
|
||||
assertFalse(relatedVideos.getItemList().isEmpty());
|
||||
Utils.printErrors(relatedVideos.getErrors());
|
||||
assertFalse(relatedVideos.getItems().isEmpty());
|
||||
assertTrue(relatedVideos.getErrors().isEmpty());
|
||||
}
|
||||
|
||||
|
|
|
@ -67,8 +67,8 @@ public class YoutubeTrendingExtractorTest {
|
|||
@Test
|
||||
public void testGetStreamsQuantity() throws Exception {
|
||||
InfoItemsCollector collector = extractor.getInfoItems();
|
||||
Utils.printErrors(collector);
|
||||
assertTrue("no streams are received", collector.getItemList().size() >= 20);
|
||||
Utils.printErrors(collector.getErrors());
|
||||
assertTrue("no streams are received", collector.getItems().size() >= 20);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -50,7 +50,7 @@ public class YoutubeTrendingKioskInfoTest {
|
|||
|
||||
@Test
|
||||
public void getStreams() {
|
||||
assertFalse(kioskInfo.getRelatedStreams().isEmpty());
|
||||
assertFalse(kioskInfo.getRelatedItems().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue