Closed sll552 closed 4 years ago
Nice catch ! You're valid on both points. I'll fix that for the next version. (See rewrite branch)
I was going to work on this on the rewrite branch and I noticed that the /all endpoint does not exist but doesn't fail either. Here's the source for the API /search endpoint on beatsaver side. It silently ignores as there's a page keyword available here /search/[page]?q=[search]
if it's not a number he just uses the default value: 0.
What beatdrop do however (from what I can read on the code) is another request if he detects the search to be a key.
I'm not sure how I will do on my side yet, but I will implement a way to search by its key. 👌
I guess I should have looked into that a little deeper 😅.
If a seperate request is required maybe its feasible to first look at the search query and if it looks like a key (e.g. is 4 chars long) make a request to something like the stats endpoint and check if its a 404. If the key is not found a normal search request could be made.
Added a way to search by key or hash
Hi,
search does not seem to get any results when searching for the key of the map. This works in BeatDrop.
I guess this is because according to https://github.com/Alaanor/beatlist/blob/master/src/lib/BeatSaverAPI.ts#L17 the
search/text
endpoint is used but BeatDrop usessearch/text/all
(https://github.com/StarGazer1258/BeatDrop/blob/master/src/actions/searchActions.js#L51)Also while looking at that piece of code I noticed that URL encoding might be missing in all functions in https://github.com/Alaanor/beatlist/blob/master/src/lib/BeatSaverAPI.ts .