Voici mon script pouvez vous faire en sorte que les beatmapsets soient nommé par le nom tel quel sont téléchargé .osz et non comme ca {beatmapset_id}.osz
par exemple le beatmapsets ayant comme id 123456 ne sera pas nommé "123456.osz" mais "123456 Lite Show Magic - Crack traxxxx.osz" si le script fonctionne correctement
Donc pouvez vous faire en sorte que tout les téléchargement passe par selenium sans changer le mecanisme de thread de beatmap perdu etc
import os
import sys
import requests
from typing import List
from concurrent.futures import ThreadPoolExecutor, as_completed

osu_mirrors = [
    "https://kitsu.moe/api/d/",
    "https://chimu.moe/d/",
    "https://proxy.nerinyan.moe/d/",
    "https://beatconnect.io/b/",
    "https://osu.sayobot.cn/osu.php?s=",
    "https://storage.ripple.moe/d/",
    "https://akatsuki.gg/d/",
    "https://ussr.pl/d/",
    "https://osu.gatari.pw/d/",
    "http://storage.kawata.pw/d/",
    "https://catboy.best/d/",
    "https://kawata.pw/b/",
    "https://redstar.moe/b/",
    "https://atoka.pw/b/",
    "https://fumosu.pw/b/",
    "https://osu.direct/api/d/",
]

def download_beatmapset(beatmapset_id: int, url: str):
    try:
        response = requests.get(url + str(beatmapset_id))
        response.raise_for_status()
        file_name = f"{beatmapset_id}.osz"
        with open(file_name, "wb") as f:
            f.write(response.content)
        print(f"Beatmapset {beatmapset_id} téléchargé depuis {url}")
        return (True, beatmapset_id)
    except requests.exceptions.RequestException as e:
        print(f"Erreur lors du téléchargement de {beatmapset_id} depuis {url}: {e}")
        return (False, beatmapset_id)

def download_from_mirrors(beatmapset_id: int):
    for url in osu_mirrors:
        success, _ = download_beatmapset(beatmapset_id, url)
        if success:
            break
    else:
        print(f"Beatmapset {beatmapset_id} est perdu (introuvable sur les miroirs)")

def main(file_name: str):
    with open(file_name, "r") as f:
        beatmapset_ids = [int(line.strip()) for line in f]

    output_dir = file_name.replace(".txt", "")
    os.makedirs(output_dir, exist_ok=True)
    os.chdir(output_dir)

    with ThreadPoolExecutor(max_workers=len(osu_mirrors)) as executor:
        results = {executor.submit(download_beatmapset, beatmapset_id, url): (beatmapset_id, url) for beatmapset_id, url in zip(beatmapset_ids, osu_mirrors * (len(beatmapset_ids) // len(osu_mirrors)))}
        unsuccessful_downloads = []

        for future in as_completed(results):
            beatmapset_id, url = results[future]
            success, downloaded_beatmapset_id = future.result()
            if not success:
                unsuccessful_downloads.append(downloaded_beatmapset_id)

    for beatmapset_id in unsuccessful_downloads:
        download_from_mirrors(beatmapset_id)

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: python download_beatmapsets.py <beatmapsets_file.txt>")
        sys.exit(1)
    main(sys.argv[1])