Telethon
Telethon copied to clipboard
Download web files through Telegram
Currently, the library downloads WebDocument
and WebDocumentNoProxy
in the same way. This however is a security risk, since it allows websites to learn information about the client, such as IP address.
Instead, as explained in Telegram's documentation, the download should be proxied through Telegram's servers to avoid information leakage.
The solution will need to find a web file to test this on, and then modify the following method:
https://github.com/LonamiWebs/Telethon/blob/5c5cee16d9e1811b5e8c9a11fb89257a0433db5d/telethon/client/downloads.py#L297
If it receives a web document, follow the advice from the official documentation to implement a correct download.