osuAkatsuki / bancho.py

An osu! server for the generic public, optimized for maintainability in modern python
https://akatsuki.gg
MIT License
212 stars 125 forks source link

[osu! direct] fetch beatmap information from osu!api for osu-search.php #210

Open cdwcgt opened 2 years ago

cdwcgt commented 2 years ago

We can use osu!api v2 to search beatmap instead of beatmap mirror And download beatmap from mirror site by beatmap(set) id

def750 commented 2 years ago

There's one issue, searching with mirror allows you to see deleted maps. I don't know how deleted maps stand in std community but for example for mania players it's important.

cdwcgt commented 2 years ago

is it impossible that when osu!api return 404 and then use mirror site The reason for this idea is because not all mirror sites support search (or perfect for gulag configuration) so we can use osu!api v2 for major search and use mirror site for backup (or the other way around?)

tsunyoku commented 2 years ago

the issue with the 404 idea is we can’t differentiate a map genuinely not existing ever or a map that doesn’t exist anymore. it means any request without a map will require a 2nd possibly useless request that just makes people wait longer. furthermore, in the case there is maps returned but unsubmitted one are missed, we just won’t know about them. regardless, if you want my 2 cents, we should not care about providing for unsubmitted maps as they’re unusable anyways

tsunyoku commented 2 years ago

also considering we’d have to use a mirror to download the maps, there’s rlly no point in going thru the hassle of using api v2 for getting the maps when we’d still be equally reliant on an existing mirror

cdwcgt commented 2 years ago

the issue with the 404 idea is we can’t differentiate a map genuinely not existing ever or a map that doesn’t exist anymore. it means any request without a map will require a 2nd possibly useless request that just makes people wait longer. furthermore, in the case there is maps returned but unsubmitted one are missed, we just won’t know about them. regardless, if you want my 2 cents, we should not care about providing for unsubmitted maps as they’re unusable anyways

if so, is it possible to make get the beatmap through osu!api as an optional configuration item, let users choose

also considering we’d have to use a mirror to download the maps, there’s rlly no point in going thru the hassle of using api v2 for getting the maps when we’d still be equally reliant on an existing mirror

sometimes we need to use other mirror site but it doesn't support search so support osu!api v2 is necessary

tsunyoku commented 2 years ago

the issue with the 404 idea is we can’t differentiate a map genuinely not existing ever or a map that doesn’t exist anymore. it means any request without a map will require a 2nd possibly useless request that just makes people wait longer. furthermore, in the case there is maps returned but unsubmitted one are missed, we just won’t know about them. regardless, if you want my 2 cents, we should not care about providing for unsubmitted maps as they’re unusable anyways

if so, is it possible to make get the beatmap through osu!api as an optional configuration item, let users choose

also considering we’d have to use a mirror to download the maps, there’s rlly no point in going thru the hassle of using api v2 for getting the maps when we’d still be equally reliant on an existing mirror

sometimes we need to use other mirror site but it doesn't support search so support osu!api v2 is necessary

api v2 is not necessary, yes it can be optional as a “mirror type” (referencing other open issue about adding more mirrors) but it’s api model is VERY different to any other so it would require a fair bit of rewriting to accommodate for it, and it’s just not worth it. i’ve also never come across a beatmap mirror which does not support searching

cdwcgt commented 2 years ago

api v2 is not necessary, yes it can be optional as a “mirror type” (referencing other open issue about adding more mirrors) but it’s api model is VERY different to any other so it would require a fair bit of rewriting to accommodate for it, and it’s just not worth it. i’ve also never come across a beatmap mirror which does not support searching

some mirror site's search api may not give the full information of beatmapset (like each difficult HP CS..) and we just need client api and client secret to get token

as the api medel of osu!api I think it is only a big difference in the need for authentication

the response of osu!api v2 is easy to handle

tsunyoku commented 2 years ago

it’s not that it’s difficult to handle. it’s that it’s very different to any other mirror we support currently, so it’s gonna be a big modification to the current code that won’t necessarily be all that clean and as i said before not really necessary. i had this idea once before also, however unfortunately it’s search without query terms is also limited so i don’t think it’s really fit for purpose really. also if a mirror is missing as basic info as CS, HP etc. that suggests a way larger problem with that mirror which is not our issue…

zvyap commented 2 years ago

it’s not that it’s difficult to handle. it’s that it’s very different to any other mirror we support currently, so it’s gonna be a big modification to the current code that won’t necessarily be all that clean and as i said before not really necessary. i had this idea once before also, however unfortunately it’s search without query terms is also limited so i don’t think it’s really fit for purpose really. also if a mirror is missing as basic info as CS, HP etc. that suggests a way larger problem with that mirror which is not our issue…

Totally agree this. If banch.py going to support osu!api v2, other mirror should also be optional. (maybe osu!api v2 is also count as a mirror type?) Some users might want to use his own beatmap mirror server (like me), bsc of the high latency when connect to the official API.

As this project is open source, others should be able to fix the mirror API format issues with PR. For mirrors that missing basic map attribute, it should not be use and support.

But I still agree on adding official API support due to official API provides newest data, stablility, and mirrors brand format issues. Don't remove other mirror support and support osu official API will be a happy ending.

Edit: Fix broken English generate by my mind in 2022 & added some details

tsunyoku commented 6 months ago

going back to this one i do question myself from 2 years ago a little bit.... it would be nice if we were only using mirrors where absolutely necessary so we can benefit from the reliability of osu!api v2. i'd want to scope this out to be more than just osu!direct but to replace all mirror usage (besides downloads) with api v2 directly. supporting deleted maps is out of scope as it's guaranteed undefined behaviour since mirrors can also lose the beatmap, or someone can switch mirrors or whatever.

whether we'd provide an option to use a mirror still instead of api v2 idk, that's something which will need to be debated - but atleast i'd like to use api v2 where possible

if we're gonna go ahead with this, we should use @NiceAesth's aiosu package.