Skip to content

chahakshahcs5/tg-to-cloud

Repository files navigation

Telegram Save to Cloud

This project is a TypeScript-based tool and python server for uploading files to various cloud storage providers, with a plugin-based architecture that makes it easy to extend.

Features

  • Cloud Agnostic: Easily switch between different cloud storage providers by changing the configuration.
  • Plugin-Based Architecture: Add support for new cloud providers by creating a new plugin.
  • Environment-Based Configuration: Uses a .env file for easy configuration.

Installation

  1. Clone the repository:
    git clone https://github.com/chahakshahcs5/tg-to-cloud.git
    cd tg-to-cloud
  2. Install the dependencies:
    npm install
  3. Build the project:
    npm run build
  4. Python Setup:
    python3 -m venv .venv
    source venv/bin/activatebasher 
    python3 -m pip install -r requirements.txt
    npm install
    source /home/user/tg-to-cloud/.venv/bin/activate && python3 main.py

Configuration

  1. Create a .env file in the root of the project.

  2. Add the following environment variables:

    API_ID=
    API_HASH=
    SESSION_STRING= Session string 
    NDUS=  Terabox Nuds - Gte it from Cookies of terabox website
    ARIA2_URL="http://localhost:8080/jsonrpc"
    ARIA2_SECRET="secret"
    CLOUD_PLUGIN="terabox"
    MONGODB_URI=mongodb://localhost:27017
    MONGO_DB=tg-to-cloud
  3. Configure the cloud provider-specific settings in src/config/cloudConfig.ts.

Supported Cloud Providers

  • Terabox: The initial implementation includes a plugin for Terabox.

How to Add a New Cloud Provider

  1. Create a new plugin in the src/plugins directory.
  2. Implement the ICloudPlugin interface.
  3. Add the configuration for the new plugin in src/config/cloudConfig.ts.
  4. Update the CLOUD_PLUGIN environment variable in your .env file to the name of your new plugin.

Project Structure

.
├── src
│   ├── plugins
│   │   └── terabox
│   │       └── index.ts
│   ├── config
│   │   ├── cloudConfig.ts
│   │   └── ...
│   ├── helpers
│   │   └── cloudPluginManager.ts
│   └── index.ts
├── package.json
└── tsconfig.json
main.py
config.py

Dependencies

Dev Dependencies

Python Dependencies

  • telethon==1.40.0
  • python_dotenv==1.1.1
  • fastapi==0.116.1
  • uvicorn[standard]==0.35.0
  • motor==3.7.1

Python Server

  • Serevr is running on Port 8000
  • EndPoint - GET - "/export/{dialog_title}", dialog_title is dialog (channel or group or chat) name, Query Params - exts -> Can be file extension like .png, .pdf
  • Example "/export/test?exts=.png,.mp4"

About

Save files from telegram to cloud

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published