#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.
Krock3 月之前 关闭
登录 并参与到对话中。
未选择里程碑
未指派成员
3 名参与者
正在加载...
取消
保存
这个人很懒,什么都没留下。