Skip to content

Instantly share code, notes, and snippets.

@MadeBaruna
Last active November 16, 2024 19:39
Show Gist options
  • Save MadeBaruna/1d75c1d37d19eca71591ec8a31178235 to your computer and use it in GitHub Desktop.
Save MadeBaruna/1d75c1d37d19eca71591ec8a31178235 to your computer and use it in GitHub Desktop.
Get Genshin Impact wish history link

Updated for 4.6

Thanks to @jogerj and @PrimeCicada for the method! Original script: https://gist.github.com/jogerj/0339e61a92e0de2e360c5212a94854e8

Thanks to @SleepingPanda for 3.8 change info

How to use

Open powershell, then copy paste this script:

Global:

iex "&{$(irm https://gist.githubusercontent.com/MadeBaruna/1d75c1d37d19eca71591ec8a31178235/raw/702e34117b07294e6959928963b76cfdafdd94f3/getlink.ps1)} global"

China:

iex "&{$(irm https://gist.githubusercontent.com/MadeBaruna/1d75c1d37d19eca71591ec8a31178235/raw/702e34117b07294e6959928963b76cfdafdd94f3/getlink.ps1)} china"
@Samonyoge
Copy link

Cannot find the wish history url! Make sure to open the wish history first!

@vancodocton
Copy link

