Skip to content

Instantly share code, notes, and snippets.

@Cha14ka
Last active September 10, 2023 09:16
Show Gist options
  • Save Cha14ka/b8f23570f415bed184206b7fd7ab9518 to your computer and use it in GitHub Desktop.
Save Cha14ka/b8f23570f415bed184206b7fd7ab9518 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import re
import subprocess
hsr_process = subprocess.run(
'ps aux | grep "StarRail.exe"',
shell=True,
stdout=subprocess.PIPE
).stdout.decode().split('\n')[0]
hsr_dir = re.findall('\D\:(\\\\.+)StarRail.exe\s', hsr_process)[0].replace('\\','/')
cache = open(f'{hsr_dir}/StarRail_Data/webCaches/Cache/Cache_Data/data_2', 'rb').read()
cache = str(cache)
spl = cache.split('getGachaLog')
url = 'https://{}getGachaLog{}end_id=0'.format(
spl[-2].split('https://')[-1],
spl[-1].split('end_id=0')[0]
)
print(url)
@LudovicoPiero
Copy link

Traceback (most recent call last):
  File "/home/ludovico/Stuff/warp_honkers/main.py", line 18, in <module>
    spl[-2].split('https://')[-1],
    ~~~^^^^
IndexError: list index out of range

Got this error when running the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment