From 8c70dab8c5fe978d74b381bdc92915222bd928ea Mon Sep 17 00:00:00 2001 From: Fynn Godau Date: Mon, 20 Apr 2020 23:03:46 +0200 Subject: [PATCH] Bandcamp search query handler factory: inline variable --- .../bandcamp/extractors/BandcampSuggestionExtractor.java | 4 +--- .../linkHandler/BandcampSearchQueryHandlerFactory.java | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampSuggestionExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampSuggestionExtractor.java index 4a819ed40..ac75d859a 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampSuggestionExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/extractors/BandcampSuggestionExtractor.java @@ -17,8 +17,6 @@ import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; -import static org.schabi.newpipe.extractor.services.bandcamp.linkHandler.BandcampSearchQueryHandlerFactory.CHARSET_UTF_8; - public class BandcampSuggestionExtractor extends SuggestionExtractor { private static final String AUTOCOMPLETE_URL = "https://bandcamp.com/api/fuzzysearch/1/autocomplete?q="; @@ -32,7 +30,7 @@ public class BandcampSuggestionExtractor extends SuggestionExtractor { try { JsonObject fuzzyResults = JsonParser.object().from( - downloader.get(AUTOCOMPLETE_URL + URLEncoder.encode(query, CHARSET_UTF_8)).responseBody() + downloader.get(AUTOCOMPLETE_URL + URLEncoder.encode(query, "UTF-8")).responseBody() ); JsonArray jsonArray = fuzzyResults.getObject("auto") diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/linkHandler/BandcampSearchQueryHandlerFactory.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/linkHandler/BandcampSearchQueryHandlerFactory.java index 0fad75d5f..4a90c6c0e 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/linkHandler/BandcampSearchQueryHandlerFactory.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/bandcamp/linkHandler/BandcampSearchQueryHandlerFactory.java @@ -11,17 +11,13 @@ import java.util.List; public class BandcampSearchQueryHandlerFactory extends SearchQueryHandlerFactory { - private static final String SEARCH_URL = "https://bandcamp.com/search?q="; - - public static final String CHARSET_UTF_8 = "UTF-8"; - @Override public String getUrl(String query, List contentFilter, String sortFilter) throws ParsingException { try { - return SEARCH_URL + - URLEncoder.encode(query, CHARSET_UTF_8) + return "https://bandcamp.com/search?q=" + + URLEncoder.encode(query, "UTF-8") + "&page=1"; } catch (UnsupportedEncodingException e) {