#466 Wish History

Затворено
отворено пре 3 месеци од Cha14ka · 3 коментара
Cha14ka коментирира пре 3 месеци

If someone needs to get history easily on Linux without manually opening data_2, here's a Bash script

#!/bin/bash

GIPATH=$(ps aux | grep -a -Po 'Z:.+GenshinImpact.exe' | head -1 | sed -e 's/Z://' | sed -e 's/GenshinImpact.exe//' | tr '\\' '/' | sed s/'\W*$'//)
CACHEDIR=$GIPATH/GenshinImpact_Data/webCaches
CACHEDIR=$CACHEDIR/$(ls -t "$CACHEDIR" | grep -a -Po "\d+.\d+.\d+.\d" | head -1)
CACHEFILE=$CACHEDIR/Cache/Cache_Data/data_2

cat "$CACHEFILE" | grep -a -Po '(https:\/\/gs\.hoyoverse\.com\/genshin\/event\/e20190909gacha-v2.+?hk4e_global)\W' | tail -n 1

Or like this wget -qO - https://gist.githubusercontent.com/Cha14ka/f7fdd14515b909c7541ebf55ae44b51d/raw/3b905b1157bd1bce630ea9298deb49bac1a55599/gi_history.sh | bash

If someone needs to get history easily on Linux without manually opening data_2, here's a Bash script ```bash #!/bin/bash GIPATH=$(ps aux | grep -a -Po 'Z:.+GenshinImpact.exe' | head -1 | sed -e 's/Z://' | sed -e 's/GenshinImpact.exe//' | tr '\\' '/' | sed s/'\W*$'//) CACHEDIR=$GIPATH/GenshinImpact_Data/webCaches CACHEDIR=$CACHEDIR/$(ls -t "$CACHEDIR" | grep -a -Po "\d+.\d+.\d+.\d" | head -1) CACHEFILE=$CACHEDIR/Cache/Cache_Data/data_2 cat "$CACHEFILE" | grep -a -Po '(https:\/\/gs\.hoyoverse\.com\/genshin\/event\/e20190909gacha-v2.+?hk4e_global)\W' | tail -n 1 ``` Or like this `wget -qO - https://gist.githubusercontent.com/Cha14ka/f7fdd14515b909c7541ebf55ae44b51d/raw/3b905b1157bd1bce630ea9298deb49bac1a55599/gi_history.sh | bash`
cybik коментирира пре 3 месеци

I made a helper app for this too. I still commit to it on occasion.

https://github.com/cybik/hoywishes

I made a helper app for this too. I still commit to it on occasion. https://github.com/cybik/hoywishes
Krock коментирира пре 3 месеци
Власник

There is also a minimal variant mentioned in FAQ.md. Whereas both scripts work, it would be more reliable to also check against the timestamp within the URL.

Here's the next iteration I've come up for OS + CN without relying on Z:\ paths by using pwdx:

#!/usr/bin/env bash
set -e
GIPATH="."

function get_path_from_pid() {
	# tee eats the status value
	_pid=$(pgrep -f -- "GenshinImpact.exe" | tee)
	if [ -z "$_pid" ]; then
		_pid=$(pgrep -f -- "YuanShen.exe" | tee)
	fi
	[ -z "$_pid" ] && echo "Game process not found" && exit 1
	GIPATH=$(pwdx "$_pid")
	GIPATH=${GIPATH#*\ } # remove leading "pid: "
}

get_path_from_pid

# Get the most recently modified "data_2" file: ISO timestamp + absolute path
CACHEFILE=$(find "$GIPATH" -type f -wholename '*/Cache_Data/data_2' -printf "%T+ %p\n" | sort | tail -n 1)
CACHEFILE=${CACHEFILE#*\ } # remove leading timestamp
echo "Found cache file: $CACHEFILE"
echo "===== Matching links:"

strings "$CACHEFILE" | grep -o "https://.*/e20190909gacha-v2/.*" | tail -n1

EDIT: corrected script mistakes. Feel free to propose a PR to add such script to this repo. Either bash or python is desired for minimal dependencies.

There is also a minimal variant mentioned in [FAQ.md](./src/master/FAQ.md). Whereas both scripts work, it would be more reliable to also check against the timestamp within the URL. Here's the next iteration I've come up for OS + CN without relying on `Z:\` paths by using `pwdx`: ```sh #!/usr/bin/env bash set -e GIPATH="." function get_path_from_pid() { # tee eats the status value _pid=$(pgrep -f -- "GenshinImpact.exe" | tee) if [ -z "$_pid" ]; then _pid=$(pgrep -f -- "YuanShen.exe" | tee) fi [ -z "$_pid" ] && echo "Game process not found" && exit 1 GIPATH=$(pwdx "$_pid") GIPATH=${GIPATH#*\ } # remove leading "pid: " } get_path_from_pid # Get the most recently modified "data_2" file: ISO timestamp + absolute path CACHEFILE=$(find "$GIPATH" -type f -wholename '*/Cache_Data/data_2' -printf "%T+ %p\n" | sort | tail -n 1) CACHEFILE=${CACHEFILE#*\ } # remove leading timestamp echo "Found cache file: $CACHEFILE" echo "===== Matching links:" strings "$CACHEFILE" | grep -o "https://.*/e20190909gacha-v2/.*" | tail -n1 ``` EDIT: corrected script mistakes. Feel free to propose a PR to add such script to this repo. Either bash or python is desired for minimal dependencies.
Krock коментирира пре 3 месеци
Власник

Added in 5728d88e61.

Feel free to improve the script as needed.

Added in 5728d88e61. Feel free to improve the script as needed.
Krock затворено пре 3 месеци
Пријавите се да се прикључе у овом разговору.
Нема фазе
Нема одговорних
3 учесника
Учитавање...
Откажи
Сачувај
Још нема садржаја.