U miss double quotes (") and the end of "How to use" srcripts

@jogerj
Copy link

jogerj commented Dec 29, 2022

Just check both locations, if both exists then grab whichever is newer. No need for args, one same script and command for both global and china. https://github.com/jogerj/genshin-wish-url

$logLocationGlobal = "%userprofile%\AppData\LocalLow\miHoYo\Genshin Impact\output_log.txt";
$logLocationChina = "%userprofile%\AppData\LocalLow\miHoYo\$([char]0x539f)$([char]0x795e)\output_log.txt";
$pathGlobal = [System.Environment]::ExpandEnvironmentVariables($logLocationGlobal);
$pathChina = [System.Environment]::ExpandEnvironmentVariables($logLocationChina);

if ([System.IO.File]::Exists($pathGlobal)) {
    if ([System.IO.File]::Exists($pathChina)) {
        # both exists, pick the newest one
        if ((Get-Item $pathGlobal).LastWriteTime -ge (Get-Item $pathChina).LastWriteTime) {
            $path = $pathGlobal;
            $apiHost = "hk4e-api-os.hoyoverse.com";
        } else {
            $path = $pathChina;
            $apiHost = "hk4e-api.mihoyo.com";
        }
    } else {
        $path = $pathGlobal;
        $apiHost = "hk4e-api-os.hoyoverse.com";
    }
} else {
    if ([System.IO.File]::Exists($pathChina)) {
        $path = $pathChina;
        $apiHost = "hk4e-api.mihoyo.com";
    } else {
        Write-Host "Cannot find the log file! Make sure to open the wish history first!" -ForegroundColor Red
        if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {  
            Write-Host "Do you want to try to run the script as Administrator? Press [ENTER] to continue, or any key to cancel."
            $keyInput = [Console]::ReadKey($true).Key
            if ($keyInput -ne "13") {
                return
            }
            $myinvocation.mycommand.definition > $tmps
            Start-Process powershell -Verb runAs -ArgumentList "-noexit", $tmps
            break
        }
        return
    }
}

@marikawacch
Copy link

https://webstatic-sea.hoyoverse.com/genshin/event/e20190909gacha-v2/index.html?win_mode=fullscreen&authkey_ver=1&sign_type=2&auth_appid=webview_gacha&init_type=301&gacha_id=666e99c499de824cf10211511d3c2ad3b48cf38d&timestamp=1673997965&lang=ja&device_type=pc&game_version=OSRELWin3.4.0_R12875869_S12901190_D12787608&plat_type=pc&region=os_asia&authkey=lTW%2fFdSYCJPo85m%2bPESmZ4xCjwsfJBWHpI%2fXOAHYKaE8iv%2fgsHR%2bJJam%2bUHaKBIG7B0nVNkWcTnJer7c1j53B%2fJ2L8hXgA0LhNxj0VzuZpW%2faEAl8pOI3e%2bCn%2bCUgs0AxSvA4BJaxCNDBIJ9S8b8UTue5igLGzGR9GOf78Te7HhwZ%2fkhJWAB4A9S0fTfYDjjKchwYfSt%2ba8haNIAfXK%2f0OhnbBye3%2b4SiOOl%2fHb%2fpZl7zxWMvmokQEkY1PYqxwIPnqYdbh80Knh%2fAG%2bKuy%2fQn2JjD8v14l7r3LSVK%2fs02uchlh%2fDede6Oor0Mscf5rykkdotgVAbDotJeYg2Nrarn4MP4HIIaF8a08UW8KTZND3m1a%2fK%2fed32elkTNgqhWjAi1ZDlGW3J099%2buLjEUb0Bqm7IMEf7RNdkX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909gacha-v2/index.html?win_mode=fullscreen&authkey_ver=1&sign_type=2&auth_appid=webview_gacha&init_type=301&gacha_id=666e99c499de824cf10211511d3c2ad3b48cf38d&timestamp=1673997965&lang=ja&device_type=pc&game_version=OSRELWin3.4.0_R12875869_S12901190_D13021296&plat_type=pc&region=os_asia&authkey=lTW%2fFdSYCJPo85m%2bPESmZ4xCjwsfJBWHpI%2fXOAHYKaE8iv%2fgsHR%2bJJam%2bUHaKBIG7B0nVNkWcTnJer7c1j53B%2fJ2L8hXgA0LhNxj0VzuZpW%2faEAl8pOI3e%2bCn%2bCUgs0AxSvA4BJaxCNDBIJ9S8b8UTue5igLGzGR9GOf78Te7HhwZ%2fkhJWAB4A9S0fTfYDjjKchwYfSt%2ba8haNIAfXK%2f0OhnbBye3%2b4SiOOl%2fHb%2fpZl7zxWMvmokQEkY1PYqxwIPnqYdbh80Knh%2fAG%2bKuy%2fQn2JjD8v14l7r3LSVK%2fs02uchlh%2fDede6Oor0Mscf5rykkdotgVAbDotJeYg2Nrarn4MP4HIIaF8a08UW8KTZND3m1a%2fK%2fed32elkTNgqhWjAi1ZDlGW3J099%2buLjEUb0Bqm7IMEf7RNdkXwIK5mHUupcQHrygKW8rwmEV2utN0zV7sQbOg50jeVy5JMswPVC%2fMpHfyZS3igG%2fd5jaecBrZ67m3anvfb4T%2fu9aHs0X4vqmiQmYlcoLoLjJ0ewTbLranAxUQdrpmJ%2fIILK99PKMAAwv%2byMhmhglPhdPxqKcfvWCqDGIIvM5nrFO99nAaVVg1m7IOjwdnXQGDFKEKr434htgGv0QeF6MZYnNlQ0T%2fWEBj6m%2bm0UMoC2eD91TCD%2fGVl%2bCMiIOHrlWvE7kljNOBnpeL2xnl8XUgPH9COEoINpg5KMwyDFlD53691Bqc64scQWFfvS59Y1VjfpJ9g4qCpuvs6EiAV%2f4e3Cr%2bCreHl7QOkFncNDMoEPYnlyVrc9qq6dPt7N%2fQ6omZ23CpvlCQA%2fQnbzqwg%2b0OxdUVwOBtAFrdxMz5kqHEQawwIuUyHciZENJ%2fZWlORH0q4LCzaYj%2b3Pd%2fhkH2YeV3yn0qGJoDVnzVU%2bKYs0Sj2YSM8j3mR51x84tROO9N8%2bE81snOZ1M%2bd9joNgXcj2NZK%2bSoTMxYcyXgs%2b%2bFZ%2bi8KjpSzlta7fL5UAHVq%2bIP37BOj8uRMCFy0PUxPwtWkE%2f6Ls6oSKUyrSQm1mJLl0ng%2bm1Z%2fDFtV8HPXBb37R14dR9vmETRKZvxu5%2bEPrF7t0AHkxtdeG8MSWYtIdaAQ609kdr51LOFGlVsbSmd1cJSjGDULHqaTpqCrketxvo66WQaXJPlLQbuzJ4%2bkX9X9dSowOJ3G2utbSConth9tIACcMZG0bcv4xzCtg4%2f0Y6wkMia1ZR0iGzZxJuDMd6mp0PeJ%2b%2fmnLiMFna2MHfe537UkKyOG%2bhC6jQjBwSI0d3QUlURNYGbeV207lsIMfoV9%2fHfFiTGFPzkyssa5CtCQ5IYfyqJkczjsOS2Z%2bl6tZyJ3sLPdDEE1KF0I0XiugWyETODY3xBST6I3Bpw%3d%3d&game_biz=

@marikawacch
Copy link

https://webstatic-sea.hoyoverse.com/genshin/event/e20190909gacha-v2/index.html?win_mode=fullscreen&authkey_ver=1&sign_type=2&auth_appid=webview_gacha&init_type=301&gacha_id=666e99c499de824cf10211511d3c2ad3b48cf38d&timestamp=1673997965&lang=ja&device_type=pc&game_version=OSRELWin3.4.0_R12875869_S12901190_D13021296&plat_type=pc&region=os_asia&authkey=lTW%2fFdSYCJPo85m%2bPESmZ4xCjwsfJBWHpI%2fXOAHYKaE8iv%2fgsHR%2bJJam%2bUHaKBIG7B0nVNkWcTnJer7c1j53B%2fJ2L8hXgA0LhNxj0VzuZpW%2faEAl8pOI3e%2bCn%2bCUgs0AxSvA4BJaxCNDBIJ9S8b8UTue5igLGzGR9GOf78Te7HhwZ%2fkhJWAB4A9S0fTfYDjjKchwYfSt%2ba8haNIAfXK%2f0OhnbBye3%2b4SiOOl%2fHb%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SOtGhMJDp1YGtmR42HHEFyjjc7rokm6zOvgowhz2pRURwF0sd54TRl5cFBr5hFzsYaoXA8tlSZsRw3fGdM9eW0Jm0t%2fB9OcoRCpFDrnJJIksxoREKjH8QkV9w%3d%3d&game_biz=

@tahakhany
Copy link

can you change this last line:

Write-Host "Link copied to clipboard, paste it back to paimon.moe" -ForegroundColor Green

into something like:

Write-Host "Link copied to clipboard, paste it back to https://paimon.moe" -ForegroundColor Green

so that PowerShell would recognize it as a link?
I guess it'll make it easier to go into the site.
Thanks.

@SleepingPanda
Copy link

SleepingPanda commented Jul 5, 2023

Looks like Mihoyo changed something. I'm unable to get the wish history link from %gamedir%\GenshinImpact_Data\webCaches\Cache\Cache_Data\data_2 .
Edit: It seems to be moved to %gamedir%\GenshinImpact_Data\webCaches\2.13.0.1\Cache\Cache_Data\data_2

@sxpso
Copy link

sxpso commented Jul 5, 2023

For anybody who needs to import their wish history feel free to use https://gist.github.com/mimicate/288c9a092daea534b4843f551f675c2e

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex "&{$((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/mimicate/288c9a092daea534b4843f551f675c2e/raw/8045364f337c536b1a28a796ef4416e26e3b4cad/getlink.ps1'))} global"

@code2me
Copy link

code2me commented Jul 5, 2023

For anybody who needs to import their wish history feel free to use https://gist.github.com/mimicate/288c9a092daea534b4843f551f675c2e

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex "&{$((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/mimicate/288c9a092daea534b4843f551f675c2e/raw/8045364f337c536b1a28a796ef4416e26e3b4cad/getlink.ps1'))} global"

@Mimicate Thanks, This is working perfectly.

@cytsai1008
Copy link

On game ver 4.0, they changed the webcaches dir from 2.13.0.1 into 2.15.0.0

@jogerj
Copy link

jogerj commented Aug 20, 2023

$webcachePath = Resolve-Path "$gamedir/webCaches"
$cacheVerPath = Get-Item (Get-ChildItem -Path $webcachePath | Sort-Object LastWriteTime -Descending | Select-Object -First 1).FullName
$cachefile = Resolve-Path "$cacheVerPath/Cache/Cache_Data/data_2"

This should resolve the issue with changing version numbers for the cache path

@TheKing-OfTime
Copy link

Looks like links from How to use in README.md is outdated.

@jogerj
Copy link

jogerj commented Aug 25, 2023

Yes, link should be replaced with https://gist.github.com/MadeBaruna/1d75c1d37d19eca71591ec8a31178235/raw/getlink.ps1 -> this will always point to latest version of file

@My1
Copy link

My1 commented Sep 3, 2023

someone have archives of older versions? I think MiHoYoSDK, Version=2.15.0.0, in the resources.assets may be helpful

@Cayahuanca
Copy link

In my environment, it seems that the webCaches folder specified on line 49 of this script has changed from 2.15.0.0 to 2.16.0.0 with the 4.1.0 update.

4.0.x
$cachefile = "$gamedir/webCaches/2.15.0.0/Cache/Cache_Data/data_2"

4.1.0
$cachefile = "$gamedir/webCaches/2.16.0.0/Cache/Cache_Data/data_2"

@Jerit3787
Copy link

Yes, link should be replaced with https://gist.github.com/MadeBaruna/1d75c1d37d19eca71591ec8a31178235/raw/getlink.ps1 -> this will always point to latest version of file

This method by @jogerj should be used to get updated link! Link in the paimon.moe needs to be updated

@RedContritio
Copy link

RedContritio commented Apr 24, 2024

at "README.md", the code line should be

Global:

iex "&{$(irm https://gist.githubusercontent.com/MadeBaruna/1d75c1d37d19eca71591ec8a31178235/raw/702e34117b07294e6959928963b76cfdafdd94f3/getlink.ps1)} global"

China:

iex "&{$(irm https://gist.githubusercontent.com/MadeBaruna/1d75c1d37d19eca71591ec8a31178235/raw/702e34117b07294e6959928963b76cfdafdd94f3/getlink.ps1)} china"

you have missed the quote " at line ends.


this two commands not work now, I refered to the available version by @jogerj, with command iex (irm 'https://gist.githubusercontent.com/jogerj/0339e61a92e0de2e360c5212a94854e8/raw/get_wish_url_from_cache.ps1')

@Nats-ji
Copy link

Nats-ji commented Apr 24, 2024

cn server api host changed to $apiHost = "public-operation-hk4e.mihoyo.com"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment