Bandcamp search query handler factory: inline variable
This commit is contained in:
parent
10ae3db118
commit
8c70dab8c5
2 changed files with 3 additions and 9 deletions
|
@ -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")
|
||||
|
|
|
@ -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<String> 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) {
|
||||
|
|
Loading…
Reference in a new issue