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 123de430c..935641ce1 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 @@ -7,22 +7,24 @@ import static org.schabi.newpipe.extractor.services.bandcamp.extractors.Bandcamp import com.grack.nanojson.JsonObject; import com.grack.nanojson.JsonParser; import com.grack.nanojson.JsonParserException; +import com.grack.nanojson.JsonWriter; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.downloader.Downloader; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.suggestion.SuggestionExtractor; -import org.schabi.newpipe.extractor.utils.Utils; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; public class BandcampSuggestionExtractor extends SuggestionExtractor { - private static final String AUTOCOMPLETE_URL = BASE_API_URL + "/fuzzysearch/1/autocomplete?q="; + private static final String AUTOCOMPLETE_URL = BASE_API_URL + + "/bcsearch_public_api/1/autocomplete_elastic"; public BandcampSuggestionExtractor(final StreamingService service) { super(service); } @@ -33,7 +35,18 @@ public class BandcampSuggestionExtractor extends SuggestionExtractor { try { final JsonObject fuzzyResults = JsonParser.object().from(downloader - .get(AUTOCOMPLETE_URL + Utils.encodeUrlUtf8(query)).responseBody()); + .postWithContentTypeJson( + AUTOCOMPLETE_URL, + Collections.emptyMap(), + JsonWriter.string() + .object() + .value("fan_id", (String) null) + .value("full_page", false) + .value("search_filter", "") + .value("search_text", query) + .end() + .done() + .getBytes(StandardCharsets.UTF_8)).responseBody()); return fuzzyResults.getObject("auto").getArray("results").stream() .filter(JsonObject.class::isInstance)