Skip to content

Instantly share code, notes, and snippets.

@nicholastay
Last active October 12, 2023 10:39
Show Gist options
  • Save nicholastay/4a8f8bb9b85c628d7a124dad998cdba4 to your computer and use it in GitHub Desktop.
Save nicholastay/4a8f8bb9b85c628d7a124dad998cdba4 to your computer and use it in GitHub Desktop.
Simple Genshin Wish URL getter in bash (tested with git bash) + Honkai Star Rail Warp getter
# Place in `.bashrc` or similar for easy access!
# (This script was made because I didn't really trust running a random .ps1 script every time, and it's hard
# for me to audit those. This is much simpler and doesn't involve executing a script off a URL.)
#
# Last updated for 4.1 updated wish page
genshinlog() {
GENSHIN_INSTALL_DIR="/c/Games/Genshin Impact"
LATEST_CACHE="$(find "$GENSHIN_INSTALL_DIR"'/Genshin Impact game/GenshinImpact_Data/webCaches' -maxdepth 1 -type d -name '2.*' | sort | tail -1)"
grep -aoP 'https://hk4e-api-os.hoyoverse.com/.+?/getGachaLog.+?&game_biz=hk4e_global' "$LATEST_CACHE/Cache/Cache_Data/data_2" | tail -1 | tee /dev/tty | clip
}
# Last updated for 1.0 HSR
hsrlog() {
HSR_INSTALL_DIR=/c/Games/Star\ Rail
grep -aoP 'https://api-os-takumi.mihoyo.com/.+?/getGachaLog.+?&game_biz=hkrpg_global' "$HSR_INSTALL_DIR/Games/StarRail_Data/webCaches/Cache/Cache_Data/data_2" | tail -1 | tee /dev/tty | clip
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment