Created
October 29, 2025 11:24
-
-
Save gornostay25/cbf9de4cc5e9c749099181a430c8cdae to your computer and use it in GitHub Desktop.
Telegram Chat Export HTML to Text
This file contains hidden or 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
| let msg = ''; | |
| [...document.querySelector('.history').children].forEach(elm =>{ | |
| if (elm.classList.contains("service")) return; | |
| if (elm.classList.contains("joined")) { | |
| const text = elm.querySelector(".text")?.textContent?.trim(); | |
| if (!text) return; | |
| msg += `${text}\n`; | |
| return | |
| } | |
| const from = elm.querySelector(".from_name")?.textContent?.trim(); | |
| const text = elm.querySelector(".text")?.textContent?.trim(); | |
| if (!from || !text) return; | |
| msg += `${from}: ${text}\n`; | |
| }) | |
| console.log(msg); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment