Last active
December 24, 2023 07:27
-
-
Save blueaxis/77847e63522fc747450ef718b68719ee to your computer and use it in GitHub Desktop.
Script to obtain token and ID from Hoyolab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Script to obtain token and ID from Hoyolab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(()=>{if(document.cookie.includes('ltoken')&&document.cookie.includes('ltuid')){const e=document.createElement('input');try{e.value=`${t('ltuid')},${t('ltoken')}`}catch(o){console.warn('readCookie is still undefined');const t=e=>{const o=`; ${document.cookie}`.split(`; ${e}=`);if(2===o.length)return o.pop().split(';').shift()};e.value=`${t('ltuid')},${t('ltoken')}`}document.body.appendChild(e),e.select(),navigator.clipboard.writeText(e.value),prompt('Success! Token is copied to clipboard. You may manually copy the token below:\n',e.value)}else alert('Token has expired. Please signin again.')})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
if (document.cookie.includes("ltoken") && document.cookie.includes("ltuid")) { | |
const input = document.createElement("input"); | |
try { | |
input.value = `${readCookie("ltuid")},${readCookie("ltoken")}`; | |
} catch (o) { | |
console.warn("readCookie is still undefined"); | |
const readCookie = (key) => { | |
const cookies = `; ${document.cookie}`.split(`; ${key}=`); | |
if (2 === cookies.length) return cookies.pop().split(";").shift(); | |
}; | |
input.value = `${readCookie("ltuid")},${readCookie("ltoken")}`; | |
} | |
document.body.appendChild(input), | |
input.select(), | |
navigator.clipboard.writeText(input.value), | |
prompt( | |
"Success! Token is copied to clipboard. You may manually copy the token below:\n", | |
input.value | |
); | |
} else alert("Token has expired. Please signin again."); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment