#466 Wish History

닫힘
Cha14ka3 달 전을 오픈 · 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 달 전가 Close
로그인하여 이 대화에 참여
마일스톤 없음
담당자 없음
참여자 3명
로딩중...
취소
저장
아직 콘텐츠가 없습니다.