genshin.py icon indicating copy to clipboard operation
genshin.py copied to clipboard

Cannot get CharacterRanks data from client.get_spiral_abyss() if I don't browse the Hoyolab app first

Open KT-Yeh opened this issue 2 years ago • 6 comments

How to reproduce:

  1. Finish any floor of abyss
  2. Wait and don't open Hoyolab app or website
  3. Use client.get_spiral_abyss() function
  4. The CharacterRanks is empty. Everything else works.
  5. After you browse Hoyolab app or website, the CharacterRanks will show normally when using client.get_spiral_abyss()

Example

    data = await client.get_spiral_abyss(826263929)
    print(data)
SpiralAbyss(unlocked=False, season=48, 
    start_time=datetime.datetime(2022, 6, 15, 20, 0, tzinfo=datetime.timezone.utc), 
    end_time=datetime.datetime(2022, 6, 30, 19, 59, 59, tzinfo=datetime.timezone.utc), 
    total_battles=6, total_wins='6', max_floor='10-3', total_stars=18, 
    ranks=CharacterRanks(most_played=[], most_kills=[], strongest_strike=[], most_damage_taken=[], most_bursts_used=[], most_skills_used=[]), 
    floors=[Floor(floor=9, unlocked=True, stars=9, max_stars=9, chambers=[
    Chamber(chamber=1, stars=3, max_stars=3, battles=[Battle(half=1, timestamp=datetime.date(2022, 6, 16), characters=[AbyssCharacter(id=10000046, name='Hu Tao', element='Pyro', rarity=5, 
    .....

KT-Yeh avatar Jun 16 '22 14:06 KT-Yeh

Do they show up immediately after doing the floor and checking the hoyolab app? There used to be a 1-hour delay.

thesadru avatar Jun 16 '22 15:06 thesadru

yeah, CharacterRanks show up immediately after I open the hoyolab website.

the time between my bot commands is about 1 minute

KT-Yeh avatar Jun 16 '22 15:06 KT-Yeh

This sounds very annoying to debug but I'll see what I can do.

thesadru avatar Jun 16 '22 15:06 thesadru

I found the requests are after getGameRecordCard.

I use another UID and the CharacterRanks is empty.

    await client.get_record_cards()
    data = await client.get_spiral_abyss(client.uid)
    print(data.ranks)

After client.get_record_cards(), the result can show CharacterRanks correctly now.

KT-Yeh avatar Jun 17 '22 12:06 KT-Yeh

Guess this should be documented. I don't want to force users to make an extra request arbitrarily.

thesadru avatar Jun 17 '22 13:06 thesadru