Skip to content

Instantly share code, notes, and snippets.

@jogerj
Last active October 13, 2024 09:22
Show Gist options
  • Save jogerj/2372d0e5bee51e001a6d8956240d527b to your computer and use it in GitHub Desktop.
Save jogerj/2372d0e5bee51e001a6d8956240d527b to your computer and use it in GitHub Desktop.
Get Wish URL in Genshin Impact 5.0 on Android using Android Debugging Tools

Usage

These instructions are for users with Genshin Impact installed on Android. For installations on PC, see other guide.

Using Termux on Android

  1. Open and Download Termux (Do not download from Play Store as it is not up-to-date)

    • Android 11 and above: Enable Wireless Debugging on your Android phone.
    • Android 10 or below: You need a PC to enable port 5555, follow these instructions to connect then skip step 5-7.
  2. Open Termux and run pkg update && pkg install android-tools termux-api (if failed, run apt update && apt install android-tools termux-api instead)

  3. Open Settings > System > Developer Options > Wireless Debugging. Open the app switcher then tap and hold the Settings app icon. Select "Split top", then select Termux as the bottom half.

  4. Tap on "Pair device with pairing code" and a window will appear. Go to Termux and run adb pair localhost:12345 replacing 12345 with the port number shown in the window (192.168.x.x:12345). Enter the pairing code when prompted, DO NOT CLOSE PAIRING CODE PROMPT the pairing window will close automatically.

  5. Run adb connect localhost:23456 replacing 23456 with the port number shown under "IP address & Port" (192.168.x.x:23456)

  6. Run following

    adb logcat -m 1 -e "OnGetWebViewPageFinish.+https.+/log" | grep -oE "https.+/log" | tee >(termux-clipboard-set) &

  7. Open Genshin Wish history

  8. The wish URL should be written to your clipboard already. If not, you can copy the text output in Termux

  9. Paste to any wish import websites (e.g. paimon.moe).

After running once, start from step 6 when you want to fetch wish URL again

Alternative steps (see video):

  1. Run adb shell

  2. Run following:

    am start -a android.intent.action.VIEW -d "$(logcat -m 1 -e "OnGetWebViewPageFinish.+https.+/log" | grep -oE "https.+/log" | tee /dev/tty)" &

  3. Open Genshin Wish history. Once opened, the page would load in a browser instead

  4. Tap on the address bar, select all, and copy

  5. Paste to paimon.moe.

Using PC

via WebADB (Video Demo)

  1. Enable USB debugging on your phone (About phone -> tap Build Number 7x, then go to Developer Options)

  2. Connect phone with USB cable to PC.

  3. Open https://tango-adb.github.io/old-demo/ in Chrome/MS Edge (Firefox/Safari/etc. not supported)

  4. Click on "Add" and select your device (If you don't see your device, make sure to follow step 1-2 correctly)

  5. A pop-up will appear on your phone. Check "Always allow from this computer" and click "Allow"

  6. Open Interactive Shell. You should see something like oriole:/ $

  7. Enter the following into the shell (Ctrl-C then use Ctrl-Shift-V to paste, or use right-click)

    am start -a android.intent.action.VIEW -d "$(logcat -m 1 -e "OnGetWebViewPageFinish.+https.+/log" | grep -oE "https.+/log" | tee /dev/tty)" &

  8. Open wish history on your phone

  9. Wish history should open in your phone browser. Alternatively the URL should also appear on the shell terminal, which you can copy too (use right-click)

  10. Copy the URL and paste to paimon.moe

Alternative: Using Powershell/Bash

  1. Connect your Android phone to your computer with a USB cable

  2. Enable USB Debugging on your Android phone

  3. Windows: Press Win+R and paste:

    powershell iex(irm 'https://gist.githubusercontent.com/jogerj/2372d0e5bee51e001a6d8956240d527b/raw/getlink_android.ps1')

    Linux/macOS: Open Terminal and paste:

    bash -c "$(curl -fsSL https://gist.githubusercontent.com/jogerj/2372d0e5bee51e001a6d8956240d527b/raw/getlink_android.sh)"

  4. Paste to paimon.moe under PC > Method 1

Alternative video tutorial on running from Android (without PC)

What is "adb"?

The Android Debug Bridge is a developer tool for Android that allows your computer to interact with your Android phone. It also allows you to invoke commands on your phone from your computer and monitor its output directly. This script will download ADB to your computer and runs it to interact with your phone. After the script finishes, it will clean up after itself. The download is about 5 MB.

Troubleshooting

Could not connect to android device!

  1. Try disabling/enabling USB debugging
  2. Open notification drawer, tap on "Charging this device via USB", change to "File Transfer" or "MTP"
  3. You can also connect with adb via wifi (instructions soon)

I don't want to download adb each time

You can download ADB from here and extract the zip file. You can connect to your phone with ADB via Wi-Fi. (Android 11+ guide, Android 10 and lower guide) or with a USB cable.

  • Windows:

    Open Powershell in the platform-tools directory and paste following:

    .\adb logcat -m 1 -e "OnGetWebViewPageFinish" | % {if ($_ -match "https.+/log") { $wishUrl = $Matches[0]; Write-Host $wishUrl; Set-Clipboard -Value $wishUrl}}

  • macOS:

    Open Terminal in the platform-tools directory and paste following:

    url="$(grep -m 1 -oE "https.+/log" <( adb logcat -m 1 -e "OnGetWebViewPageFinish" ) )"; echo "$url"; echo -e "$url" | pbcopy;

  • Linux:

    Open Terminal in the platform-tools directory and paste following:

    url="$(grep -m 1 -oE "https.+/log" <( adb logcat -m 1 -e "OnGetWebViewPageFinish" ) )"; echo "$url"; echo -e "$url" | xclip -selection c;

  • Android:

    In Termux first run apt install android-tools termux-api and connect over Wi-Fi. Paste following: url="$(grep -m 1 -oE "https.+/log" <( adb logcat -m 1 -e "OnGetWebViewPageFinish" ) )"; echo "$url"; echo -e "$url" | termux-clipboard-set;

Todos

  • Attempt to use already installed adb if available instead of downloading adb every time

  • Backport this to older powershell. There exists the following code but still needs more testing. Copy paste to powershell:

    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/MadeBaruna/c72102e26c811ce789c83f3ca37f0162/raw/android.ps1')

@daUnknownCoder
Copy link

1 year can be retrieved

how can i get my other 6 months?

@jogerj
Copy link
Author

jogerj commented Oct 6, 2024

how can i get my other 6 months?

@daUnknownCoder already included

@daUnknownCoder
Copy link

@daUnknownCoder already included

so did i get 1 year?

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