MadeBaruna / paimon-moe

Your best Genshin Impact companion! Help you plan what to farm with ascension calculator and database. Also track your progress with todo and wish counter.
https://paimon.moe
MIT License
1.38k stars 263 forks source link

New Wish History Interface doesn't seem to work with the getlink_global.ps1 Script Anymore #296

Closed cindrmon closed 2 years ago

cindrmon commented 2 years ago

Since the v3.0 Update, I noticed that the Wish History Interface is updated, and alongside it, the script used for scraping the Wish History to update the Paimon.moe Wish Statistics doesn't seem to work anymore. It just says taht the wish history url cannot be found.\

Here is a pic of the new wish history interface (I'm using a dual-monitor setup to also show you the output of the current script):

Screenshot (107)

MadeBaruna commented 2 years ago

https://bit.ly/3QKFLEQ

cptmacp commented 2 years ago

it dont seem to update the history far back.

it says lifetime pull 70 , which is not the case for me .

MadeBaruna commented 2 years ago

Yeah it can only fetch 6 months back

cindrmon commented 2 years ago

https://bit.ly/3QKFLEQ

are you sure this is safe? will this process not get me banned or anything? just making sure...

cindrmon commented 2 years ago

it dont seem to update the history far back.

it says lifetime pull 70 , which is not the case for me .

isn't it supposed to append the data with already existing data from paimon.moe, assuming you append the data for every time you update your wish history on the website?

MadeBaruna commented 2 years ago

https://bit.ly/3QKFLEQ

are you sure this is safe? will this process not get me banned or anything? just making sure...

Should be safe, it doesn't read/write anything to the game memory

arshpsps commented 2 years ago

/genshin/event/e20... is on localhost for my instance. Changing the URL doesn't work either.

cptmacp commented 2 years ago

/genshin/event/e20... is on localhost for my instance. Changing the URL doesn't work either.

you prob doing something wrong then

i tried it few hours ago and its working fine.

try to restart the app and again press f3 -> history

kazerniel commented 2 years ago

https://bit.ly/3QKFLEQ

Is this only a temporary solution? Ie. will there be a way to auto-import without having to install a new program on my PC?

MadeBaruna commented 2 years ago

https://bit.ly/3QKFLEQ

Is this only a temporary solution? Ie. will there be a way to auto-import without having to install a new program on my PC?

Until someone find a way without installing stuff

rodrigo-apoc commented 2 years ago

Same problem here

zhoeryamh commented 2 years ago

https://bit.ly/3QKFLEQ Don't forget add #/log after copying the url.

in my case, the url structure is the same, but the captured url isn't a complete like the old output_log.txt image

jogerj commented 2 years ago

I made a workaround that grabs the URL from cache. It's less intrusive and safer than Fiddler. See if anyone can help test it (global only for now)

iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/jogerj/0339e61a92e0de2e360c5212a94854e8/raw/6ddd4d2d7f7feff3d25e767a6272ff48ba1e9cd2/get_wish_url_from_cache.ps1'))

path location in chinese version might be different, will need info regarding this

PrimeCicada commented 2 years ago

I managed to find the url still logged on the local machine, it's just in another folder now. Switching in the code for grabbing the URL should allow it to work.

Folder name appears to be ID of some sort, but I have tested this to be working on 2 seperate machines. Might require more testing though. It would likely fail if the user installs the game anywhere aside from the default installation path

$base = "$Env:Programfiles\Genshin Impact\Genshin Impact Game\GenshinImpact_Data\webCaches\Service Worker\CacheStorage\f944a42103e2b9f8d6ee266c44da97452cde8a7c"
$file = "00d9a0f4d2a83ce0_0"

$folder = Get-ChildItem $base | sort -Property LastWriteTime -Descending | select -First 1
$content = Get-Content "$($folder.FullName)\00d9a0f4d2a83ce0_0" | Select-String -Pattern 'https://webstatic-sea.hoyoverse.com/genshin/event/e20190909gacha-v2/'
$url = $content[1].ToString()
$match = $url -match "https.*log"
if (-Not $match) {
    Write-Host "Cannot find the wish history url! Make sure to open the wish history first!" -ForegroundColor Red
    exit
}
$uri = [System.UriBuilder]::New($matches[0])
.....

More resilient approach by getting installer path and getting game installation path from there. This should account for users who do not have their game installed in the default directory.

$launcher_path = Get-ItemPropertyValue -Path "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\launcher" -Name InstPath
$config = Get-Content "$launcher_path\config.ini"  | Select-String -Pattern "game_install_path"
$genshin_path = $config[0].ToString() -replace "game_install_path=", ""

$base = "$genshin_path\GenshinImpact_Data\webCaches\Service Worker\CacheStorage\f944a42103e2b9f8d6ee266c44da97452cde8a7c"
$file = "00d9a0f4d2a83ce0_0"

$folder = Get-ChildItem $base | where {$_.Attributes -match'Directory'} | sort -Property LastWriteTime -Descending | select -First 1
$content = Get-Content "$($folder.FullName)\00d9a0f4d2a83ce0_0" | Select-String -Pattern "https://webstatic-sea.hoyoverse.com/genshin/event/e20190909gacha-v2/"
$url = $content[1].ToString()
$match = $url -match "https.*log"
if (-Not $match) {
    Write-Host "Cannot find the wish history url! Make sure to open the wish history first!" -ForegroundColor Red
    Read-Host
    exit
}
$uri = [System.UriBuilder]::New($matches[0])
.....
jogerj commented 2 years ago

@PrimeCicada nice find, doesn't require a third-party tool either

PrimeCicada commented 2 years ago

Yeah. I didn't wanted to make too much changes to the existing code so I hoped the url is still being logged somewhere, and it came true. I wanted to incorporate your code for getting the installation path more reliably, but had met the same issue where there was no installpath, which you had just addressed.

driftywinds commented 2 years ago

I made a workaround that grabs the URL from cache. It's less intrusive and safer than Fiddler. See if anyone can help test it (global only for now)

iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/jogerj/0339e61a92e0de2e360c5212a94854e8/raw/6ddd4d2d7f7feff3d25e767a6272ff48ba1e9cd2/get_wish_url_from_cache.ps1'))

path location in chinese version might be different, will need info regarding this

The doesn't seem to work

jogerj commented 2 years ago

I've incorporated this better method from @PrimeCicada into my script and added some workarounds for getting the Genshin install path. It should work now

Genshin Impact 3.0 Wish URL gist

MadeBaruna commented 2 years ago

Updated the script here: https://gist.github.com/MadeBaruna/1d75c1d37d19eca71591ec8a31178235 thanks to @jogerj and @PrimeCicada :)

nagi-desuuu commented 1 year ago

Question, the tutorial for Android platforms concerning proxies on wifi will still let me connect to the game normally, right? I mean, it's tedious to repeatedly remove and reinsert all the values back in if you want to (re)import new wishes if that was the case.

MadeBaruna commented 1 year ago

Question, the tutorial for Android platforms concerning proxies on wifi will still let me connect to the game normally, right? I mean, it's tedious to repeatedly remove and reinsert all the values back in if you want to (re)import new wishes if that was the case.

Well you need to disable the proxy after getting the link