77import com .grack .nanojson .JsonObject ;
88import com .grack .nanojson .JsonParser ;
99import com .grack .nanojson .JsonParserException ;
10+ import com .grack .nanojson .JsonWriter ;
1011
1112import org .schabi .newpipe .extractor .NewPipe ;
1213import org .schabi .newpipe .extractor .StreamingService ;
1314import org .schabi .newpipe .extractor .downloader .Downloader ;
1415import org .schabi .newpipe .extractor .exceptions .ExtractionException ;
1516import org .schabi .newpipe .extractor .suggestion .SuggestionExtractor ;
16- import org .schabi .newpipe .extractor .utils .Utils ;
1717
1818import java .io .IOException ;
19+ import java .nio .charset .StandardCharsets ;
1920import java .util .Collections ;
2021import java .util .List ;
2122import java .util .stream .Collectors ;
2223
2324public class BandcampSuggestionExtractor extends SuggestionExtractor {
2425
25- private static final String AUTOCOMPLETE_URL = BASE_API_URL + "/fuzzysearch/1/autocomplete?q=" ;
26+ private static final String AUTOCOMPLETE_URL = BASE_API_URL
27+ + "/bcsearch_public_api/1/autocomplete_elastic" ;
2628 public BandcampSuggestionExtractor (final StreamingService service ) {
2729 super (service );
2830 }
@@ -33,7 +35,18 @@ public List<String> suggestionList(final String query) throws IOException, Extra
3335
3436 try {
3537 final JsonObject fuzzyResults = JsonParser .object ().from (downloader
36- .get (AUTOCOMPLETE_URL + Utils .encodeUrlUtf8 (query )).responseBody ());
38+ .postWithContentTypeJson (
39+ AUTOCOMPLETE_URL ,
40+ Collections .emptyMap (),
41+ JsonWriter .string ()
42+ .object ()
43+ .value ("fan_id" , (String ) null )
44+ .value ("full_page" , false )
45+ .value ("search_filter" , "" )
46+ .value ("search_text" , query )
47+ .end ()
48+ .done ()
49+ .getBytes (StandardCharsets .UTF_8 )).responseBody ());
3750
3851 return fuzzyResults .getObject ("auto" ).getArray ("results" ).stream ()
3952 .filter (JsonObject .class ::isInstance )
0 commit comments