Giter VIP home page Giter VIP logo

sliterok / hosting Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 29 KB

Free video hosting using telegram client API

License: GNU General Public License v3.0

JavaScript 100.00%
discord free hosting self-hosted telegram telegram-api telegram-userbot video video-embed video-embedding video-hosting filehost filehoster filehosting free-for-u free-hosting telegram-bot video-hosting-platform videohoster

hosting's Introduction

Telegram video hosting

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 creds

  • 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

Config

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

Install deps

npm

npm i

pnpm

pnpm i

Run

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.

FAQ

What's reasonable value for the modulus?

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.

What If I have more than 5,000,000 messages?

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.

TODO

  • Implement Range requests (now scrubbing works only in discord embedding since it's preloading the video)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.