Last active
April 12, 2025 23:15
-
-
Save Piterden/9520388a5de85e371a3912415db37033 to your computer and use it in GitHub Desktop.
Telegram API page parser. Run this in the console on tg API page
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
| Array.from(document.querySelectorAll('h4')).map((el) => { | |
| const nextEl = el.nextElementSibling | |
| const tableEl = nextEl.nextElementSibling | |
| return ` | |
| /**${nextEl.innerText.replace(/(.{1,72}\s)\s*?/g, '\n * $1')} | |
| */ | |
| export type ${el.innerText} = { | |
| ` + Array.from(tableEl.children[0].children).slice(1).map((tr) => { | |
| const arr = Array.from(tr.children) | |
| return arr.length | |
| ? arr[2].innerText.length > 72 | |
| ? ` | |
| /**${arr[2].innerText.replace(/(.{1,72}\s)\s*?/g, '\n * $1')} | |
| */ | |
| ${arr[0].innerText}: ${arr[1].innerText.toLowerCase()}, | |
| ` | |
| : ` /** ${arr[2].innerText} */\n ${arr[0].innerText}: ${arr[1].innerText.toLowerCase()},\n\n` | |
| : '' | |
| }).join('') + `} | |
| `}).join('') |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/sergeysova/telegram-typings
Thanx, Sova, you are da shit!