Have you ever wondered if you can create a free video hosting? Like basically unlimited* and pretty good...
If so, you've come to the right place. This is a telegram userbot that also listens to the http requests.
When you send a video to the chat you designated as a hosting chat this userbot will reply you with a link to this video.
This link can be embedded into discord or other messengers.
Tricky part is that the bots are limited to files of 20 MB so you'd need to create your own "client" and authenticate under your profile.
* Unlimited assuming you have second-level domain to use cloudflare caching since telegram download speed is fairly limited. File size limitation info here.
- Get apiId and apiHash by following this steps
- Get myId and chatId by forwarding message of a bot that you created. Forward the message to the bot like this one
- StartId is obtained from the logs
Copy config.template.yaml
as config.yaml
, edit to fit your needs
cp config.template.yaml config.yaml
vim config.yaml
- port - port of the web app
- myId - id of your account
- chatId - id of chat designated as a hosting chat
- apiId - telegram api ID
- apiHash - telegram api hash
- startId - index of the first message this worker can send
- secretEncrypt - random 32-64 byte string
- secretTweak - random >1 byte init vector (more)
- modulus - total amount of options. bigger value slower encryption, lower value more chance of a collision
- domain - public domain and path for the host
npm
npm i
pnpm
pnpm i
npm
npm run start
pnpm
pnpm run start
When running first time you'll be prompted all your telegram creds (phone, code, password). Generated telegram session is stored plain-text locally afterwards.
Sequential id of the message is encoded as 24bit integer. This naturally limits modulus to the value of 16,777,215. Also package for the FPE ecnryption is designed to be used with modulus value up to 10,000,000.
Straightforward way is to set startId to a value of 5,000,000. In case you have even more messages please consider rewriting index.js
to user 32bit int instead of 24bit.
- Implement Range requests (now scrubbing works only in discord embedding since it's preloading the video)