Closed reinum closed 2 years ago
I can't reproduce given your script, possibly because the score has passed out of the user's recent plays. Can you narrow this down to a single score id which results in this error when api.download_score(mode="osu", score_id)
is called?
Oh, sorry, I forgot. The score ID is 19403445646.
That score...doesn't exist? https://osu.ppy.sh/scores/osu/19403445646
I think I see what happened here - you called api.download_score
with a nonexistent score id. The api returns a response of b'{"error":null}'
, which we blindly feed to osrparse. We should check the response for an error and raise before trying to parse the replay.
For now, this is an error on your end ;)
How is this possible though? The value score.id returned that...?
I will find the score ID using the osu website, and ill try to download the replay with that ID through ossapi / osrparse. I will let you know if it threw an error, or something
You want score.best_id
, not score.id
. I'm not entirely sure what the difference is (and it's not documented anywhere), but I suspect score.best_id
increments once per replay set and score.best_id
increments once per stored (top 1k) replay set.
Oh. Why is this so confusing lol
Now its throwing AttributeError: module 'osrparse' has no attribute 'parse_replay'
... what?
Are you using osrparse 6.x.x and the latest version of ossapi? pip install -U ossapi
, pip install -U osrparse
.
oh... yeah i had out of date ossapi, lol
but its throwing ValueError: 123 is not a valid GameMode
again...
what is going on??
from ossapi import *
api = OssapiV2("id", "secret", "url")
print(api.download_score(mode="osu", score_id=4056787666))
https://osu.ppy.sh/scores/osu/4056787666
That replay isn't downloadable, so of course you can't download it.
I think I take back what I said about id
vs best_id
- I still don't understand the distinction, but it's clear that even when best_id
is available, the replay isn't always downloadable (see above).
What I would recommend is continue to use score.best_id
, but check score.replay
before trying to download. If score.replay
is False
, the score isn't downloadable and you should skip it. Otherwise, you can download it as normal.
I'm going to consider the only actionable part of this issue (confusing error messages) closed with 6c6b265a4ba6b9c429df5a08580b6fc34fd6f66e.
Im trying to make automatic clip bot, that scrapes user replays, downloads .osr, and does other shit.
I tried to use ossapi to scrape and download a replay, but as soon as Im trying to download a replay, it throws ValueError: 123 is not a valid GameMode.
Code: