Skip to content

Instantly share code, notes, and snippets.

@jogerj
Last active April 24, 2024 11:25
Show Gist options
  • Star 25 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • 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 4.6 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 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://yume-chan.github.io/ya-webadb/ 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')

@Vivek9190
Copy link

Thank you very much .I connected my android phone to my laptop using the linux method and worked wonderfully .Thank y Thank y.For some reasosn it wasnt copied to clipboard but everyelse was perfect . U are a godsend :)

@jogerj
Copy link
Author

jogerj commented Jan 5, 2023

For some reasosn it wasnt copied to clipboard but everyelse was perfect .

Hi, this script uses xclip for copying the text into clipboard. It is likely that you do not have xclip installed because your distro did not include it (please do tell what distro you have, I'd like to know!). I'll figure out an alternative/check for copy paste function when I have time.

It's also possible you're using wayland, you could try wclip or wl-clipboard instead at line 55.

@Mccoy2101
Copy link

Hi, the "Alternative video tutorial on running from Android (without PC)" doesn't work for me. how do i fix it?

@Mccoy2101
Copy link

I putted my ip adress and putted the port "5555" but it still doesn't work

@Mccoy2101
Copy link

It says "Connection Failed failed to connect to /61.9.110.161 (port 5555) from /192.168.55.107 (port 48066) after 5000ms"

@Mccoy2101
Copy link

I really need answers ASAP because my old wish history will be deleted after january, Thankyou for replying.

@jogerj
Copy link
Author

jogerj commented Jan 26, 2023

Hi, the "Alternative video tutorial on running from Android (without PC)" doesn't work for me. how do i fix it?

@Mccoy2101 You can try the other methods or checkout the discord server, there lots of people can help you too

@Sim-Unknown
Copy link

I've followed all of the steps and when I enter "adb logcat -m 1 -e "OnGetWebViewPageFinish.+https.+/log" | grep -oE "https.+/log" | tee >(termux-clipboard-set) &" it says waiting for device, so I got to genshin wish history but nothing changes. Am I doing something wrong?

@jogerj
Copy link
Author

jogerj commented May 29, 2023

@Sim-Unknown your device wasn't connected/found. After step 6, you should see your device listed when you run adb devices. Refer to the video guide on how it runs

@Sim-Unknown
Copy link

Thank you, I just did it and it worked!

@Kofeeze
Copy link

Kofeeze commented Aug 22, 2023

Thank you so much. i am on android 12. works as of Aug 22nd 2023!

@08Dreaj
Copy link

08Dreaj commented Jan 20, 2024

Thanks for this 🙏🏽. I'll share this with paimon.moe so others can use this.

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