Smaller code improvements

This commit is contained in:
TobiGr 2021-03-30 10:10:45 +02:00
parent 8fbd1a2bcf
commit 657b00ca11
3 changed files with 6 additions and 7 deletions

View file

@ -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

@ -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

@ -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())) {