Skip to content

Instantly share code, notes, and snippets.

@alfianokt
Created November 29, 2019 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alfianokt/f46f14a35d383799330c534b113fd2f8 to your computer and use it in GitHub Desktop.
Save alfianokt/f46f14a35d383799330c534b113fd2f8 to your computer and use it in GitHub Desktop.
<div id="photo">😎</div>
<script>
/**
* Via (Android Browser) Custom Image
*
* Change image logo in via app with telegram photo profile
*
* How to use? Open Via > Settings > Customization > Logo > HTML Code, Then paste this script (change the username var with ur username)
*
* alfianokt || 29-11-1019
*/
// change with ur telegram username
const username = 'alfian_oktafireza'
// cors proxy (get content from another http host)
fetch('https://cors-masterkadal.herokuapp.com/https://t.me/' + username)
.then(async (res) => {
const text = await res.text()
const photo = /class="tgme_page_photo_image" src="(.+?)"/.exec(text)[1]
document.getElementById("photo").innerHTML = `<img src="${photo}" width="100px" style="border-radius: 50%; background-color: #FAFAFA;">`
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment