Merge pull request #578 from TeamNewPipe/code_improvements

Code improvements
This commit is contained in:
XiangRongLin 2021-03-30 18:12:22 +02:00 committed by GitHub
commit 564d74c250
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 40 additions and 47 deletions

View file

@ -4,6 +4,7 @@ import org.schabi.newpipe.extractor.InfoItem;
import org.schabi.newpipe.extractor.InfoItemsCollector; import org.schabi.newpipe.extractor.InfoItemsCollector;
import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ParsingException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
@ -95,7 +96,7 @@ public class CommentsInfoItemsCollector extends InfoItemsCollector<CommentsInfoI
} }
public List<CommentsInfoItem> getCommentsInfoItemList() { public List<CommentsInfoItem> getCommentsInfoItemList() {
List<CommentsInfoItem> siiList = new Vector<>(); List<CommentsInfoItem> siiList = new ArrayList<>();
for (InfoItem ii : super.getItems()) { for (InfoItem ii : super.getItems()) {
if (ii instanceof CommentsInfoItem) { if (ii instanceof CommentsInfoItem) {
siiList.add((CommentsInfoItem) ii); siiList.add((CommentsInfoItem) ii);

View file

@ -69,12 +69,10 @@ public class Response {
public String getHeader(String name) { public String getHeader(String name) {
for (Map.Entry<String, List<String>> headerEntry : responseHeaders.entrySet()) { for (Map.Entry<String, List<String>> headerEntry : responseHeaders.entrySet()) {
final String key = headerEntry.getKey(); final String key = headerEntry.getKey();
if (key != null && key.equalsIgnoreCase(name)) { if (key != null && key.equalsIgnoreCase(name) && !headerEntry.getValue().isEmpty()) {
if (headerEntry.getValue().size() > 0) {
return headerEntry.getValue().get(0); return headerEntry.getValue().get(0);
} }
} }
}
return null; return null;
} }

View file

@ -21,7 +21,7 @@ package org.schabi.newpipe.extractor.exceptions;
*/ */
public class ReCaptchaException extends ExtractionException { public class ReCaptchaException extends ExtractionException {
private String url; private final String url;
public ReCaptchaException(final String message, final String url) { public ReCaptchaException(final String message, final String url) {
super(message); super(message);

View file

@ -37,7 +37,7 @@ public abstract class SearchQueryHandlerFactory extends ListLinkHandlerFactory {
} }
public SearchQueryHandler fromQuery(String query) throws ParsingException { public SearchQueryHandler fromQuery(String query) throws ParsingException {
return fromQuery(query, new ArrayList<String>(0), EMPTY_STRING); return fromQuery(query, new ArrayList<>(0), EMPTY_STRING);
} }
/** /**

View file

@ -106,7 +106,7 @@ public class PlaylistInfo extends ListInfo<StreamInfoItem> {
info.addError(e); info.addError(e);
} }
// do not fail if everything but the uploader infos could be collected // do not fail if everything but the uploader infos could be collected
if (uploaderParsingErrors.size() > 0 && if (!uploaderParsingErrors.isEmpty() &&
(!info.getErrors().isEmpty() || uploaderParsingErrors.size() < 3)) { (!info.getErrors().isEmpty() || uploaderParsingErrors.size() < 3)) {
info.addAllErrors(uploaderParsingErrors); info.addAllErrors(uploaderParsingErrors);
} }

View file

@ -87,7 +87,7 @@ public class BandcampSearchExtractor extends SearchExtractor {
// Count pages // Count pages
final Elements pageLists = d.getElementsByClass("pagelist"); final Elements pageLists = d.getElementsByClass("pagelist");
if (pageLists.size() == 0) if (pageLists.isEmpty())
return new InfoItemsPage<>(collector, null); return new InfoItemsPage<>(collector, null);
final Elements pages = pageLists.first().getElementsByTag("li"); final Elements pages = pageLists.first().getElementsByTag("li");
@ -96,7 +96,7 @@ public class BandcampSearchExtractor extends SearchExtractor {
int currentPage = -1; int currentPage = -1;
for (int i = 0; i < pages.size(); i++) { for (int i = 0; i < pages.size(); i++) {
final Element pageElement = pages.get(i); final Element pageElement = pages.get(i);
if (pageElement.getElementsByTag("span").size() > 0) { if (!pageElement.getElementsByTag("span").isEmpty()) {
currentPage = i + 1; currentPage = i + 1;
break; break;
} }

View file

@ -217,7 +217,7 @@ public class MediaCCCLiveStreamExtractor extends StreamExtractor {
} }
@Override @Override
public List<VideoStream> getVideoOnlyStreams() throws IOException, ExtractionException { public List<VideoStream> getVideoOnlyStreams() {
return null; return null;
} }
@ -251,8 +251,8 @@ public class MediaCCCLiveStreamExtractor extends StreamExtractor {
@Nonnull @Nonnull
@Override @Override
public String getHost() throws ParsingException { public String getHost() {
return null; return "";
} }
@Nonnull @Nonnull

View file

@ -2,8 +2,6 @@ package org.schabi.newpipe.extractor.services.media_ccc.extractors;
import com.grack.nanojson.JsonArray; import com.grack.nanojson.JsonArray;
import com.grack.nanojson.JsonObject; import com.grack.nanojson.JsonObject;
import com.grack.nanojson.JsonParser;
import com.grack.nanojson.JsonParserException;
import org.schabi.newpipe.extractor.Page; import org.schabi.newpipe.extractor.Page;
import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.downloader.Downloader; import org.schabi.newpipe.extractor.downloader.Downloader;
@ -18,7 +16,7 @@ import javax.annotation.Nonnull;
import java.io.IOException; import java.io.IOException;
public class MediaCCCLiveStreamKiosk extends KioskExtractor<StreamInfoItem> { public class MediaCCCLiveStreamKiosk extends KioskExtractor<StreamInfoItem> {
public JsonArray doc; private JsonArray doc;
public MediaCCCLiveStreamKiosk(StreamingService streamingService, ListLinkHandler linkHandler, String kioskId) { public MediaCCCLiveStreamKiosk(StreamingService streamingService, ListLinkHandler linkHandler, String kioskId) {
super(streamingService, linkHandler, kioskId); super(streamingService, linkHandler, kioskId);

View file

@ -12,7 +12,6 @@ import org.schabi.newpipe.extractor.localization.Localization;
import java.io.IOException; import java.io.IOException;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
import java.util.Locale;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public final class MediaCCCParsingHelper { public final class MediaCCCParsingHelper {

View file

@ -63,7 +63,7 @@ public class PeertubeService extends StreamingService {
public SearchExtractor getSearchExtractor(SearchQueryHandler queryHandler) { public SearchExtractor getSearchExtractor(SearchQueryHandler queryHandler) {
final List<String> contentFilters = queryHandler.getContentFilters(); final List<String> contentFilters = queryHandler.getContentFilters();
boolean external = false; boolean external = false;
if (contentFilters.size() > 0 && contentFilters.get(0).startsWith("sepia_")) { if (!contentFilters.isEmpty() && contentFilters.get(0).startsWith("sepia_")) {
external = true; external = true;
} }
return new PeertubeSearchExtractor(this, queryHandler, external); return new PeertubeSearchExtractor(this, queryHandler, external);

View file

@ -163,7 +163,7 @@ public class PeertubeAccountExtractor extends ChannelExtractor {
} }
final Response response = downloader.get(accountUrl); final Response response = downloader.get(accountUrl);
if (response != null && response.responseBody() != null) { if (response != null) {
setInitialData(response.responseBody()); setInitialData(response.responseBody());
} else { } else {
throw new ExtractionException("Unable to extract PeerTube account data"); throw new ExtractionException("Unable to extract PeerTube account data");

View file

@ -136,7 +136,7 @@ public class PeertubeChannelExtractor extends ChannelExtractor {
public void onFetchPage(final Downloader downloader) throws IOException, ExtractionException { public void onFetchPage(final Downloader downloader) throws IOException, ExtractionException {
final Response response = downloader.get( final Response response = downloader.get(
baseUrl + PeertubeChannelLinkHandlerFactory.API_ENDPOINT + getId()); baseUrl + PeertubeChannelLinkHandlerFactory.API_ENDPOINT + getId());
if (response != null && response.responseBody() != null) { if (response != null ) {
setInitialData(response.responseBody()); setInitialData(response.responseBody());
} else { } else {
throw new ExtractionException("Unable to extract PeerTube channel data"); throw new ExtractionException("Unable to extract PeerTube channel data");

View file

@ -3,7 +3,6 @@ package org.schabi.newpipe.extractor.services.peertube.extractors;
import com.grack.nanojson.JsonArray; import com.grack.nanojson.JsonArray;
import com.grack.nanojson.JsonObject; import com.grack.nanojson.JsonObject;
import com.grack.nanojson.JsonParser; import com.grack.nanojson.JsonParser;
import org.schabi.newpipe.extractor.Page; import org.schabi.newpipe.extractor.Page;
import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.comments.CommentsExtractor; import org.schabi.newpipe.extractor.comments.CommentsExtractor;
@ -15,14 +14,11 @@ import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler; import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper; import org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper;
import org.schabi.newpipe.extractor.utils.JsonUtils;
import org.schabi.newpipe.extractor.utils.Utils; import org.schabi.newpipe.extractor.utils.Utils;
import java.io.IOException; import java.io.IOException;
import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.COUNT_KEY; import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.*;
import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.ITEMS_PER_PAGE;
import static org.schabi.newpipe.extractor.services.peertube.PeertubeParsingHelper.START_KEY;
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty; import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
public class PeertubeCommentsExtractor extends CommentsExtractor { public class PeertubeCommentsExtractor extends CommentsExtractor {

View file

@ -33,6 +33,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import static org.schabi.newpipe.extractor.utils.Utils.UTF_8; import static org.schabi.newpipe.extractor.utils.Utils.UTF_8;
import static org.schabi.newpipe.extractor.utils.Utils.isNullOrEmpty;
public class PeertubeStreamExtractor extends StreamExtractor { public class PeertubeStreamExtractor extends StreamExtractor {
private final String baseUrl; private final String baseUrl;
@ -364,7 +365,7 @@ public class PeertubeStreamExtractor extends StreamExtractor {
@Override @Override
public void onFetchPage(final Downloader downloader) throws IOException, ExtractionException { public void onFetchPage(final Downloader downloader) throws IOException, ExtractionException {
final Response response = downloader.get(baseUrl + PeertubeStreamLinkHandlerFactory.VIDEO_API_ENDPOINT + getId()); final Response response = downloader.get(baseUrl + PeertubeStreamLinkHandlerFactory.VIDEO_API_ENDPOINT + getId());
if (response != null && response.responseBody() != null) { if (response != null) {
setInitialData(response.responseBody()); setInitialData(response.responseBody());
} else { } else {
throw new ExtractionException("Unable to extract PeerTube channel data"); throw new ExtractionException("Unable to extract PeerTube channel data");
@ -400,7 +401,7 @@ public class PeertubeStreamExtractor extends StreamExtractor {
final String languageCode = JsonUtils.getString(caption, "language.id"); final String languageCode = JsonUtils.getString(caption, "language.id");
final String ext = url.substring(url.lastIndexOf(".") + 1); final String ext = url.substring(url.lastIndexOf(".") + 1);
final MediaFormat fmt = MediaFormat.getFromSuffix(ext); final MediaFormat fmt = MediaFormat.getFromSuffix(ext);
if (fmt != null && languageCode != null) if (fmt != null && !isNullOrEmpty(languageCode))
subtitles.add(new SubtitlesStream(fmt, languageCode, url, false)); subtitles.add(new SubtitlesStream(fmt, languageCode, url, false));
} }
} }

View file

@ -24,7 +24,7 @@ public class PeertubeSearchQueryHandlerFactory extends SearchQueryHandlerFactory
@Override @Override
public String getUrl(String searchString, List<String> contentFilters, String sortFilter) throws ParsingException { public String getUrl(String searchString, List<String> contentFilters, String sortFilter) throws ParsingException {
String baseUrl; String baseUrl;
if (contentFilters.size() > 0 && contentFilters.get(0).startsWith("sepia_")) { if (!contentFilters.isEmpty() && contentFilters.get(0).startsWith("sepia_")) {
baseUrl = SEPIA_BASE_URL; baseUrl = SEPIA_BASE_URL;
} else { } else {
baseUrl = ServiceList.PeerTube.getBaseUrl(); baseUrl = ServiceList.PeerTube.getBaseUrl();
@ -35,10 +35,7 @@ public class PeertubeSearchQueryHandlerFactory extends SearchQueryHandlerFactory
@Override @Override
public String getUrl(String searchString, List<String> contentFilters, String sortFilter, String baseUrl) throws ParsingException { public String getUrl(String searchString, List<String> contentFilters, String sortFilter, String baseUrl) throws ParsingException {
try { try {
final String url = baseUrl + SEARCH_ENDPOINT return baseUrl + SEARCH_ENDPOINT + "?search=" + URLEncoder.encode(searchString, UTF_8);
+ "?search=" + URLEncoder.encode(searchString, UTF_8);
return url;
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
throw new ParsingException("Could not encode query", e); throw new ParsingException("Could not encode query", e);
} }

View file

@ -46,7 +46,7 @@ public class SoundcloudParsingHelper {
private SoundcloudParsingHelper() { private SoundcloudParsingHelper() {
} }
public synchronized static String clientId() throws ExtractionException, IOException { public static synchronized String clientId() throws ExtractionException, IOException {
if (!isNullOrEmpty(clientId)) return clientId; if (!isNullOrEmpty(clientId)) return clientId;
Downloader dl = NewPipe.getDownloader(); Downloader dl = NewPipe.getDownloader();
@ -89,7 +89,7 @@ public class SoundcloudParsingHelper {
SoundcloudStreamExtractor e = (SoundcloudStreamExtractor) SoundCloud SoundcloudStreamExtractor e = (SoundcloudStreamExtractor) SoundCloud
.getStreamExtractor("https://soundcloud.com/liluzivert/do-what-i-want-produced-by-maaly-raw-don-cannon"); .getStreamExtractor("https://soundcloud.com/liluzivert/do-what-i-want-produced-by-maaly-raw-don-cannon");
e.fetchPage(); e.fetchPage();
return e.getAudioStreams().size() >= 1; return !e.getAudioStreams().isEmpty();
} catch (Exception ignored) { } catch (Exception ignored) {
// No need to throw an exception here. If something went wrong, the client_id is wrong // No need to throw an exception here. If something went wrong, the client_id is wrong
return false; return false;
@ -131,7 +131,7 @@ public class SoundcloudParsingHelper {
* *
* @return the url resolved * @return the url resolved
*/ */
public static String resolveUrlWithEmbedPlayer(String apiUrl) throws IOException, ReCaptchaException, ParsingException { public static String resolveUrlWithEmbedPlayer(String apiUrl) throws IOException, ReCaptchaException {
String response = NewPipe.getDownloader().get("https://w.soundcloud.com/player/?url=" String response = NewPipe.getDownloader().get("https://w.soundcloud.com/player/?url="
+ URLEncoder.encode(apiUrl, UTF_8), SoundCloud.getLocalization()).responseBody(); + URLEncoder.encode(apiUrl, UTF_8), SoundCloud.getLocalization()).responseBody();

View file

@ -83,7 +83,7 @@ public class SoundcloudSearchExtractor extends SearchExtractor {
throw new ParsingException("Could not parse json response", e); throw new ParsingException("Could not parse json response", e);
} }
if (searchCollection.size() == 0) { if (searchCollection.isEmpty()) {
throw new SearchExtractor.NothingFoundException("Nothing found"); throw new SearchExtractor.NothingFoundException("Nothing found");
} }
} }

View file

@ -10,7 +10,7 @@ import java.util.List;
public class SoundcloudChannelLinkHandlerFactory extends ListLinkHandlerFactory { public class SoundcloudChannelLinkHandlerFactory extends ListLinkHandlerFactory {
private static final SoundcloudChannelLinkHandlerFactory instance = new SoundcloudChannelLinkHandlerFactory(); private static final SoundcloudChannelLinkHandlerFactory instance = new SoundcloudChannelLinkHandlerFactory();
private final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+" + private static final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+" +
"(/((tracks|albums|sets|reposts|followers|following)/?)?)?([#?].*)?$"; "(/((tracks|albums|sets|reposts|followers|following)/?)?)?([#?].*)?$";
public static SoundcloudChannelLinkHandlerFactory getInstance() { public static SoundcloudChannelLinkHandlerFactory getInstance() {

View file

@ -6,8 +6,8 @@ import org.schabi.newpipe.extractor.utils.Parser;
import java.util.List; import java.util.List;
public class SoundcloudChartsLinkHandlerFactory extends ListLinkHandlerFactory { public class SoundcloudChartsLinkHandlerFactory extends ListLinkHandlerFactory {
private final String TOP_URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/charts(/top)?/?([#?].*)?$"; private static final String TOP_URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/charts(/top)?/?([#?].*)?$";
private final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/charts(/top|/new)?/?([#?].*)?$"; private static final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/charts(/top|/new)?/?([#?].*)?$";
@Override @Override

View file

@ -10,7 +10,7 @@ import java.util.List;
public class SoundcloudPlaylistLinkHandlerFactory extends ListLinkHandlerFactory { public class SoundcloudPlaylistLinkHandlerFactory extends ListLinkHandlerFactory {
private static final SoundcloudPlaylistLinkHandlerFactory instance = new SoundcloudPlaylistLinkHandlerFactory(); private static final SoundcloudPlaylistLinkHandlerFactory instance = new SoundcloudPlaylistLinkHandlerFactory();
private final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+" + private static final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+" +
"/sets/[0-9a-z_-]+/?([#?].*)?$"; "/sets/[0-9a-z_-]+/?([#?].*)?$";
public static SoundcloudPlaylistLinkHandlerFactory getInstance() { public static SoundcloudPlaylistLinkHandlerFactory getInstance() {

View file

@ -8,7 +8,7 @@ import org.schabi.newpipe.extractor.utils.Utils;
public class SoundcloudStreamLinkHandlerFactory extends LinkHandlerFactory { public class SoundcloudStreamLinkHandlerFactory extends LinkHandlerFactory {
private static final SoundcloudStreamLinkHandlerFactory instance = new SoundcloudStreamLinkHandlerFactory(); private static final SoundcloudStreamLinkHandlerFactory instance = new SoundcloudStreamLinkHandlerFactory();
private final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+" + private static final String URL_PATTERN = "^https?://(www\\.|m\\.)?soundcloud.com/[0-9a-z_-]+" +
"/(?!(tracks|albums|sets|reposts|followers|following)/?$)[0-9a-z_-]+/?([#?].*)?$"; "/(?!(tracks|albums|sets|reposts|followers|following)/?$)[0-9a-z_-]+/?([#?].*)?$";
private SoundcloudStreamLinkHandlerFactory() { private SoundcloudStreamLinkHandlerFactory() {

View file

@ -123,7 +123,7 @@ public class YoutubeService extends StreamingService {
public SearchExtractor getSearchExtractor(SearchQueryHandler query) { public SearchExtractor getSearchExtractor(SearchQueryHandler query) {
final List<String> contentFilters = query.getContentFilters(); final List<String> contentFilters = query.getContentFilters();
if (contentFilters.size() > 0 && contentFilters.get(0).startsWith("music_")) { if (!contentFilters.isEmpty() && contentFilters.get(0).startsWith("music_")) {
return new YoutubeMusicSearchExtractor(this, query); return new YoutubeMusicSearchExtractor(this, query);
} else { } else {
return new YoutubeSearchExtractor(this, query); return new YoutubeSearchExtractor(this, query);
@ -221,6 +221,7 @@ public class YoutubeService extends StreamingService {
return SUPPORTED_LANGUAGES; return SUPPORTED_LANGUAGES;
} }
@Override
public List<ContentCountry> getSupportedCountries() { public List<ContentCountry> getSupportedCountries() {
return SUPPORTED_COUNTRIES; return SUPPORTED_COUNTRIES;
} }

View file

@ -32,7 +32,7 @@ public class YoutubeSearchQueryHandlerFactory extends SearchQueryHandlerFactory
@Override @Override
public String getUrl(String searchString, List<String> contentFilters, String sortFilter) throws ParsingException { public String getUrl(String searchString, List<String> contentFilters, String sortFilter) throws ParsingException {
try { try {
if (contentFilters.size() > 0) { if (!contentFilters.isEmpty()) {
switch (contentFilters.get(0)) { switch (contentFilters.get(0)) {
case ALL: case ALL:
default: default:

View file

@ -10,6 +10,7 @@ import org.schabi.newpipe.extractor.utils.ExtractorHelper;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -153,11 +154,11 @@ public class StreamInfo extends Info {
// Lists can be null if a exception was thrown during extraction // Lists can be null if a exception was thrown during extraction
if (streamInfo.getVideoStreams() == null) if (streamInfo.getVideoStreams() == null)
streamInfo.setVideoStreams(new ArrayList<VideoStream>()); streamInfo.setVideoStreams(Collections.emptyList());
if (streamInfo.getVideoOnlyStreams() == null) if (streamInfo.getVideoOnlyStreams() == null)
streamInfo.setVideoOnlyStreams(new ArrayList<VideoStream>()); streamInfo.setVideoOnlyStreams(Collections.emptyList());
if (streamInfo.getAudioStreams() == null) if (streamInfo.getAudioStreams() == null)
streamInfo.setAudioStreams(new ArrayList<AudioStream>()); streamInfo.setAudioStreams(Collections.emptyList());
Exception dashMpdError = null; Exception dashMpdError = null;
if (!isNullOrEmpty(streamInfo.getDashMpdUrl())) { if (!isNullOrEmpty(streamInfo.getDashMpdUrl())) {

View file

@ -5,6 +5,7 @@ import org.schabi.newpipe.extractor.InfoItemsCollector;
import org.schabi.newpipe.extractor.exceptions.FoundAdException; import org.schabi.newpipe.extractor.exceptions.FoundAdException;
import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ParsingException;
import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
@ -111,7 +112,7 @@ public class StreamInfoItemsCollector extends InfoItemsCollector<StreamInfoItem,
} }
public List<StreamInfoItem> getStreamInfoItemList() { public List<StreamInfoItem> getStreamInfoItemList() {
List<StreamInfoItem> siiList = new Vector<>(); List<StreamInfoItem> siiList = new ArrayList<>();
for (InfoItem ii : super.getItems()) { for (InfoItem ii : super.getItems()) {
if (ii instanceof StreamInfoItem) { if (ii instanceof StreamInfoItem) {
siiList.add((StreamInfoItem) ii); siiList.add((StreamInfoItem) ii);